Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by smurphos »

The issue

By default Mint does not show the grub screen on boot, but silently waits for 10 seconds on each boot in case the user wants to invoke the grub menu using the standard keyboard shortcut (left-shift on most machines - sometimes escape). On fast systems and/or systems with SSD boot drives this 10 seconds can easily exceed 50% of the total boot time.

The culprit is Mint's defaults for /etc/default/grub which includes either one of these sets of lines. Both have the same effect. The first is Grub2 current recommended syntax, the 2nd is deprecated syntax albeit it still works.

Code: Select all

GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
or

Code: Select all

GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
The quick and easy fix

I think it's a good idea to have a visible grub menu on boot. It doesn't need to be shown for long, just long enough for a user to press an arrow key should they need to interact with it to boot from an alternative kernel or access recovery / memory testing. I think 2 seconds is fine. Pressing an arrow key will extend the time-out indefinitely if needed. Or the user can quickly tap enter to progress the boot process once grub is displayed and save even more boot time.

Run sudo nano /etc/default/grub to open the file in a root text editor.

Edit the lines listed above to read

Code: Select all

GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=2
Press Ctrl-O and enter to save the edits and Ctrl-X to exit the editor

Run sudo update-grub

Reboot - Done.

Some empirical results

I've used a stopwatch to record the total time from pressing the laptops power button from a cold start to reaching the login-screen. During the process I've noted the approx times the grub menu and splash screen were displayed during the process. After each boot I've run systemd-analyze blame to check the kernel and userspace loading times. This change will not affect the output of this command unless you have a UEFI boot system in which case you will see loader time reduced. The variations in my results are natural variation.

Optimising kernel and userspace loading time, which may be a useful exercise in some circumstances, is outside of the scope of this article which focuses on the quick win.

The test system

6 year old laptop with 2nd generation intel, 6GB RAM and a 250GB SATA SSD as the boot drive on Cinnamon 19

Code: Select all

System:    Host: steve-HP-Pavilion-g6-Notebook-PC Kernel: 4.15.0-38-generic x86_64
           bits: 64 gcc: 7.3.0
           Desktop: Cinnamon 3.8.9 (Gtk 3.22.30-1ubuntu1)
           Distro: Linux Mint 19 Tara
Machine:   Device: laptop System: Hewlett-Packard product: HP Pavilion g6 Notebook PC v: 0690120000204710000620100 serial: N/A
           Mobo: Hewlett-Packard model: 166F v: 09.4C serial: N/A
           BIOS: Insyde v: F.66 date: 01/24/2013
Battery    BAT0: charge: 30.8 Wh 100.0% condition: 30.8/30.8 Wh (100%)
           model: Hewlett-Packard Primary status: Full
CPU:       Dual core Intel Core i5-2430M (-MT-MCP-) 
           arch: Sandy Bridge rev.7 cache: 3072 KB
           flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 9578
           clock speeds: max: 3000 MHz 1: 1403 MHz 2: 939 MHz 3: 1155 MHz
           4: 1316 MHz
Graphics:  Card: Intel 2nd Generation Core Integrated Graphics Controller
           bus-ID: 00:02.0
           Display Server: x11 (X.Org 1.19.6 )
           drivers: modesetting (unloaded: fbdev,vesa)
           Resolution: 1366x768@60.03hz
           OpenGL: renderer: Mesa DRI Intel Sandybridge Mobile
           version: 3.3 Mesa 18.0.5 Direct Render: Yes
Audio:     Card Intel 6 Series/C200 Series Family High Def. Audio Controller
           driver: snd_hda_intel bus-ID: 00:1b.0
           Sound: Advanced Linux Sound Architecture v: k4.15.0-38-generic
Network:   Card-1: Ralink RT5390 Wireless 802.11n 1T/1R PCIe
           driver: rt2800pci v: 2.3.0 bus-ID: 01:00.0
           IF: wlp1s0 state: up mac: <filter>
           Card-2: Realtek RTL8101/2/6E PCIE Fast/Gigabit Ethernet controller
           driver: r8169 v: 2.3LK-NAPI port: 3000 bus-ID: 02:00.0
           IF: eno1 state: up speed: 100 Mbps duplex: full mac: <filter>
