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
Code: Select all
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
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
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
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 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 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 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.