Skip to content

Configuring the Grub2 boot loader

I had to use Linux for work the last few days, and my previous installation was completely outdated so I reinstalled from scratch, switching distribution in the process (from OpenSUSE to Kubuntu).
Part of the fun in installing Linux on a computer where I still want to mainly use Windows is configuring the bootloader. Apparently, it’s 2017 yet it still has to be done 100% via manually editing configuration files.

The file you want to edit is /etc/default/grub, so:

sudo nano /etc/default/grub

Then the interesting things to change are among those lines:
GRUB_DEFAULT=4 : boot the 5th item in the list (numbering starts at 0, so 5th item is 4, not 5)
GRUB_DEFAULT="Windows 7 (loader)" : boot the item named “Windows 7 (loader)”. NB: for me, for some reason it didn’t work
GRUB_DEFAULT=saved : boot the last operating system you chose (requires to also set GRUB_SAVEDEFAULT=true). NB: for me, the saving failed for some reason so it always loaded the first item :/
GRUB_CMDLINE_LINUX_DEFAULT="" : show console log output when starting up, instead of the static splashscreen (which is the default "quiet splash") (link

After you’ve saved your modifications, you have to run sudo update-grub to apply them, as /etc/default/grub isn’t directly used by Grub but it used to automatically generate Grub’s configuration files (which is /boot/grub/grub.cfg and shouldn’t be manually modified)

More details there:

Bonus 1 my /etc/default/grub file

#GRUB_DEFAULT="Windows 7 (on /dev/sdb1)"
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

Bonus 2: if you happen to have damaged RAM, you can use Grub to enable BadRAM filtering. Not sure how this works exactly, but the setting is called GRUB_BADRAM

Bonus 3: since you’re here, I assume you’re dual booting. Maybe you’re having an issue with Windows and Linux both messing up your system date. Long story short, run "timedatectl set-local-rtc 1" to make Linux store local time instead of UTC in the hardware clock (well at least that’s how it is for Ubuntu). More details:

Posted in Linux.

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

or, reply to this post via trackback.

Sorry about the CAPTCHA that requires JS. If you really don't want to enable JS and still want to comment, you can send me your comment via e-mail and I'll post it for you.

Please solve the CAPTCHA below in order to fight spamWordPress CAPTCHA