Drives:    HDD Total Size: 2000.4GB (42.6% used)
           ID-1: /dev/sda model: CT250MX500SSD1 size: 250.1GB
           ID-2: USB /dev/sdb model: Expansion size: 1000.2GB
           ID-3: USB /dev/sdc model: N/A size: 750.2GB
Partition: ID-1: / size: 37G used: 18G (50%) fs: ext4 dev: /dev/sda1
           ID-2: /home size: 183G used: 116G (67%) fs: ext4 dev: /dev/sda5
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 64.0C mobo: N/A
           Fan Speeds (in rpm): cpu: N/A
Info:      Processes: 243 Uptime: 20 min Memory: 3143.8/5908.1MB
           Init: systemd runlevel: 5 Gcc sys: 7.3.0
           Client: Shell (bash 4.4.191) inxi: 2.3.56 
Test 1 - Mint's default

Code: Select all

GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10

Code: Select all

Startup finished in 7.920s (kernel) + 8.393s (userspace) = 16.314s
graphical.target reached after 8.364s in userspace
Time to splash screen circa 24 seconds.
Time to login screen 34.42 seconds

Test 2 - Visible grub, 10 second timeout, no interaction with grub menu

Code: Select all

GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=10

Code: Select all

Startup finished in 8.012s (kernel) + 8.517s (userspace) = 16.530s
graphical.target reached after 8.446s in userspace
Time to grub screen circa 5 seconds.
Time to splash screen circa 24 seconds.
Time to login screen 34.93 seconds

Test 3 - My recommendation, visible grub, 2 second timeout, no interaction with the grub menu

Code: Select all

GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=2

Code: Select all

Startup finished in 7.151s (kernel) + 8.465s (userspace) = 15.616s
graphical.target reached after 8.436s in userspace
Time to grub screen circa 5 seconds.
Time to splash screen circa 16 seconds.
Time to login screen 25.93 seconds.

Success - On my machine I've achieved a 25% reduction in boot time with one 30 second edit of a system file and a quick update-grub. Plus I have the convenience of easy access to the grub menu should I every need it.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by smurphos »

trytip wrote:
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
all41
Level 19
Level 19
Posts: 9498
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by all41 »

+1 smurphos
You can also set grub timeout = 0.1
In this case you will not see a grub screen at all but you can still force the grub screen
by holding the Shift key after the oem splash
Everything in life was difficult before it became easy.
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by smurphos »

Cheers All41 - I like the crutch of a visible grub and you can always tap enter to skip the 2 seconds. Plus i don't get an OEM splash screen on my machine - just a 1 second Press Esc for Boot options or F12 to enter BIOS message at the bottom of the screen - easy to mistime getting into Grub with a short timeout. I don't know how common that is.

Plus it's handy for troubleshooting other areas of boot. E.g if you are waiting for 10 seconds + for grub to show you know you need to delve into your BIOS settings for the solution. If its a long delay between grub and login-screen systemd-analyze, dmesg & journalctl are your friends. Post login delays it will be your Desktop Environments logging system, ~/.xsession-errors and journalctl.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
all41
Level 19
Level 19
Posts: 9498
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by all41 »

smurphos wrote: Sun Nov 04, 2018 2:47 am
Post login delays it will be your Desktop Environments logging system, ~/.xsession-errors and journalctl.
I need to learn more about this--my workstation bios is painful
Everything in life was difficult before it became easy.
User avatar
all41
Level 19
Level 19
Posts: 9498
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by all41 »

At grub screen I press enter-- and get a full mint desktop in 15 seconds here.
This Lenovo workstation bios is painfully slow though--add another 20 seconds to the
reboot cycle
Everything in life was difficult before it became easy.
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by smurphos »

