I have a laptop running two different GNU/Linux-based operating systems. Each operating system has it's dedicated root and home partition, but share the boot and swap partition. They both work quite well, except for one issue: anytime I hibernate the machine and I boot up, say the next day, and I forgot that I hibernated X operating system, I end up messing up the FS journal. Now, I was aware that by sharing swap space, this was a possible side effect, however, I was under the impression that once I hibernate, GRUB would detect that the swap space is in use, and boot into the hibernated OS. This is not the case for me, as I have had to write a work-around solution:
edit /etc/default/grub:
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
run grub-mkconfig, and then write a script that changes /boot/grub/grub.cfg's timeout from whatever to 0 upon hibernation (/etc/pm/sleep.d/10-hibernate-script.sh):
#!/bin/sh
case "$1" in
hibernate)
cat /boot/grub/grub.cfg | sed 's/timeout=10/timeout=0/g' > /boot/grub/grub.cfg~
mv /boot/grub/grub.cfg~ /boot/grub/grub.cfg
;;
thaw)
cat /boot/grub/grub.cfg | sed 's/timeout=0/timeout=10/g' > /boot/grub/grub.cfg~
mv /boot/grub/grub.cfg~ /boot/grub/grub.cfg
;;
esac
Is there a more "native" way of doing this, or is this the best way of achieving this?
vmlinuz
binary). – Gilles 'SO- stop being evil' Sep 19 '15 at 20:44/lib/modules/$(uname -r)
, and probably other headaches that could cause problems with hardware that needed specific module configs. – Peter Cordes Sep 19 '15 at 21:00