[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: grub savedefault?



> For grub2, set "GRUB_DEFAULT=saved" in "/etc/default/grub", run
> "update-grub", and run "grub-set-default x" (where x is the default
> entry from which you want to boot and the count starts at 0).

The approach is use is that /etc/rc.local does:

	cp /boot/vmlinuz-$(uname -r) /boot/vmlinuz-latest
	cp /boot/initrd.img-$(uname -r) /boot/initrd.img-latest

so Grub2 ends up with an additional option to use "Linux latest".
The main reason for doing that wasn't so much to keep booting with the
same version as last time, but so that I can be "sure" that hibernate
can resume properly, even if the kernel or initrd were modified
(e.g. rebuilt/updated/deleted/younameit) in the mean time.


        Stefan


PS: Note that it is not 100% foolproof: if the vmlinux and/or initrd has
indeed been modified since it was copied to foo-latest, and if I boot
using foo-latest, that very foo-latest I need for resume will be
overwritten with the newer vmlinuz/initrd when etc/rc.local is run
(because $(uname -r) is not really telling me which kernel was used to
boot, i.e. it won't say "latest").


Reply to: