[Bug 856392] New: systemd - point grub at the right entry before hibernating
https://bugzilla.novell.com/show_bug.cgi?id=856392 https://bugzilla.novell.com/show_bug.cgi?id=856392#c0 Summary: systemd - point grub at the right entry before hibernating Classification: openSUSE Product: openSUSE Factory Version: 13.2 Milestone 0 Platform: All OS/Version: SUSE Other Status: NEW Severity: Major Priority: P5 - None Component: Basesystem AssignedTo: systemd-maintainers@suse.de ReportedBy: vdziewiecki@suse.com QAContact: qa-bugs@suse.de CC: fcrozat@suse.com Found By: Development Blocker: --- Created an attachment (id=572623) --> (http://bugzilla.novell.com/attachment.cgi?id=572623) grub.sh, should go to /usr/lib/systemd/system-sleep Hi, I believe this functionality has to be added before switching from pm-utils to systemd suspend/hibernate. When a computer is turned on after hibernating, grub must chose the right entry automatically, and not let the user chose. If the user would choose to boot into another OS, bad things could happen. To fix this, just put the attached script to /usr/lib/systemd/system-sleep. Thanks, Wojtek -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=856392
https://bugzilla.novell.com/show_bug.cgi?id=856392#c1
Nikolai Zhubr
https://bugzilla.novell.com/show_bug.cgi?id=856392
https://bugzilla.novell.com/show_bug.cgi?id=856392#c2
--- Comment #2 from Nikolai Zhubr
Created an attachment (id=572623) --> (http://bugzilla.novell.com/attachment.cgi?id=572623) [details]
Hello Wojtek, Thanks for the script, I've tested it on my box and made some small fixes and modifications. You can review them, my version is attachment #2 here. Nikolai -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=856392
https://bugzilla.novell.com/show_bug.cgi?id=856392#c3
--- Comment #3 from Nikolai Zhubr
https://bugzilla.novell.com/show_bug.cgi?id=856392
https://bugzilla.novell.com/show_bug.cgi?id=856392#c4
--- Comment #4 from Wojtek Dziewięcki
https://bugzilla.novell.com/show_bug.cgi?id=856392
https://bugzilla.novell.com/show_bug.cgi?id=856392#c5
--- Comment #5 from Nikolai Zhubr
What exactly is this change about? I've seen the diff but it's still not clear to me..
Actually just 3 trivial things: 1. Instead of relying on previously saved copy of grub's environment file (/var/run/suspend.grubonce.default) to restore normal grub behaviour (unlock current entry), use grub2-editenv to explicitely remove (the previously added) "next_entry" from current environment file. This method seems to work more reliable for me, although in theory it should not matter much. 2. The invocation of grub2-editenv needs to explicitely specify actual grub's environment file name (/boot/grub2/grubenv = GRUBDEFAULT) as first argument, otherwise it sees to complain and not work; 3. The "prepare-parameters" line was added to "grub-once-restore()". Without this line, all used variables (like GRUBDEFAULT) are empty and so the function has no action. That's all. Thank you. Nikolai -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=856392
https://bugzilla.novell.com/show_bug.cgi?id=856392#c6
Wojtek Dziewięcki
https://bugzilla.novell.com/show_bug.cgi?id=856392
https://bugzilla.novell.com/show_bug.cgi?id=856392#c
Wojtek Dziewięcki
https://bugzilla.novell.com/show_bug.cgi?id=856392
https://bugzilla.novell.com/show_bug.cgi?id=856392#c
Wojtek Dziewięcki
https://bugzilla.novell.com/show_bug.cgi?id=856392
https://bugzilla.novell.com/show_bug.cgi?id=856392#c14
--- Comment #14 from Michael Chang
Actually just 3 trivial things:
1. Instead of relying on previously saved copy of grub's environment file (/var/run/suspend.grubonce.default) to restore normal grub behaviour (unlock current entry), use grub2-editenv to explicitely remove (the previously added) "next_entry" from current environment file. This method seems to work more reliable for me, although in theory it should not matter much.
Good catch. This helps in the case that grub can't write to grubenv file and clear the flag, due to /boot partition is not physical (ie software raid or logical volume). This fixes the annoying bug which system permanently booting to the hibernated kernel entry.
2. The invocation of grub2-editenv needs to explicitely specify actual grub's environment file name (/boot/grub2/grubenv = GRUBDEFAULT) as first argument, otherwise it sees to complain and not work;
list does not require the environment file name and set/unset does. But agree that it's better practice we explicit specify it (and follow it's syntax described in man page).
3. The "prepare-parameters" line was added to "grub-once-restore()". Without this line, all used variables (like GRUBDEFAULT) are empty and so the function has no action.
Yes this is required. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=856392
https://bugzilla.novell.com/show_bug.cgi?id=856392#c
Thomas Blume
https://bugzilla.novell.com/show_bug.cgi?id=856392
https://bugzilla.novell.com/show_bug.cgi?id=856392#c19
Thomas Blume
https://bugzilla.novell.com/show_bug.cgi?id=856392
https://bugzilla.novell.com/show_bug.cgi?id=856392#c20
Frederic Crozat
Btw. using systemd for hibernation/suspend will obsolete: Forward-suspend-hibernate-calls-to-pm-utils.patch Frederic, this was your patch from bug 790157. Should I remove it?
yes, go ahead, you have my blessing to remove this dirty hack :) -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=856392
https://bugzilla.novell.com/show_bug.cgi?id=856392#c22
Thomas Blume
https://bugzilla.novell.com/show_bug.cgi?id=856392
https://bugzilla.novell.com/show_bug.cgi?id=856392#c24
--- Comment #24 from Thomas Blume
https://bugzilla.novell.com/show_bug.cgi?id=856392
https://bugzilla.novell.com/show_bug.cgi?id=856392#c29
Thomas Blume
https://bugzilla.novell.com/show_bug.cgi?id=856392
https://bugzilla.novell.com/show_bug.cgi?id=856392#c30
Michael Chang
http://bugzilla.novell.com/show_bug.cgi?id=856392
Swamp Workflow Management
http://bugzilla.novell.com/show_bug.cgi?id=856392
Swamp Workflow Management
http://bugzilla.novell.com/show_bug.cgi?id=856392
Swamp Workflow Management
http://bugzilla.novell.com/show_bug.cgi?id=856392
Swamp Workflow Management
http://bugzilla.novell.com/show_bug.cgi?id=856392
http://bugzilla.novell.com/show_bug.cgi?id=856392#c31
--- Comment #31 from Swamp Workflow Management
participants (1)
-
bugzilla_noreply@novell.com