Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regressions: hibernation issues from 254.5 to 255~rc2 #30083

Closed
calestyo opened this issue Nov 17, 2023 · 5 comments · Fixed by #30074
Closed

regressions: hibernation issues from 254.5 to 255~rc2 #30083

calestyo opened this issue Nov 17, 2023 · 5 comments · Fixed by #30074
Labels
bug 🐛 Programming errors, that need preferential fixing hibernate-resume regression ⚠️ A bug in something that used to work correctly and broke through some recent commit sleep
Milestone

Comments

@calestyo
Copy link
Contributor

systemd version the issue has been seen with

255~rc2

Used distribution

Debian sid

Linux kernel version used

6.5.0-4-amd64

CPU architectures issue was seen on

x86_64

Component

systemctl, systemd, systemd-logind

Expected behaviour you didn't see

Hey.

Forwarding this from Debian bug #1056135.

Since upgrading from 254.5 to 255~rc2, I see the following two issues (which both disappear when downgrading to 254.5-1 (and completely rebooting the system, before trying again - they also shop up again, only after completely rebooting the upgraded systemd again)):

  1. I have a somewhat special hibernation setup.
    Hibernation goes to a btrfs swap file on top of dm-crypt.
    The following unit files are used for that:
    /etc/systemd/system/data-swap-hibernation.swap:

     [Unit]
     Before=systemd-hibernate.service
     StopWhenUnneeded=true
    
     [Swap]
     What=/data/swap/hibernation
     Options=noauto
    
     [Install]
     RequiredBy=systemd-hibernate.service
    

    I also have a /etc/systemd/system/hibernation-cleanup.service:

     [Unit]
     Description=synchronise cached writes to persistent storage and free page cache before hibernation in order to minimise the image
     Before=hibernate.target
    
     [Service]
     Type=oneshot
     ExecStart=sync
     ExecStart=@sh %n:sh -c 'printf 1 >/proc/sys/vm/drop_caches'
    
     [Install]
     WantedBy=hibernate.target
    

    but I don't think this has anything to do with the issue here.

    There are symlinks:

     /etc/systemd/system/systemd-hibernate.service.requires/data-swap-hibernation.swap -> /etc/systemd/system/data-swap-hibernation.swap
     /etc/systemd/system/hibernate.target.wants/hibernation-cleanup.service -> /etc/systemd/system/hibernation-cleanup.service
    

    Especially, the hibernation file may not be availalbe (or activated as swap), yet, when I go into hibernation.
    This caused desktop environments (I use Cinnamon) not to show the "Hibernate" button, which I've been able to solve via a:
    /etc/systemd/system/systemd-logind.service.d/disable-hibernation-swap-check.conf:

     [Service]
     Environment="SYSTEMD_BYPASS_HIBERNATION_MEMORY_CHECK=1"
    

    However, starting with 255~rc2-1 (but solved when going back to 254.5-1) this no longer seems to have an effect. At least Cinnamon then doesn't show the Hibernate button anymore.

  2. When, because of (1), manually calling:

    # systemctl hibernate
    Call to Hibernate failed: No such file or directory
    

    The above error occurs (which itdoes not with 254.5-1), but the system then still seems to hibernate normally (and can also resume from that).

Notice also that I've changed logind.conf:

[Login]
HandleSuspendKey=ignore
HandleSuspendKeyLongPress=ignore
HandleLidSwitch=lock
HandleLidSwitchExternalPower=lock
HandleLidSwitchDocked=lock

and sleep.conf:

[Sleep]
HibernateMode=shutdown platform

Any ideas?

Thanks,
Chris.

Unexpected behaviour you saw

No response

Steps to reproduce the problem

No response

Additional program output to the terminal or log subsystem illustrating the issue

No response

@calestyo calestyo added the bug 🐛 Programming errors, that need preferential fixing label Nov 17, 2023
@calestyo
Copy link
Contributor Author

Some logs, which I've made with:

[Manager]
LogLevel=debug

in /etc/systemd/system.conf and after a fresh restart of the system with that.

  1. journalctl -b output, but only the part around the time where within Cinnamon I pressed the Power-Button, which causes the dialogue that asks for Shutdown/Restart/Hibernate/Suspend, etc. to show up, without actually triggering any of these:
    systemd.debug.powerbutton-handler.txt
  2. journalctl -b output, but only the part around executing systemctl hibernate until having the system resumed again:
    systemd.debug.hibernate+resume.txt
  3. journalctl -b | grep -E 'cinnamon|login':
    systemd.debug.cinnamon+login.txt

If you need anything else, please tell me what :-) (I've been a bit reluctant to simply send the whole journal since it's so much any I didn't want to check all for any sensitive information ^^)

Thanks,
Chris.

@yuwata yuwata added sleep hibernate-resume regression ⚠️ A bug in something that used to work correctly and broke through some recent commit and removed pid1 systemctl logind labels Nov 18, 2023
@yuwata yuwata added this to the v255 milestone Nov 18, 2023
@yuwata
Copy link
Member

yuwata commented Nov 18, 2023

cc @YHNdnzj ?

@YHNdnzj
Copy link
Member

YHNdnzj commented Nov 18, 2023

Indeed. Such setups are unintentionally invalidated in #29382, where more safety checks for hibernation were added. #30074 should help to generate more helpful error message.

TBH, I'm not sure if this kind of setup is worth supporting. I mean, the swap space is always around, so why not keep it enabled? See more justifications of mine in https://wiki.archlinux.org/title/Talk:Power_management#On-demand_swap_for_hibernation_only . But, since it breaks compatibility, I'll submit a fix.

YHNdnzj added a commit to YHNdnzj/systemd that referenced this issue Nov 18, 2023
Otherwise, ENOENT or ENXIO may be directly returned as error through
bus.

Should help to generate clearer error message for systemd#30083.
YHNdnzj added a commit to YHNdnzj/systemd that referenced this issue Nov 18, 2023
@YHNdnzj
Copy link
Member

YHNdnzj commented Nov 18, 2023

@calestyo Could you please try #30074?

@calestyo
Copy link
Contributor Author

But I shall still recommend https://chrisdown.name/2018/01/02/in-defence-of-swap.html to everyone ;-)

Well, I've been in the discussion about swap being considered nowadays again a good thing before, and I do understand the point that one cannot page anonymous memory without swap... but still, I think there are some niche cases, where it makes sense to run without general swap, but were one might still want it for hibernation.

So it's really good, that you keep supporting this.

I've tested #30074, and when I rebooted the system with a build of systemd that had the patches applied, it froze at boot (while systemd was already doing its thing) and CPU went to 100% (assuming from the fan noise).

Had never seen this on that system before. Only a forcible poweroff helped. Trying to boot again with no further changes, worked like a charm.

Also, the commits fixed both issues. Especially systemdct hibernate now again causes the screensaver to lock up the DE.

Thanks for the fix :-)

ssahani pushed a commit to ssahani/systemd that referenced this issue Nov 23, 2023
Otherwise, ENOENT or ENXIO may be directly returned as error through
bus.

Should help to generate clearer error message for systemd#30083.
ssahani pushed a commit to ssahani/systemd that referenced this issue Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Programming errors, that need preferential fixing hibernate-resume regression ⚠️ A bug in something that used to work correctly and broke through some recent commit sleep
3 participants