Results 1 to 6 of 6

Thread: Suspend when closing the lid during the shutdown process

Hybrid View

  1. #1
    Join Date
    Jan 2016
    Location
    Manchester, UK
    Posts
    286

    Default Suspend when closing the lid during the shutdown process

    Hello everyone,

    I found a weird problem with openSUSE Tumbleweed on my laptop (ThinkPad T420s) . As the title saying, the system will suspend when I close the laptop lid after I selecting to shutdown the system but the system has not finished the power off process. And in the Power Saving settings, the behaviour of closing the lid is chosen to be "Lock screen".

    Detailed steps are,
    1. Make sure the behaviour of closing the lid is chosen to be "Lock screen" in Power Saving;
    2. Kick start -> Power -> Shut Down
    3. Close the lid right away
    4. The laptop goes suspend
    5. Open the lid
    6. Laptop resumes from suspend
    7. Shutdown process continues.

    Could anyone please shed some light on this? I mean, it seems not right for the system to turn into suspend in the process of shutting down. What's wrong with it? How could I set it right? I am in the habit to close the lid after issuing the shutdown command. And this problem troubles me a lot.

    Cheers
    openSUSE Tumbleweed (usually the latest snapshot) w/ KDE Plasma 5

  2. #2

    Default Re: Suspend when closing the lid during the shutdown process

    You say you shutdown the system and instantly close the lid? What happens if you wait until the system has completely shut down? It just takes seconds and then I would close the lid, making sure the computer is off.

  3. #3

    Default Re: Suspend when closing the lid during the shutdown process

    It would probably help to change systemd/logind's settings.
    Add this to /etc/systemd/logind.conf to disable logind suspending the system when no desktop is running :
    Code:
    HandleLidSwitch=ignore
    Though I would consider it a bug (in systemd) if closing the lid during shutdown suspends the system...
    Or does this happen while the desktop is still running?

    PS: this may be the same issue as discussed in https://forums.opensuse.org/showthre...ur-How-to-undo ...
    AFAICS the fix is not in Tumbleweed yet either.

    If so, setting "LidSwitchIgnoreInhibited=no" would be the proper fix.
    Or wait for the next systemd update which should have it fixed.
    Last edited by wolfi323; 17-Nov-2016 at 03:39.

  4. #4
    Join Date
    Jan 2016
    Location
    Manchester, UK
    Posts
    286

    Default Re: Suspend when closing the lid during the shutdown process

    Quote Originally Posted by tinylagarto View Post
    You say you shutdown the system and instantly close the lid? What happens if you wait until the system has completely shut down? It just takes seconds and then I would close the lid, making sure the computer is off.
    Yes, you're right. The laptop can turn off correctly if the lid is left open. And that's what I did these days. But I still think this is not a right behaviour.


    Quote Originally Posted by wolfi323 View Post
    It would probably help to change systemd/logind's settings.
    Add this to /etc/systemd/logind.conf to disable logind suspending the system when no desktop is running :
    Code:
    HandleLidSwitch=ignore
    Thanks a lot wolfi323. This works very well.

    Quote Originally Posted by wolfi323 View Post
    PS: this may be the same issue as discussed in https://forums.opensuse.org/showthre...ur-How-to-undo ...
    AFAICS the fix is not in Tumbleweed yet either.

    If so, setting "LidSwitchIgnoreInhibited=no" would be the proper fix.
    Or wait for the next systemd update which should have it fixed.
    Yes, I read this post, too. But I cannot understand the situation. And my problem occurs only when I issued shutdown command and close the lid instantly. So my subconscious told my it's irrelevant. Now it seems they are caused by the same reason.

    Quote Originally Posted by wolfi323 View Post
    AFAICS the fix is not in Tumbleweed yet either.

    If so, setting "LidSwitchIgnoreInhibited=no" would be the proper fix.
    Or wait for the next systemd update which should have it fixed.
    I'll try this later since your first suggestion works excellently. Thanks again for your kind help.
    Last edited by cnzhx; 17-Nov-2016 at 06:31. Reason: Correct formatting error
    openSUSE Tumbleweed (usually the latest snapshot) w/ KDE Plasma 5

  5. #5

    Default Re: Suspend when closing the lid during the shutdown process

    Quote Originally Posted by cnzhx View Post
    Yes, you're right. The laptop can turn off correctly if the lid is left open. And that's what I did these days. But I still think this is not a right behaviour.
    Definitely not.

    Thanks a lot wolfi323. This works very well.
    Ok, so it is indeed systemd's logind that suspends the system.

    Yes, I read this post, too. But I cannot understand the situation.
    I'll try to explain:
    Normally, logind (part of systemd) handles such events like closing the lid. Its behavior can be configured in /etc/systemd/logind.conf, the default for lid switch is "suspend" (as is probably expected).

    Now if you start a desktop like KDE/Plasma5, it has its own powermanagement. So it "inhibits" (i.e. turns off) logind's handling of those events, to be able to use its own settings.

    But a wrong change in systemd caused this inhibition to no longer work with the default logind.conf settings (for lid switch at least), so KDE in fact cannot handle those events nor apply its settings.

    It is about the LidSwitchIgnoreInhibited option, which defaults to yes.
    Currently this makes logind also ignore a desktop's inhibition, which it shouldn't.

    The next systemd update should have this change reverted, so KDE will be able to "take over" again.

    And my problem occurs only when I issued shutdown command and close the lid instantly. So my subconscious told my it's irrelevant. Now it seems they are caused by the same reason.
    So you close the lid when the desktop is still there, right?
    Apparently that's "too early" then.

    Probably logind is not yet informed of the shutdown, because KDE has not finished yet.
    And because logind handles the lid switch (because of the mentioned bug), it suspends.

    I think if the actual shutdown would already be progressing, logind wouldn't suspend but rather let the shutdown finish.
    But as it doesn't know (yet) that the system is to be shut down, it will suspend according to its settings (HandleLidSwitch in logind.conf).

    I'll try this later since your first suggestion works excellently. Thanks again for your kind help.
    It should, as this will allow KDE to handle the lid switch again.
    But don't forget to remove "HandleLidSwitch=ignore" too, otherwise you probably won't be able to tell whether this helps or not...
    If it works, your problem should be gone with the next update without a need to have this (or any) option in logind.conf.
    Last edited by wolfi323; 17-Nov-2016 at 06:51.

  6. #6
    Join Date
    Jan 2016
    Location
    Manchester, UK
    Posts
    286

    Default Re: Suspend when closing the lid during the shutdown process

    Quote Originally Posted by wolfi323 View Post
    I'll try to explain:
    Hi wolfi323, your explanation is simple and informative. Now I get it. The problem is caused by the cooperation problem between systemd and Plasma.

    Quote Originally Posted by wolfi323 View Post
    So you close the lid when the desktop is still there, right?
    Apparently that's "too early" then.
    Yes, I closed the lid while OS was still busy in killing all the running applications.

    Quote Originally Posted by wolfi323 View Post
    But don't forget to remove "HandleLidSwitch=ignore" too, otherwise you probably won't be able to tell whether this helps or not...
    Code:
    LidSwitchIgnoreInhibited=no
    This alone works, too. Your theory is completely right on this.

    Quote Originally Posted by wolfi323 View Post
    If it works, your problem should be gone with the next update without a need to have this (or any) option in logind.conf.
    Ok, I will keep logind.conf intact and wait for the next systemd update.

    Thanks again, wolfi323, for your generous help and explaining. I leant a lot from you. Most of my questions here are answered by you :-)
    openSUSE Tumbleweed (usually the latest snapshot) w/ KDE Plasma 5

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •