Professional Documents
Culture Documents
Fedora17BootOptimization(from15to2.5seconds)
byHaraldHoyerlastmodifiedJun02,201211:32PM
ThisarticleshowshowtoreduceboottimeforFedora17.
ThetargetistogetafastbootingsystemwithNetworkManagerrunningandgdmdisplayingtheloginscreenasfastas
possible.
ThesystemIusehereisaLenovoT420s(2x2xIntel(R)Core(TM)i52540MCPU@2.60GHz)withanINTEL
SSDSA2BW160G3Lharddrive.
Firstwechooseamanualdisklayoutanduseprimarypartitionsandformatthemwithext4.Inmycasethisresultsin:
sda1 ext4 /boot
sda2 swap
sda3 ext4 /
Afterthefirstboot,setupoftheuser,etc.and2reboots(alwaysreboot2times,beforetakingthemeasurement,because
readaheadneedstoadapttothechangedbootprocess).
Firstweupdateeverything,prelinkforspeedandinstallsystemdanalyze.
$ sudo yum update
$ sudo /etc/cron.daily/prelink
$ sudo yum install systemd-analyze
Afterthereboots,Iget:
# systemd-analyze
Startup finished in 1413ms (kernel) + 2911ms (initramfs) + 10593ms (userspace) = 14918ms
Thenextstepistodisabletheinitramfs,becausethekernelcanbootfromanext4partitionwithoutit.BecauseIknow
howtorescuemysystem,Icansettherootdevicedirectlytosda3andtellthekernelwhichfilesystemtypetouse.My
/etc/grub2.cfglookslikethis:
linux /vmlinuz-3.3.7-1.fc17.x86_64 root=/dev/sda3 rootfstype=ext4 quiet libahci.ignore_sss=1 raid=noautodetect
#
initrd /initramfs-3.3.7-1.fc17.x86_64.img
"raid=noautodetect"and"libahci.ignore_sss=1"savessometimeforthekernelinitialization.
Startup finished in 1640ms (kernel) + 13043ms (userspace) = 14684ms
BecauseIdon'tuseanyLVM,RAIDorencrypteddevices,Icansafelyturnoffallnearlyallfedora*storage*services.
AdditionallyIturnofftheplymouthbootsplash,becauseIwantspeedandnoteyecandy.Toturnofftheseservices,we
usethe"systemctlmask"command.Abonuswiththatmechanismis,thatnorpm%postscriptturnsthemon
automatically.
$ cd /lib/systemd/system
$ for i in fedora*storage* plymouth-*.* lvm2-monitor.* mdmonitor*.*; do sudo systemctl mask $i;done
ItseemstherearestillsomeSysVinitscriptsleft,soweturnthemoff:
$ for i in livesys livesys-late spice-vdagentd ; do sudo chkconfig $i off;done
Seemslikewesavedhalfofthetimeinuserspace:
Startup finished in 1640ms (kernel) + 6556ms (userspace) = 8197ms
www.harald-hoyer.de/personal/blog/fedora-17-boot-optimization-from-15-to-3-seconds
1/14
7/26/13
Fromnowon,youreallyhavetoknowwhatyouaredoingandhowtorevertyouractions.TocompareFedora17withe.g.
Ubuntu,IwillnowturnoffallservicesexceptNetworkManager.TheresultwillbeaLinuxsystemwithoutmail,firewall,
printing,theabrttools,avahi,somemountpoints,rsyslog,irqbalance,andselinuxsecurity.
$ cd /lib/systemd/system
$ for i in abrt*.service auditd.service avahi-daemon.* bluetooth.* dev-hugepages.mount dev-mqueue.mount \
fedora-configure.service fedora-loadmodules.service fedora-readonly.service ip6tables.service \
iptables.service irqbalance.service mcelog.service rsyslog.service sendmail.service sm-client.service \
sys-kernel-config.mount sys-kernel-debug.mount; do \
sudo systemctl mask $i; \
done
Todisableselinux,edit/etc/selinux/configandadd"selinux=0"tothekernelcommandline.My/etc/grub2.cfgnowlooks
likethis:
linux /vmlinuz-3.3.7-1.fc17.x86_64 root=/dev/sda3 rootfstype=ext4 libahci.ignore_sss=1 raid=noautodetect selinux=0
#
initrd /initramfs-3.3.7-1.fc17.x86_64.img
Nowwearereallyfast!
$ systemd-analyze
Startup finished in 1329ms (kernel) + 1596ms (userspace) = 2926ms
Ialsoliketheideaofautomounting(systemd'sautomountfeaturewasanideaofmine:).SoIturn/bootina"mounton
demand"mountpoint.Alsohaving/tmpasatmpfsisonewaytoreducediskactivity(usefulfore.g.aslowflashdisk).
Myresulting/etc/fstablookslikethis:
/dev/sda3
/dev/sda1
/dev/sda2
tmpfs
/
/boot
swap
/tmp
ext4
ext4
swap
tmpfs
defaults
11
noauto,comment=systemd.automount
defaults
00
defaults
00
12
Thisonlysavedalittlebitoftime,butstill:
$ systemd-analyze
Startup finished in 1342ms (kernel) + 1426ms (userspace) = 2769ms
BecauseNetworkManagerisstartedalsobythegraphicallogintarget,Icanremoveitfromthemultiusertargetandit
willbestartedinparalleltothegdmlo)ginscreen.
$ sudo rm /etc/systemd/system/multi-user.target.wants/NetworkManager.service
Thiswillshaveofafewmilliseconds:
$ systemd-analyze
Startup finished in 1323ms (kernel) + 1279ms (userspace) = 2603ms
Toseethedifferencereadaheadmakesforthesystem,Iturnitofftemporarilyandreboot
$ cd /lib/systemd/system
$ for i in *readahead*; do sudo systemctl mask $i;done
Whichwillgiveus:
$ systemd-analyze
Startup finished in 1336ms (kernel) + 1210ms (userspace) = 2547ms
Thistimeisalittlebitmisleading.Althoughitseemsfaster,therealtimeuntiltheloginscreenisdisplayedistaking
longer.Soafaircomparisonwouldinvolveastopwatch.
$ sudo dracut -f
www.harald-hoyer.de/personal/blog/fedora-17-boot-optimization-from-15-to-3-seconds
2/14
7/26/13
Hereisthetimewithreadaheadandtheinitramfsturnedbackon:
$ systemd-analyze
Startup finished in 803ms (kernel) + 2217ms (initramfs) + 1018ms (userspace) = 4039ms
Ofcourse,thiscanbeoptimzedalso,whenwebuildtheinitramfswithoutplymouthandinhostonlymode.
$ sudo dracut -f -H -o plymouth
Afterarebootwegetthestunningresultof:
$ systemd-analyze
Startup finished in 612ms (kernel) + 499ms (initramfs) + 1330ms (userspace) = 2443ms
Thenicethingabout"systemctlmask"is,thatyoualwaysunmaskitvia"systemctlunmask"andenablethosedefault
services,whichyoureallyneed.
Havefunandhappyrebooting!
Anddon'tforgettoreboottwicetoletthereadaheadoptimizationkickin!
Filedunder:Fedora17,BootTime,Fedora,Laptop,Ubuntu,Boot,Systemd,Initramfs,Linux,NetworkManager,fedora
MacBookAir4,2
PostedbyhansvonatMay30,201204:21PM
Thanks,Imanagedtogofrom~12secondsto3.5sby:
removingtheinitrd
maskingfedora*storage*plymouth*.*lvm2monitor.*mdmonitor*
https://dl.dropbox.com/u/14500830/boot.png
Goodenoughformeandeverythingisstillloaded,includingselinux.
Maybetrytounderstandwhythekerneltakesonesecondtoload...butanyway...
Howtomask
PostedbyAmeenatJul25,201310:50AM
Excusemebuthowtomaskthings?
Imeanthecommandthatiswritten,wheredoIactuallyputit(inwhichfile)
I'mnewtothisstuff:)
SpeedUpBootEvenFurther.
PostedbyTohieatMay30,201211:00PM
Isuggestyoutakealookate4rat(http://e4rat.sourceforge.net/)itspeedsupbootmorethanreadahead.
www.harald-hoyer.de/personal/blog/fedora-17-boot-optimization-from-15-to-3-seconds
3/14
7/26/13
e4ratandsystemdreadahead
PostedbySolenskineratMay31,201208:35AM
IIRC,LennartPoetteringwantstoincludee4ratsfunctionalityintosystemdsreadahead,astheyhavealreadydone
forbtrfs.
e4rat
PostedbyAnonymousatJun15,201208:52AM
Doyousuccessinstallingandruninge4ratonfedora17?andhow?
e4ratonFedora17
PostedbySimoonB.atJul26,201208:41AM
Igote4rattocompileandrun.Theinfoyouneedisinhttp://sourceforge.net/apps/mantisbt/e4rat/view.php?
id=12
and
http://sourceforge.net/apps/mantisbt/e4rat/view.php?id=13
fedora17guide
PostedbyxiamxatNov28,201201:20PM
Iwroteafedora17guide
http://cgi.cs.mcgill.ca/[]/guideusinge4ratonfedora17.html
2001msboottime
PostedbyRammsdellatMay31,201208:35AM
Imanagedtogetanearlyflat2secondboottimerunningonapatriotpyroSSD
http://i.imgur.com/2h0GP.png
Question.
PostedbyDanielO.atMay31,201208:35AM
Idon'thave/etc/grub.conffile.HowcanImakeit?
grub.conf
PostedbyIvanProluginatMay31,201209:05AM
www.harald-hoyer.de/personal/blog/fedora-17-boot-optimization-from-15-to-3-seconds
4/14
7/26/13
PostedbyIvanProluginatMay31,201209:05AM
Maybeitislocatedat/boot/grub/grub.conf
grub
PostedbyHaraldHoyeratMay31,201209:11AM
it's/etc/grub2.cfg
grub
PostedbyNcolasatJun01,201202:10PM
Andwhataboutifyouedit/etc/default/grubinsteadtoadjusttheseparameters?
[root@x]#cat/etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Fedora"
GRUB_DEFAULT=saved
GRUB_CMDLINE_LINUX="rd.md=0rd.lvm=0rd.dm=0LANG=pt_BR.UTF8quietSYSFONT=latarcyrheb
sun16rhgbrd.luks=0KEYTABLE=brabnt2"
Cheers
Weird
PostedbynixatJul25,201310:50AM
Editing/etc/grub2.cfgisnothecorrectway,becauseforeachkernelupdatethefileisautogenerated,so,the
correctisedit/etc/default/grub(actuallyfedora18box).
So,howIcantindicatetonouseinitrd?.
Thankyouharald.
nix\freenode#fedora
blame
PostedbyEduardoatJun01,201207:09AM
nice!justforcuriosity,couldyoupleasepostyour`systemdanalyzeblame`list?
OMG
PostedbyHouge_LangleyatJun01,201207:47AM
SoGreat
www.harald-hoyer.de/personal/blog/fedora-17-boot-optimization-from-15-to-3-seconds
5/14
7/26/13
Awordofwarning
PostedbyKreFiedlerChristiansenatJun01,201207:47AM
Becareful!OnceyouapplythisinFedora17,thekernelpackageswillnolongerupdateyourgrubconfiguration
automatically.
Seealsobughttps://bugzilla.redhat.com/show_bug.cgi?id=737370
Theydon'tdoitproperlyalready
PostedbySergioatJun01,201202:49PM
AfterakernelupdatethegeneratedGRUBmenuismessedupandweneedtorungrub2mkconfigmanually
anyway.
systemdanalyze
PostedbyEduaroMaesatJun01,201202:13PM
ItriedtochecktheboottimeinFedora16(x64),butyumdoesnotfindthesystemdanalyze.Perhapsbecauseitx64?
RE:systemdanalyze
PostedbyMarkatJun01,201204:15PM
systemdanalyzeisinthesystemdpackage,youshouldalreadyhaveit(lookfor/usr/bin/systemdanalyze)
bootingwithoutaninitramfsimg
PostedbyEnduratJun01,201210:59PM
Hi,Harald,
Gota
kernelpanicand
"pleasepassinit=option"
ifIpassroot=/dev/sdaXrootfstype=ext4
askernelargs.Anyideas?
/usrissda3
/bootissda1
/issda5
/homeissda2
Anyideas?
KindregardstoSchwerin
fromErzgebirge
www.harald-hoyer.de/personal/blog/fedora-17-boot-optimization-from-15-to-3-seconds
6/14
7/26/13
Endur
Youmustuseaninitrd
PostedbyColinGuthrieatJun06,201203:58PM
Ifyouhaveaseparate/usr,thenI'mafraidyouhavetouseaninitrd.Thisistheonlysupportedmethodofhavinga
separate/usrthesedays.
FedoraCrashed
PostedbyV.NarayananatSep12,201208:52AM
Hi
WhenItried...
Thetotalfedoracrashed...
systemctldefaultdidnotworkedandIamstrugglinghardtorecover
Thesearedangerouscommands...
Ithing,awarningshallhavetobegivenbeforepostingthesecommands
Iwanttoundosystemctlmask,Idonotknowhow
Yours
VN
bootingwithoutaninitramfsimg
PostedbyEnduratJun01,201211:00PM
Itseemsthattheerroroccursbecause
/usrisanownpartition...
/sbinissymlinkedto/usr/sbin
maybeitisn'tmountedatthistime...
bootingwithoutaninitramfsimg
PostedbyEnduratJun01,201211:00PM
MaybeIneed/dev/console?
Thefixis...
PostedbyEnduratJun02,201208:42PM
www.harald-hoyer.de/personal/blog/fedora-17-boot-optimization-from-15-to-3-seconds
7/14
7/26/13
PostedbyEnduratJun02,201208:42PM
..(forme)wastohave/usronsamepartitionasrootfs.
Disablinginitrd
PostedbyNickGatJun02,201211:29PM
I'mconfusedyouchangedgrubtobootthekerneldirectlyinsteadoftheinitrd.Youlaterusedracuttogenerateanew
initrdbutdon'tspecifythatyou'vereenableditingrub?
Couldyouexplainwhatitwasyoudid?Didyoureenabletheinitrdwithoutplymouthetcifso,couldyounotgetbacka
fewmoremsbykeepingitdisabled?
Whatarethecomplicationsofthat?
Disablinginitrd,ornot?
PostedbySimonB.atJul26,201208:44AM
LikeNickG,Iwouldalsolikesomemoredetailoninitrdornot.Whichissupposedlyfaster?
Also,whenIrunwithoutinitrdIthinkIgetext4fscktorunoneveryboot.Ihaveavaguememoryofreading
somewhere(PoetteringorHoyer?)acomplaintonfsckkickinginwhenrunningwithoutinitrd,Ikeepsearchingbut
findnoreferences(fromthisdecade).
Grub2configurationfileforinitrdless
PostedbyPeterSennaTschudinatJun04,201206:55AM
HeyHarold,
GreatArticle!ButGrub2isnotthateasytoconfigure.So,Imadeaconfigurationfileforittobeplacedat/etc/grub.dthat
createsentriesforbootingwithoutinitrd...Checkitat:
https://github.com/petersenna/Fedora17fastboot
NowitwillkeepworkingafterKernelupdate.:)
[]'s
Peter
Helpmeontimetakenfornetwork.
PostedbyanilatJun18,201207:48AM
Ihavemanagedtobringdownboottimeto10secondsfrom20seconds.
Istillhavethisasatopperandtaking2seconds.Whatcanbedone.
www.harald-hoyer.de/personal/blog/fedora-17-boot-optimization-from-15-to-3-seconds
8/14
7/26/13
Istillhavethisasatopperandtaking2seconds.Whatcanbedone.
Fromsystemdanalyzeblame
2528msnetwork.service
Grub2configuration
PostedbyGMatMar08,201308:19AM
Itrieddoingthatbutwasnotabledisableinitrd
nowcannotboot!!!
PostedbytonyatJun18,201207:48AM
Itypedsomecommandsdescribedhereandnownotonlydon'tbootfaster,evenDON'Tboot!!It'sfreeze(I'mwritingfrom
anotherpc)whilebootingandalwayshavetoforcephysicallyshutdown
helpmeplease!
Helpmereducetimetobringupnetwork.
PostedbyanilatJun18,201207:48AM
Onmymachine,briningnetworkuptakeaalongtime.
2528msnetwork.service(fromsystemdanalzeblame)Whatcanbedone.?
Re:Helpmereducetimetobringupnetwork.
PostedbyjjjatJun04,201310:46AM
Disablethenetwork.service,NetworkManagertakescareofthenetworkanyway.
Smart...
PostedbyJamedatJun27,201209:18AM
Youguys/girlsarereallysmart,IjustwantedtodualbootwithFedoratousesomethingfasterandsmootherthanwindows
7,thanIclickedthisingoogletotryandincreasemyspeedasIdowitheveryOS,thislooksincrediblycomplicatedright
now!Butthanksanyway,I'mpositiveIcanlearnit(:
Awesome.
PostedbyChadatSep12,201208:52AM
Hey,thisguideisgreat.Ididn'tdisablealltheserviceslisted.IlikehavingBlutoothandafirewallbutIdidmanageto
shave43%offmystartuptime.Bootisnow3.8secondsandthecomputergoesfrompowerbuttontobrowserinless
than13seconds.
Iknowthisisn'tanoptioneveryonewilllike,butinsteadofmessingwithgrub2/initramfs,Iinstalledextlinux/disabled
www.harald-hoyer.de/personal/blog/fedora-17-boot-optimization-from-15-to-3-seconds
9/14
7/26/13
Iknowthisisn'tanoptioneveryonewilllike,butinsteadofmessingwithgrub2/initramfs,Iinstalledextlinux/disabled
initramfs.Somucheasier,andIbelievefaster.
Help.
PostedbyMitUotatSep12,201208:53AM
howtorestorethestatebeforeexecutingtwocommands.....
Thistimeisalittlebitmisleading.Althoughitseemsfaster,therealtimeuntiltheloginscreenisdisplayedistaking
longer.Soafaircomparisonwouldinvolveastopwatch.
$sudodracutf
Ofcourse,thiscanbeoptimzedalso,whenwebuildtheinitramfswithoutplymouthandinhostonlymode.
$sudodracutfHoplymouth
Thanks!
PostedbyNeilatSep14,201201:03PM
Foundthisveryveryuseful,thankyou!!
DualBootingFedora17&WinXP
PostedbyOnkaramurthyatNov21,201204:56PM
PleaseanyonegivemesimplestepstomakeXPbootfirstandFedorasecond
RAIDinlaptop
Postedbypr@xatNov28,201201:20PM
HiIhaveasamsung830ssdrunninginRAIDmodesincemylaptophpdv7t7000doesntallowahcimode.Pleaselet
meknowwhichservicesarerequiredforthat.
953msudevsettle.service
638msNetworkManager.service
536mssystemdlogind.service
481msjexec.service
459mschronyd.service
379mslm_sensors.service
338msiptables.service
311msauditd.service
309msdbus.service
298msmcelog.service
297msakmods.service
234msirqbalance.service
221mssystemdusersessions.service
208mssystemdreadaheadreplay.service
202mssmclient.service
www.harald-hoyer.de/personal/blog/fedora-17-boot-optimization-from-15-to-3-seconds
10/14
7/26/13
202mssmclient.service
183mssystemdreadaheadcollect.service
148msfedorareadonly.service
148msmedia.mount
141msudevtrigger.service
112msdevhugepages.mount
99mssendmail.service
93msfedoraloadmodules.service
83msdevmqueue.mount
69msfedorastorageinit.service
67msfedorastorageinitlate.service
66mssystemdsysctl.service
66msfedorawaitstorage.service
63mssyskerneldebug.mount
61mssystemdtmpfilessetup.service
59mssystemdremountfs.service
58mssyskernelconfig.mount
53mslvm2monitor.service
46mssystemdvconsolesetup.service
42msudisks2.service
38mstmp.mount
34mscolordsane.service
25msudev.service
21mscolord.service
21msbluetooth.service
20msprocsysfsbinfmt_misc.mount
14msaccountsdaemon.service
13msupower.service
6msrtkitdaemon.service
5mssysfsfuseconnections.mount
Incredulous
PostedbyvirtualeyesatMar08,201308:18AM
Howonearthdoyougettheseboottimes??
Ihaveappliedmostoftheabovesuggestionsandstillget@13secondspowerbuttontologin.
Machineisabeast(DellM47003840QM16GB)comparedtotheoneyouhavelistedhere.
Mustbemissingsomething:
systemdanalyze
Startupfinishedin2905ms(kernel)+4964ms(initrd)+5305ms(userspace)
Thanks!!!
PostedbyGabrielatMar08,201308:29AM
Startupfinishedin831ms(kernel)+1729ms(userspace)=2561ms
Thanksdude!Urgreat!]
www.harald-hoyer.de/personal/blog/fedora-17-boot-optimization-from-15-to-3-seconds
11/14
7/26/13
Thanksdude!Urgreat!]
50%decreaseinboottime
Postedbyphanindrafedora18atMar08,201308:29AM
Thanks,Idecreasedtheboottimefrom32secondsto16seconds,i'mnotsureaboutmanyotheractiveserviceslike
iprinit.serviceiprupdate.servicesystemdvconsolesetup.servicesystemdremountfs.servicesystemdbinfmt.service
systemdudevtrigger.servicesystemdmodulesload.servicesoIhaventtouchedthem,canIdisablethemtoo?
Gonzalez
PostedbyGermanatMar08,201308:30AM
Sick!!welldone!I'llplaywithit.:)
you'retheman.
Fedora18
PostedbytesteratMar08,201308:30AM
NowthatFedora18isoutpleaseupdatethearticleforthesameasfewcommandsandserviceshavechanged.tx
maskvsdisable
PostedbyAnonymouseatMar08,201308:30AM
Whatisthereasonforchoosingmaskoverdisableforsystemctl?Afaicusystemdissupposedtotakecareofall
dependenciesitselfsodisableshouldbethesafewaytogo,allowingforsystemdtostillstartanunitifotherrequired
unitsabsolutelydependonit(whilemaskavoidstartinganuniteveninthatcase).AmIwrong?
Really???
PostedbyBillatMar08,201308:31AM
SoyouarewillingtoturnoffSELinux,fulldiscencryption,andremoteloggingservicestosaveafewsecondsbooting?
Whynotjustsettheallyourpasswordsto""andsetautologinasroottosaveallthetimeaswell?
Whilethisdoesseemlikeafunexperiment,theideaofthrowingoutfundamentalsecurityfeaturesseemsmisguided.
re:Acceptance
PostedbyvirtualeyesatApr05,201307:51AM
Ihavehitmylimit,justover5seconds)
Willjusthavetoacceptfeelingenviousofthosewhoareachievingsub3secondboottimes,prettyunrealO_o
www.harald-hoyer.de/personal/blog/fedora-17-boot-optimization-from-15-to-3-seconds
12/14
7/26/13
FWIW,dracuthostonlyvs.noinitramfsarenearlyequal,thelatterfasterbyabout1second.
Isuspectseveralpartitionmountpointsareslowingthingsdownabitforme.
andthentherealizationthatit'sallnonesenseasItendtorebootonceevery2or3weeks...
failedtodisableinitramfs
PostedbyKiranatApr20,201310:54AM
HI,
itrieddisablinginitramfslikefrom/boot/grub2/grub.cfgfileanditsmashedmysystem.
dididoanythingwrong?
ifimessup..
PostedbybabatApr22,201308:24AM
Ifimessup..isthereanywaytorevert(iefireuptheservicesonthenextboot?)
Fedora18
PostedbycavemanatJun03,201310:45AM
DoyouhaveanythingforFedora18?
Suggestion
PostedbyAngelatJul25,201310:49AM
Agoodideatosaveevenmoretimeistodoanautologinthroughconsole,oratleastmakestartxbeexecutedwhen
logininatty.
Addcomment
Youcanaddacommentbyfillingouttheformbelow.Plaintextformatting.
Name(Required)
Pleaseenteryourname.
Subject(Required)
Comment(Required)
www.harald-hoyer.de/personal/blog/fedora-17-boot-optimization-from-15-to-3-seconds
13/14
7/26/13
Enterthewordbelow(Required)
www.harald-hoyer.de/personal/blog/fedora-17-boot-optimization-from-15-to-3-seconds
14/14