Grub Bootloader
Table of Contents
- Word of advise
- Hide or edit timer on GRUB bootloader
- Boot to last-used OS
- Rename OS menuentry
- Boot to OS using GRUB shell
Word of advise
- Always, always create backup of config file.
- Make sure you have bootable usb drive to fix if anything goes wrong.
To create backup of original setting file, run:
cp /etc/default/grub /etc/default/grub.orig
Hide or edit timer on GRUB bootloader
- Edit
/etc/default/grubto these settingGRUB_TIMEOUT=0 # Change the number (in seconds) to shorten or prolong grub screen. - Then update grub bootloader
sudo update-grub
Boot to last-used OS
- Edit
/etc/default/grubto these settingGRUB_DEFAULT=saved GRUB_SAVEDEFAULT=true - Then update grub bootloader
sudo update-grub
Rename OS menuentry
Either way is fine, it depends on one’s preference actually.
However, do note that changing these setting will prevent grub to update kernel.
If you want to update kernel, just give the file its execution right and run sudo update-grub.
Easy way
- Edit file
/boot/grub/grub.cfgmenuentry "Something" { set root=(hdX,Y) -- boot parameters -- } - Change that
Somethingto your desired name. - Do not run
sudo update-grub. Otherwisegrub.cfgwill be regenerated togrub-scriptsetting.
A bit complicated way
- Open file
/boot/grub/grub.cfgand look for these headers.### BEGIN /etc/grub.d/10_linux ### *** *** ### BEGIN /etc/grub.d/30_os-prober ### *** *** - Copy your desired menuentry and paste-append it to
/etc/grub.d/40_custom.
Thegrub mansays to be sure to not leave empty line at the end of file. I haven’t tried it, so I don’t know what happen if we ignore the warning. - Then revoke executable right for these files.
/etc/grub.d/10_linux /etc/grub.d/30_os-prober - And lastly, update grub to make changes.
sudo update-grub
Boot to OS using GRUB shell
- Identify
/bootpartitiongrub> ls # expected output # (hd0) (hd0,1) (hd0,2) ... - Adapt to these commands to boot to OS
grub> set root=(hd0,1) grub> linux /boot/vmlinuz root=/dev/sda1 grub> initrd /initrd.img grub> boot