Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Encrypted Btrfs install: suspend and hibernate not working
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
eeckwrk99
Apprentice
Apprentice


Joined: 14 Mar 2021
Posts: 165
Location: Gentoo forums

PostPosted: Sun Mar 14, 2021 6:14 pm    Post subject: Encrypted Btrfs install: suspend and hibernate not working Reply with quote

Hi.

I've reinstalled Gentoo on my machine with LUKS/Btrfs/systemd/GRUB a couple of days ago. Everything works as expected except two things: suspend and hibernate. I've tried as many things as I could think of but now I'm out of ideas.

    - Suspend: the machine seems to sleep just fine. However, after resume, only a white underscore is visible in the top left corner of the screen. If I try to switch to another TTY, the underscore disappears but the screen eventually goes to deep sleep forever. I have no choice but to reboot.
    - Hibernate: the machine never goes into hibernate state. The screen turns blank but the components are still up and running.


My hardware:
    - CPU: Intel i7-5820K
    - GPU: NVIDIA GeForce GTX 970
    - RAM: 16GB


- /etc/fstab:


Code:

UUID=F027-xxxx                                                   /boot         vfat    defaults,noatime                                                                                                                  0 2
UUID=bb997680-xxxx-xxxx-xxxx-xxxxxxxxxxxx    /             btrfs   compress-force=zstd:1,space_cache,noatime,nodiratime,ssd,subvol=@                              0 0
UUID=bb997680-xxxx-xxxx-xxxx-xxxxxxxxxxxx    /home         btrfs   compress-force=zstd:1,space_cache,noatime,nodiratime,ssd,subvol=@home                0 0
UUID=bb997680-xxxx-xxxx-xxxx-xxxxxxxxxxxx    /var/log      btrfs   compress-force=zstd:1,space_cache,noatime,nodiratime,ssd,subvol=@log                      0 0
UUID=bb997680-xxxx-xxxx-xxxx-xxxxxxxxxxxx    /var/cache/distfiles      btrfs   compress-force=zstd:1,space_cache,noatime,nodiratime,ssd,subvol=@pkg   0 0
UUID=bb997680-xxxx-xxxx-xxxx-xxxxxxxxxxxx    /.snapshots   btrfs   compress-force=zstd:1,space_cache,noatime,nodiratime,ssd,subvol=@snapshots       0 0
UUID=bb997680-xxxx-xxxx-xxxx-xxxxxxxxxxxx    /.swap        btrfs   compress=no,space_cache,noatime,nodiratime,ssd,subvol=@swap                                 0 0
/.swap/swapfile                                                     none          swap    defaults                                                                                                                              0 0




- lsblk -pfo NAME,LABEL,SIZE,TYPE,FSTYPE,MOUNTPOINT:

Code:

NAME                       LABEL   SIZE TYPE  FSTYPE MOUNTPOINT
/dev/sda                                  232,9G disk
├─/dev/sda1                         512M part               /boot
└─/dev/sda2                         232,4G part
  └─/dev/mapper/root           232,4G crypt        /var/log



- sudo btrfs subvolume list:


Code:
ID 256 gen 8909 top level 5 path @
ID 257 gen 8909 top level 5 path @home
ID 258 gen 8903 top level 5 path @log
ID 259 gen 8849 top level 5 path @pkg
ID 260 gen 8885 top level 5 path @snapshots
ID 261 gen 6828 top level 5 path @swap
ID 299 gen 3730 top level 256 path srv
ID 300 gen 2643 top level 256 path var/lib/portables
ID 301 gen 2644 top level 256 path var/lib/machines


- /etc/portage/make.conf:

Code:
USE="-bluetooth -cups -gnome -mariadb -v4l -vlc -wayland cryptsetup dbus networkmanager pulseaudio qt5 systemd udev X"
ACCEPT_KEYWORDS="~amd64"
GRUB_PLATFORMS="efi-64"
VIDEO_CARDS="nvidia"


