GRUB: Difference between revisions
(2 intermediate revisions by the same user not shown) | |||
Line 52: | Line 52: | ||
Ubuntu: | Ubuntu: | ||
/etc/default/grub | /etc/default/grub | ||
# GRUB_DEFAULT=0 | |||
GRUB_DEFAULT=saved | GRUB_DEFAULT=saved | ||
GRUB_SAVEDEFAULT=true | GRUB_SAVEDEFAULT=true | ||
note the GRUB_SAVEDEFAULT line needs to be added | |||
then run: | |||
sudo update-grub | |||
== Longer Boot Menu Choice == | |||
/etc/default/grub | |||
# GRUB_TIMEOUT=0 | |||
GRUB_TIMEOUT=60 | |||
then run: | then run: |
Latest revision as of 18:48, 25 October 2024
Summary
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."
Example:
default=0 timeout=10 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
default=saved timeout=10 #splashimage=(hd0,4)/boot/grub/splash.xpm.gz 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 savedefault title OpenBSD 3.0 root (hd0,0) makeactive chainloader +1 savedefault
GRUB: Boot another OS once article.
Dual Boot - Remember Last Choice
dual boot - How to get grub2 to remember last choice? - Ask Ubuntu - http://askubuntu.com/questions/148662/how-to-get-grub2-to-remember-last-choice
Ubuntu:
/etc/default/grub
# GRUB_DEFAULT=0 GRUB_DEFAULT=saved GRUB_SAVEDEFAULT=true
note the GRUB_SAVEDEFAULT line needs to be added
then run:
sudo update-grub
Longer Boot Menu Choice
/etc/default/grub
# GRUB_TIMEOUT=0 GRUB_TIMEOUT=60
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 or... timeout=-1
Instant timeout:
timeout=0
Samples
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 #boot=/dev/sda6 default=1 timeout=10 splashimage=(hd0,5)/boot/grub/splash.xpm.gz #hiddenmenu 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 \ ks=hd:UUID=8b4c62e7-2022-4288-8995-5eda92cd149b:/boot/upgrade/ks.cfg initrd /boot/upgrade/initrd.img title Fedora (2.6.26.8-57.fc8) root (hd0,5) kernel /boot/vmlinuz-2.6.26.8-57.fc8 ro root=LABEL=FEDORA8 rhgb quiet initrd /boot/initrd-2.6.26.8-57.fc8.img title Fedora (2.6.26.6-49.fc8) root (hd0,5) kernel /boot/vmlinuz-2.6.26.6-49.fc8 ro root=LABEL=FEDORA8 rhgb quiet initrd /boot/initrd-2.6.26.6-49.fc8.img title GRUB Menu rootnoverify (hd0,1) chainloader +1 title Windows rootnoverify (hd0,0) chainloader +1
Source: Learn Linux, 101: Boot managers - http://www.ibm.com/developerworks/library/l-lpic1-v3-102-2/index.html