A small followup:
I tried it here and can reproduce the issue, regardless whether pm-utils is installed or not (not surprising in the end as the systemd script is based on the pm-utils script, and the part to find the currently booted entry in particular is exactly the same).
The scripts seem to count wrong in some way, here’s the debug output (from the pm-utils script, systemd-sleep-grub says basically the same though):
INFO: running prepare-grub
Skipping grub entry #3, because it has the noresume option
Skipping grub entry #5, because it has the noresume option
Skipping grub entry #6, because it has no root= option
running kernel is grub menu entry 4 (vmlinuz-3.16.6-2-desktop)
preparing boot-loader: selecting entry 4, kernel /boot/3.16.6-2-desktop
grub-once: saving original /boot/grub2/grubenv
running '/usr/sbin/grub2-once 4'
while those are the menu entries:
# grub2-once --list
0 openSUSE
1 Advanced options for openSUSE>openSUSE, with Linux 3.16.7-7-desktop
2 Advanced options for openSUSE>openSUSE, with Linux 3.16.7-7-desktop (recovery mode)
3 Advanced options for openSUSE>openSUSE, with Linux 3.16.6-2-desktop
4 Advanced options for openSUSE>openSUSE, with Linux 3.16.6-2-desktop (recovery mode)
5 openSUSE Memtest
6 Microsoft Windows XP Professional (on /dev/sda1)
(I booted #3 here)
Of course #3 and #5 do not have the noresume option, but #2 and #4 have.
So there seems to be something wrong with parsing the grub.cfg file.
I investigated a bit more, and the issue seems to be caused by the “boot snapshot” feature. If I disable this the correct entry gets set.
And indeed, if “SUSE_BTRFS_SNAPSHOT_BOOTING” is true (in /etc/default/grub) the following is created in the menu header:
if -n "$extra_cmdline" ]; then
submenu "Bootable snapshot #$snapshot_num" {
menuentry "If OK, run 'snapper rollback $snapshot_num' and reboot." { true; }
The hibernate scripts look for the string "menuentry " to identify menu entries, so it definitely gets confused by this I’d say.
If you are running the default kernel, this works fine, as entry #0 and entry #1 are actually the same (#1 is the default kernel entry inside the “Advanced Options” submenu).