- eselect profile list:

Code:
[9]   default/linux/amd64/17.1/desktop/plasma/systemd (stable) *


- /etc/portage/package.use:

Code:
sys-boot/grub device-mapper


- /etc/modprobe.d/blacklist.conf:

Code:
blacklist nouveau


I created the 16GB swap file with:

Code:
# truncate -s 0 /.swap/swapfile
# chattr +C /.swap/swapfile
# btrfs property set /.swap/swapfile compression none
# dd if=/dev/zero of=/.swap/swapfile bs=1G count=16 status=progress
# chmod 600 /.swap/swapfile
# mkswap /.swap/swapfile


- /etc/default/grub:

Code:

GRUB_CMDLINE_LINUX="init=/usr/lib/systemd/systemd dobtrfs crypt_root=UUID=a08efb38-xxxx-xxxx-xxxx-xxxxxxxxxxxx root=UUID=bb997680-xxxx-xxxx-xxxx-xxxxxxxxxxxx rootflags=subvol=@ resume=UUID=bb997680-xxxx-xxxx-xxxx-xxxxxxxxxxxx resume_offset=118081 quiet rw"


I calculated the resume_offset value following these instructions

I enabled the following services, as suggested by portage after emerging x11-drivers/nvidia:

Code:
# systemctl enable --now nvidia-suspend.service
# systemctl enable --now nvidia-resume.service
# systemctl enable --now nvidia-hibernate.service


I tried the following versions of packages:

Code:
- sys-kernel/gentoo-sources: 5.4.97, 5.10.23, 5.11.4 and 5.11.6
- x11-drivers/nvidia-drivers: 460.39-r1 and 460.56


My /usr/src/linux/.config does include:

Code:

Power management and ACPI options --->
    [*] Suspend to RAM and standby
    [*] Hibernation (aka 'suspend to disk')


My user is in the video group:

Code:

$ groups

wheel video users portage vboxusers


Code:

$ free -hm

                     total        used        free      shared  buff/cache   available
Mem:            15Gi       2,9Gi       8,6Gi       270Mi       4,0Gi        12Gi
Swap:           15Gi          0B        15Gi


Code:

$ swapon -s

Filename                                Type            Size    Used    Priority
/.swap/swapfile                         file            16777212        0       -2


Code:

$ cat /proc/swaps

Filename                                Type            Size            Used            Priority
/.swap/swapfile                         file            16777212        0               -2



Tried all of these, to no avail:

Code:

- systemctl suspend
- systemctl hibernate
- # echo mem > /sys/power/state
- # echo disk > /sys/power/state


How could I grab any sort of log, considering I'm compelled to reboot when the issue occurs?

I replicated my setup on a virtual machine on VirtualBox (base install, without KDE Plasma) and it turns out both suspend and hibernate work just fine.

    - Suspend: I'm getting a black screen with an underscore at the top left and the display resumes as soon as I press any key.
    - Hibernate: the machine turns off and when I start it again, it asks for my LUKS password as expected and the machine is back where I left it.


I also had a LVM on LUKS install in place of the Btrfs one only a few days ago and I didn't have this issue either, on the same hardware.


Any suggestion is much appreciated.

Thanks in advance!
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21657

PostPosted: Sun Mar 14, 2021 7:41 pm    Post subject: Reply with quote

I see that you are using the nVidia proprietary drivers in the host, and of course would not use them in the guest. Is the problem reproducible if you do not load the nVidia proprietary drivers? Note that you may need to inhibit their loading, reboot to clear them completely, and then test. Unloading them from a running kernel may not be sufficient.

When the machine is in this state, is the network still operational? Can you ssh to it from another system? Does it respond to ping?
Back to top
View user's profile Send private message
eeckwrk99
Apprentice
Apprentice


Joined: 14 Mar 2021
Posts: 165
Location: Gentoo forums

