| View previous topic :: View next topic |
| Author |
Message |
hydrapolic n00b

Joined: 07 Feb 2008 Posts: 69
|
Posted: Wed Jul 04, 2012 12:02 pm Post subject: grub-2.00 fallback howto |
|
|
This is a howto for those that would like to run grub2 with fallback. The problem is obvious: you administer a Gentoo machine that you don't have physical access to, or it takes too long to access it. However, as a good sysadmin, you want to keep your kernel up to date. It's not unusal to forget to compile in some driver and boooom ! Ping fails and you get nervous thinking about what you did wrong...
I'm happily using kernel 3.3.8 and I realy want to try out the new 3.4.4 release !
# /usr/sbin/grub2-set-default 0
# cat /boot/grub2/grub.cfg
| Code: |
load_env
function savedefault {
saved_entry=1
save_env saved_entry
}
set default="${saved_entry}"
set timeout=5
menuentry 'Gentoo 3.4.4' {
savedefault
root=hd0,1
linux /kernel-3.4.4-gentoo root=UUID=ad584938-9193-4cbc-8b87-3b74929205b4 panic=5
initrd /initramfs-3.4.4-gentoo.img
}
menuentry 'Gentoo 3.3.8' {
root=hd0,1
linux /kernel-3.3.8-gentoo root=UUID=ad584938-9193-4cbc-8b87-3b74929205b4 panic=5
initrd /initramfs-3.3.8-gentoo.img
}
|
grub2-set-default stores the saved_entry variable in /boot/grub2/grubenv. load_env loads the variables (saved_entry) and sets the default entry to 0 (because we set it to 0). Grub2 tries to load Gentoo 3.4.4 but since it ends with a kernel panic (I "forgot" to include my sata drivers), the system reboots in 5 seconds (panic=5). However, before the system rebooted, the savedefault function stored saved_entry=1 in grubenv. After the reboot, grub2 loads the saved_entry of 1 and boots Gentoo 3.3.8. Don't forget to use your own UUID (use blkid).
Comments are welcome (pm). Thank you !
More info about grub2: http://wiki.gentoo.org/wiki/GRUB2_Quick_Start |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|