all41 wrote: Sun Nov 04, 2018 3:37 am At grub screen I press enter-- and get a full mint desktop in 15 seconds here.
This Lenovo workstation bios is painfully slow though--add another 20 seconds to the
reboot cycle
That seems pretty good. Auto login? Might be worth disabling it temporarily for a quick check if the time is between grub and lightdm or lightdm and your desktop session or both.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
kukamuumuka

Re: Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by kukamuumuka »

In Mint 19 has a lot of unnecessary services on startup. I would remove at least:

Code: Select all

sudo systemctl disable ModemManager.service

sudo systemctl disable NetworkManager-wait-online.service

sudo systemctl disable avahi-daemon
User avatar
all41
Level 19
Level 19
Posts: 9498
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by all41 »

administrollaattori wrote: Sun Nov 04, 2018 4:07 am In Mint 19 has a lot of unnecessary services on startup. I would remove at least:

Code: Select all

sudo systemctl disable ModemManager.service

sudo systemctl disable NetworkManager-wait-online.service

sudo systemctl disable avahi-daemon
Hello sir,
Do these settings survive reboot?
Everything in life was difficult before it became easy.
kukamuumuka

Re: Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by kukamuumuka »

all41 wrote: Sun Nov 04, 2018 4:12 am Do these settings survive reboot?
I have removed those and many more, and still computer is working. :wink:
User avatar
all41
Level 19
Level 19
Posts: 9498
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by all41 »

smurphos wrote: Sun Nov 04, 2018 3:46 am
all41 wrote: Sun Nov 04, 2018 3:37 am At grub screen I press enter-- and get a full mint desktop in 15 seconds here.
This Lenovo workstation bios is painfully slow though--add another 20 seconds to the
reboot cycle
That seems pretty good. Auto login? Might be worth disabling it temporarily for a quick check if the time is between grub and lightdm or lightdm and your desktop session or both.
$ systemd-analyze
Startup finished in 5.514s (kernel) + 2.499s (userspace) = 8.013s
graphical.target reached after 2.493s in userspace
Can't explain the other 7 seconds though
Everything in life was difficult before it became easy.
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by smurphos »

administrollaattori wrote: Sun Nov 04, 2018 4:15 am
all41 wrote: Sun Nov 04, 2018 4:12 am Do these settings survive reboot?
I have removed those and many more, and still computer is working. :wink:
I think a separate tutorial on optimising kernel loading by disabling services would be a good idea. I'm not the person to write that one, I leave them be. I do think such a tutorial should be clear on what the candidate services actually does / doesn't do.

E.g. does anyone know if NetworkManager-wait-online.service is used for the timing of mounting network mounts in fstab?
Last edited by smurphos on Sun Nov 04, 2018 4:27 am, edited 1 time in total.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by smurphos »

all41 wrote: Sun Nov 04, 2018 4:18 am Can't explain the other 7 seconds though
That will be the desktop environment loading - not counted by systemd-analyze.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
all41
Level 19
Level 19
Posts: 9498
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by all41 »

smurphos wrote: Sun Nov 04, 2018 4:22 am
administrollaattori wrote: Sun Nov 04, 2018 4:15 am
all41 wrote: Sun Nov 04, 2018 4:12 am Do these settings survive reboot?
I have removed those and many more, and still computer is working. :wink:
I think a separate tutorial on optimising kernel loading by disabling services would be a good idea. I'm not the person to write that one, I leave them be. I do think such a tutorial should be clear on what the candidate services actually does / doesn't do.

E.g. does anyone know if NetworkManager-wait-online.service is used for the timing of mounting network mounts in fstab?
I think a separate tutorial on optimising kernel loading by disabling services would be a good idea.

#########################
I double down on this idea---double kudos
Everything in life was difficult before it became easy.
User avatar
thx-1138
Level 8
Level 8
Posts: 2092
Joined: Fri Mar 10, 2017 12:15 pm
Location: Athens, Greece

Re: Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by thx-1138 »