PostPosted: Sun Mar 14, 2021 8:45 pm    Post subject: Reply with quote

Hu wrote:
I see that you are using the nVidia proprietary drivers in the host, and of course would not use them in the guest. Is the problem reproducible if you do not load the nVidia proprietary drivers? Note that you may need to inhibit their loading, reboot to clear them completely, and then test. Unloading them from a running kernel may not be sufficient.


I disabled sddm.service and added the following to /etc/modprobe.d/blacklist.conf:
Code:

blacklist nvidia
blacklist nvidia_drm
blacklist nvidia_modeset


Then I rebooted. I tried both `systemctl suspend` and `systemctl hibernate` (after another reboot) from TTY but the issue persists. :(

Hu wrote:
When the machine is in this state, is the network still operational? Can you ssh to it from another system? Does it respond to ping?


I wish I could try that, unfortunately this is the sole machine I have so I guess that's not feasible? The Gentoo VM I mentioned in OP is on it.

Looks like it's neither a kernel nor an NVIDIA proprietary drivers issue. I was running 5.11.4 on the previous LUKS on LVM install too, as well as x11-drivers/nvidia-drivers 460.56 and didn't have any issue with suspend to disk/RAM. I'm using the exact same custom kernel .config file with the new Btrfs install.

I also tried editing /etc/default/grub:

Code:
GRUB_CMDLINE_LINUX="init=/usr/lib/systemd/systemd dobtrfs crypt_root=UUID=a08efb38-acbf-4035-a0b6-df222f61a01d root=/dev/mapper/root rootflags=subvol=@ resume=/dev/mapper/root real_resume=/dev/mapper/root resume_offset=118081 quiet rw"


thinking maybe changing resume and adding real_resume values would help but it doesn't make any difference.
Back to top
View user's profile Send private message
eeckwrk99
Apprentice
Apprentice


Joined: 14 Mar 2021
Posts: 165
Location: Gentoo forums

PostPosted: Wed Mar 17, 2021 7:59 pm    Post subject: Reply with quote

I'm still trying to find a solution.

I installed Arch Linux on another disk with a very similar setup (Btrfs on LUKS, systemd, swapfile...) and I'm experiencing the exact same issue. I tried the same things I mentioned in OP, such as installing LTS kernel (5.10.23) with linux-headers-lts and nvidia-lts, to no avail.

When trying to suspend:

Code:

$ journalctl

mar 17 11:19:23 gentoo systemd[1]: Reached target Sleep.
mar 17 11:19:23 gentoo systemd[1]: Starting NVIDIA system suspend actions...
mar 17 11:19:23 gentoo suspend[4148]: nvidia-suspend.service
mar 17 11:19:23 gentoo logger[4148]: <13>Mar 17 11:19:23 suspend: nvidia-suspend.service
mar 17 11:19:23 gentoo systemd[1]: nvidia-suspend.service: Succeeded.
mar 17 11:19:23 gentoo systemd[1]: Finished NVIDIA system suspend actions.
mar 17 11:19:23 gentoo systemd[1]: Starting Suspend...
mar 17 11:19:23 gentoo systemd-sleep[4157]: Suspending system...
mar 17 11:19:23 gentoo kernel: PM: suspend entry (deep)
mar 17 11:19:24 gentoo kernel: Filesystems sync: 0.324 seconds


No more entries were printed after I resumed the computer with the power button. The next entries were printed after I turned the computer off and started it again.

Regarding hibernation (Suspend-to-disk):

Code:

$ journalctl

kernel: PM: hibernation: Registered nosave memory: [mem 0x40000000-0x4fffffff]


I only get multiple lines like this and it never reaches

Code:
kernel: PM: hibernation: hibernation entry


which is taken from the Gentoo VM.

Any suggestion about what I should try next?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21657

PostPosted: Wed Mar 17, 2021 8:17 pm    Post subject: Reply with quote

I have no further ideas. Sorry.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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