Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Problem getting suspend to disk and normal shutdown to work
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
pfc
n00b
n00b


Joined: 14 Jan 2017
Posts: 11

PostPosted: Thu May 25, 2017 1:17 pm    Post subject: Problem getting suspend to disk and normal shutdown to work Reply with quote

I'm stuck trying to figure out how to have the default Grub entry:
* If the system was suspended using "rtcwake -m disk": resume a suspended session from an unencrypted swapdisk
* Otherwise: boot the encrypted root partition as per normal boot procedure where you enter a password to unlock /


I can boot my LUKS encrypted system fine (I get the password prompt to unlock /) by this Grub entry:
Code:
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-31691e2a-67fa-49e4-b055-2eea29db933c' {
        load_video
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd4,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd4,msdos1 --hint-efi=hd4,msdos1 --hint-baremetal=ahci4,msdos1  af47c8e2-b072-42d1-9de8-28a5bfda21eb
        else
          search --no-floppy --fs-uuid --set=root af47c8e2-b072-42d1-9de8-28a5bfda21eb
        fi
        echo    'Loading Linux 4.8.17-hardened-r2 ...'
        linux   /vmlinuz-4.8.17-hardened-r2 root=/dev/mapper/root ro dolvm rootfstype=ext4 crypt_root=UUID="f1513424-b508-4859-a940-a0f244bea546" quiet
        echo    'Loading initial ramdisk ...'
        initrd  /initramfs-genkernel-x86_64-4.8.17-hardened-r2
}


I can resume my suspended session from swap partition (no password prompt given, as / is already unlocked inside swap partition data) by this Grub entry:
Code:
menuentry 'Gentoo GNU/Linux - resume from swap' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-31691e2a-67fa-49e4-b055-2eea29db933c' {
        load_video
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd4,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd4,msdos1 --hint-efi=hd4,msdos1 --hint-baremetal=ahci4,msdos1  af47c8e2-b072-42d1-9de8-28a5bfda21eb
        else
          search --no-floppy --fs-uuid --set=root af47c8e2-b072-42d1-9de8-28a5bfda21eb
        fi
        echo    'Loading Linux 4.8.17-hardened-r2 ...'
        linux   /vmlinuz-4.8.17-hardened-r2 resume=UUID="51765d45-edb4-430a-8e65-963d48d893fc"
        echo    'Loading initial ramdisk ...'
        initrd  /initramfs-genkernel-x86_64-4.8.17-hardened-r2
}


But if I try to use this entry, it just disregards the swap partition data and boots the system normally (requires password to unlock / as per normal bootup):
Code:
menuentry 'Gentoo GNU/Linux - resume from swap' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-31691e2a-67fa-49e4-b055-2eea29db933c' {
        load_video
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd4,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd4,msdos1 --hint-efi=hd4,msdos1 --hint-baremetal=ahci4,msdos1  af47c8e2-b072-42d1-9de8-28a5bfda21eb
        else
          search --no-floppy --fs-uuid --set=root af47c8e2-b072-42d1-9de8-28a5bfda21eb
        fi
        echo    'Loading Linux 4.8.17-hardened-r2 ...'
        linux   /vmlinuz-4.8.17-hardened-r2 resume=UUID="51765d45-edb4-430a-8e65-963d48d893fc" root=/dev/mapper/root ro dolvm rootfstype=ext4 crypt_root=UUID="f1513424-b508-4859-a940-a0f244bea546"
        echo    'Loading initial ramdisk ...'
        initrd  /initramfs-genkernel-x86_64-4.8.17-hardened-r2
}


Is it in any way possible to have one single Grub entry, which will resume the suspended system (if "rtcwake -m disk" was used), and otherwise it just boots the whole system normally?

I've been googling the problem and haven't found anything helpful in solving this specific problem, so I'm hoping someone in here can help.
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1878
Location: Switzerland (Romandie)

PostPosted: Mon Jun 12, 2017 9:32 am    Post subject: Reply with quote

In /etc/default/grub, I have that line:
Code:
# Append parameters to the linux kernel command line for non-recovery entries
GRUB_CMDLINE_LINUX_DEFAULT="resume=/dev/sda3 resume_offset=81955 no_console_suspend i8042.reset"

The resume_offset was necessary because that system is using a swap file. After, I generate /boot/grub2/grub.cfg with grub2-mkconfig.
_________________
"Confirm You are a robot." - the singularity
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
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