smurphos wrote: Sun Nov 04, 2018 4:22 am E.g. does anyone know if NetworkManager-wait-online.service is used for the timing of mounting network mounts in fstab?
...very good question, and the (semi-complicated) answer under network-online.target:
https://www.freedesktop.org/wiki/Softwa ... orkTarget/

...side-note about avahi above:
both Samba / filesharing with windows & also auto-discovery of quite a few of wireless printers 'depend' on it.

And that's exactly the reason why i don't like the 'blind' advice, especially to inexperienced people,
of killing a bunch of services at one single shot. Different people, different needs...
Plus, an explanation of what will not function afterwards should always be clarified
(shoot first ask questions later? what's that...Dirty Harry)? :lol:
User avatar
all41
Level 19
Level 19
Posts: 9498
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by all41 »

thx-1138 wrote: Sun Nov 04, 2018 4:43 am
smurphos wrote: Sun Nov 04, 2018 4:22 am E.g. does anyone know if NetworkManager-wait-online.service is used for the timing of mounting network mounts in fstab?
...very good question, and the (semi-complicated) answer under network-online.target:
https://www.freedesktop.org/wiki/Softwa ... orkTarget/

...side-note about avahi above:
both Samba / filesharing with windows & also auto-discovery of quite a few of wireless printers 'depend' on it.

And that's exactly the reason why i don't like the 'blind' advice, especially to inexperienced people,
of killing a bunch of services at one single shot. Different people, different needs...
Plus, an explanation of what will not function afterwards should always be clarified
(shoot first ask questions later? what's that...Dirty Harry)? :lol:
+1 also. There is good logic behind this reasoning
Everything in life was difficult before it became easy.
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by smurphos »

thx-1138 wrote: Sun Nov 04, 2018 4:43 am
smurphos wrote: Sun Nov 04, 2018 4:22 am E.g. does anyone know if NetworkManager-wait-online.service is used for the timing of mounting network mounts in fstab?
...very good question, and the (semi-complicated) answer under network-online.target:
https://www.freedesktop.org/wiki/Softwa ... orkTarget/
Thanks, as I suspected disabling the service will break mounting network drives from fstab - now that would have had me seriously scratching my head when I was a newbie..
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
gm10

Re: Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by gm10 »

all41 wrote: Sun Nov 04, 2018 1:26 am You can also set grub timeout = 0.1
In this case you will not see a grub screen at all but you can still force the grub screen
by holding the Shift key after the oem splash
Just set it to 0. Those 0.1 seconds of extra sleep don't make a difference, just be holding the shift key down before GRUB loads, as you said, and the menu will come up, you only need the timeout for when you want to press shift later. I always set it to 0.
User avatar
thx-1138
Level 8
Level 8
Posts: 2092
Joined: Fri Mar 10, 2017 12:15 pm
Location: Athens, Greece

Re: Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by thx-1138 »

...what frequently surprises me (not being an advanced user myself by any means),
is just how 'flexible' systemd actually is / can be for those who understand / have read in depth how it works.
For example, an alternative way, Restart.
It does have a very strict (yet well-defined) logic for starters though (one more extra reason for someone to not mess around...),
and it's documentation isn't exactly the friendlier one around, well, to me at least... :|

gm10: have a look at this.
Check the links to the bugreports in a past thread here as well...viewtopic.php?t=270727
gm10

Re: Mint 18.3 / Mint 19 - reduce your boot time by 8-10 seconds in 30 seconds.

Post by gm10 »

thx-1138 wrote: Sun Nov 04, 2018 5:58 am gm10: have a look at this.
Check the links to the bugreports in a past thread here as well...viewtopic.php?t=270727
I don't believe those apply, they are for cases where people are pressing the key rather than holding it down (the forum link) or for cases where a broken UEFI doesn't register modifier keys (the debian link, although I'm not convinced that was a legit explanation given there). Either way, you won't time a key press into 0.1 seconds of sleep, so if you are having those issues best leave it at 10 seconds.
Post Reply

Return to “Tutorials”