From Omnia
Jump to navigation Jump to search


GRUB is the GNU GRand Unified Bootloader.

Note: "GRUB 2 has replaced what was formerly known as GRUB (i.e. version 0.9x), which has, in turn, become GRUB Legacy." [1]

"GRUB has the advantage of being able to read ext2 and ext3 partitions and load its configuration file — /boot/grub/grub.conf — at boot time." [2]

Create Grub conf:

touch /boot/grub/menu.lst
ln -s menu.lst /boot/grub/grub.conf

Boot with GRUB article.

Dual and Multi Booting FreeBSD, Linux, and OpenBSD article.

"You can also have GRUB save the last loaded system as the default for the next boot. Change the "default=0" line to "default=saved" and add the "savedefault" command (no arguments) as the last command in each title section. When you switch to the savedefault mode, the first title section will be the default on the first boot. GRUB saves the current selection just before initiating the boot sequence. By using the savedefault command in two or more title sections and leaving it out of one or more title sections you could create a menu that would allow the default to switch between some systems but never be set for others."



title Debian 2.4.27-2-386
        root (hd0,1)
        kernel /vmlinuz-2.4.27-2-386 ro root=/dev/hda1
        initrd /initrd.img-2.4.27-2-386
title Red Hat Linux (2.4.7-10)
        root (hd0,4)
        kernel /boot/vmlinuz-2.4.7-10 ro root=/dev/hda5
        initrd /boot/initrd-2.4.7-10.img
title OpenBSD 3.0
        root (hd0,0)
        chainloader +1

GRUB: Boot another OS once article.

Set Default Boot


#GRUB_DEFAULT="Ubuntu, with Linux 4.15.0-43-generic"
GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 4.15.0-43-generic"


Warning you get, if you don't specify full title name

root:~# update-grub
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.15.0-162-generic
Found initrd image: /boot/initrd.img-4.15.0-162-generic
Found linux image: /boot/vmlinuz-4.15.0-43-generic
Found initrd image: /boot/initrd.img-4.15.0-43-generic
Warning: Please don't use old title `Ubuntu, with Linux 4.15.0-43-generic' for GRUB_DEFAULT, use `Advanced options for Ubuntu>Ubuntu, with Linux 4.15.0-43-generic' (for versions before 2.00) or `gnulinux-advanced-eef09c13-9460-4e5f-85c1-92c49ca9fd08>gnulinux-4.15.0-43-generic-advanced-eef09c13-9460-4e5f-85c1-92c49ca9fd08' (for 2.00 or later)

ref: [3]

Dual Boot - Remember Last Choice

dual boot - How to get grub2 to remember last choice? - Ask Ubuntu -




then run:

sudo update-grub

GRUB: savedefault results in "Error 15: File not found"

GRUB: savedefault results in "Error 15: File not found"

"Adding savedefault to boot command in grub results in boot error "file not found". (and hence the boot default is not saved for next boot)

It seems that /boot/grub/default is not created at install and GRUB seems unable to create it.

I have solved this on my box by calling "grub-set-default 0" once."

Install Grub

Install grub

# grub
> root (hd0,1)
> setup (hd0)
> quit

Note: (hd0,1) would be the second partition. If boot is the first then it would be (hd0,0).

Restore/Repair GRUB MBR

All about Linux: How to Repair a Corrupt MBR and boot into Linux To install GRUB boot loader on to your MBR:

grub-install /dev/hda
mount /dev/hda1 /mnt
sudo grub-install --no-floppy --root-directory=/mnt /dev/sda
# --no-floppy - (optional) just says to not probe floppy drives too

Boot to Single User (Maintenance) Mode

See Linux#Boot to Single User (Maintenance) Mode

Changing Runlevels at Boot Time

Changing Runlevels at Boot Time:

  • When the GRUB menu bypass screen appears at boot time, press any key to enter the GRUB menu (within the first three seconds).
  • Press the a key to append to the kernel command.
  • Add <space><runlevel> at the end of the boot options line to boot to the desired runlevel. For example, the following entry would initiate a boot process into runlevel 3:
grub append> ro root=/dev/VolGroup00/LogVol00 rhgb quiet 3

Source: 9.8. Changing Runlevels at Boot Time

Boot Timeout

Infinite timeout:

# timeout=0

Instant timeout:



ibm example

# grub.conf generated by anaconda
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You do not have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (hd0,5)
#          kernel /boot/vmlinuz-version ro root=/dev/sda6
#          initrd /boot/initrd-version.img
password --md5 $1$RW1VW/$4XGAklxB7/GJk0uO47Srx1
title Upgrade to Fedora 11 (Leonidas)
	kernel /boot/upgrade/vmlinuz preupgrade \ 
      repo=hd::/var/cache/yum/preupgrade stage2=\
      hd:UUID=8b4c62e7-2022-4288-8995-5eda92cd149b:/boot/upgrade/install.img \
	initrd /boot/upgrade/initrd.img
title Fedora (
	root (hd0,5)
	kernel /boot/vmlinuz- ro root=LABEL=FEDORA8 rhgb quiet
	initrd /boot/initrd-
title Fedora (
	root (hd0,5)
	kernel /boot/vmlinuz- ro root=LABEL=FEDORA8 rhgb quiet
	initrd /boot/initrd-
title GRUB Menu
	rootnoverify (hd0,1)
	chainloader +1
title Windows
	rootnoverify (hd0,0)
	chainloader +1

Source: Learn Linux, 101: Boot managers -