Grub boot kernel only once vs Lilo -R

People which started to use Linux in the `90 probably miss nowdays Lilo. Grub is now installed by default on every linux distro. However Grub is not that bad at all its only hard to get use to it in the begining.

I came accross one problem, trying to test vanila kernel which i compiled, however i did not know how to make grub to boot my kernel only once for a test (good old lilo -R new-kernel) command.

I started to search on google and i have found this:

booting-only-once
This seems to be quite old method because you would run into this problem:

root@boss [~]# grub-set-default 1
-bash: grub-set-default: command not found
root@boss [~]#
As you can see there is NO such command grub-set-default. I tought, okey maybe there are some additional rpm packages for grub which will replace this missing command, but i was not able to find ANYTHING!

After looking for grub`s tutorial i have came accross one nice command:

savedefault –default=X –once

This is the right command which replaces lilo -R or grub-set-default!

Now here is working example:

my /etc/grub.conf:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/hdc
default=0
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu

title Fedora Core (VZ)
root (hd0,0)
kernel /vmlinuz-2.6.18-8.1.4.el5.028stab035.1 ro root=/dev/VolGroup00/LogVol00 rhgb
initrd /initrd-2.6.18-8.1.4.el5.028stab035.1.img

title Fedora Core (2.6.17-1.2187_FC5)
root (hd0,0)
kernel /vmlinuz-2.6.17-1.2187_FC5 ro root=/dev/VolGroup00/LogVol00 rhgb
initrd /initrd-2.6.17-1.2187_FC5.img

As you can see by my config file, the "VZ" kernel is default and it will be booted first.

The second kernel is "2.6.17-1.2187_FC5" - which is old FC5 kernel.

For test i want to boot "2.6.17-1.2187_FC5" old kernel first instead default "VZ" kernel.

To do that at shell prompt type:

grub

GNU GRUB version 0.97 (640K lower / 3072K upper memory)

[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub>

Now type this: savedefault –default=1 –once

grub> savedefault –default=1 –once

Next line type: reboot

grub> reboot

and you are back into shell prompt.

Now reboot your system and thats it !

Simple! I did not come accross any tutorial which will explain in plain english how to boot kernel once !

*
To prove that you're not a bot, enter this code
Anti-Spam Image

Comments are closed.


Blog Tags:

Similar posts: