Results 1 to 9 of 9

Thread: Some apps keep my laptop from suspending/hibernating

  1. #1

    Default Some apps keep my laptop from suspending/hibernating

    Hi everyone.

    I have installed OpenSuse Leap 15 just a few days ago. Ran updates in a daily bases since then...

    Frequently when I have some apps opened, laptop has hard time suspending or hibernating(doesn't matter if I try graphically or via CLI).

    As I have noticed some apps are causing this. Last time it was Microsoft's Visual Studio Code. I had remote folder mounted using sshfs, and I was editing file from that mounted folder inside vscode. Then because of inactivity, sshfs connection apparently got closed, and so inside editor were files which didn't exist.

    After that I was unable to suspend/hibernate my os. Screen turns off, am getting logged out, but processes still running.

    I don't think issue is with just vscode. I think other apps might cause same issue with right conditions.

    Is there a setting to change, so no app will be able to stop Linux from suspending/hibernating?

    Thanks a lot in advance

  2. #2
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,383
    Blog Entries
    1

    Default Re: Some apps keep my laptop from suspending/hibernating

    I guess you could investigate taking steps to ensure the the remote filesystem is not disconnected (if that is the underlying cause of the problem here). The 'ServerAliveInterval' can be configured explicitly (in ~/.ssh/config for example) to send null packets after a given number of seconds. (By default, no null packet is sent, so inactivity will generally result in a disconnect depending on how the server is configured.)

    Code:
    Host *
      ServerAliveInterval 60
    https://www.ostechnix.com/how-to-sto...ting-in-linux/

    Other than that I'm not sure what else might prevent suspension, but I don't encounter such behaviour. Maybe others have further suggestions...
    openSUSE Leap 15.0; KDE Plasma 5

  3. #3
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,852
    Blog Entries
    14

    Default Re: Some apps keep my laptop from suspending/hibernating

    Eh, this might be a different situation, but not that different in that I can suspend ( i never use hibernation ) and resume properly. I don't use sshfs, but rather a Networkconnection over sftp through Dolphin - Network - Create New Connection. If uses kNetattach and can use various protocols. For my webapp development I use Kate. After creating the new Connection ( with a proper name f.e. Knurpht-VPS ), I drag it to Dolphin's Places in the side bar. Now, from Kate I can open a file by clicking File - Open - click in Places on Knurpht-VPS and open as many files as my project requires, edit and save them. So far the use case, so you see it's about the same: working on a remote project.

    Now, I don't work continuously on the same code, have the routine to close the lid of my laptop, which puts it to suspend. If I open the lid again, unlock, I can see the network connection be reeastablished and the entire Kate session is intact, i.e. I can change and save files, no data loss.

    Maybe this gives you some options..
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  4. #4

    Default Re: Some apps keep my laptop from suspending/hibernating

    Thanks guys for your kind replies

    Today and yesterday I have tried to reproduce the problem multiple times.

    Yesterday weird thing happened... It wasn't suspending even when closing vscode... When I closed the terminal, it started working again.

    Now I am trying to see if other editors will cause same thing, but none of them do... Issue seems to be connected with sshfs combined with vscode.

    Note that this time sshfs connection was wasn't closed, but the issue still persisted.

    Isn't there a way to configure system, so it will force every app to suspend?

  5. #5
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,383
    Blog Entries
    1

    Default Re: Some apps keep my laptop from suspending/hibernating

    Quote Originally Posted by zura1547 View Post
    Thanks guys for your kind replies

    Today and yesterday I have tried to reproduce the problem multiple times.

    Yesterday weird thing happened... It wasn't suspending even when closing vscode... When I closed the terminal, it started working again.

    Now I am trying to see if other editors will cause same thing, but none of them do... Issue seems to be connected with sshfs combined with vscode.

    Note that this time sshfs connection was wasn't closed, but the issue still persisted.

    Isn't there a way to configure system, so it will force every app to suspend?
    I haven't encountered a situation like this (and I'm not familiar with vscode at all), so can only provide general advice here. Since you categorically state that it prevents suspend (and I assume shutdown) from occurring, I'm wondering if perhaps it is using a systemd inhibitor lock perhaps? This is complete speculation on my part though.

    https://www.freedesktop.org/wiki/Sof...stemd/inhibit/

    I note that there are two PolKit policies that can be tweaked to prevent user applications from having the ability to block or delay such an action
    'org.freedesktop.login1.inhibit-block-sleep' and 'org.freedesktop.login1.inhibit-delay-sleep', and the default policies are as follows
    Code:
     # pkaction -av org.freedesktop.login1.inhibit-block-sleep
    org.freedesktop.login1.inhibit-block-sleep:
      description:       Allow applications to inhibit system sleep
      message:           Authentication is required for an application to inhibit system sleep.
      vendor:            The systemd Project
      vendor_url:        http://www.freedesktop.org/wiki/Software/systemd
      icon:              
      implicit any:      no
      implicit inactive: yes
      implicit active:   yes
      annotation:        org.freedesktop.policykit.imply -> org.freedesktop.login1.inhibit-delay-sleep org.freedesktop.login1.inhibit-block-idle
    
     # pkaction -av org.freedesktop.login1.inhibit-delay-sleep
    org.freedesktop.login1.inhibit-delay-sleep:
      description:       Allow applications to delay system sleep
      message:           Authentication is required for an application to delay system sleep.
      vendor:            The systemd Project
      vendor_url:        http://www.freedesktop.org/wiki/Software/systemd
      icon:              
      implicit any:      yes
      implicit inactive: yes
      implicit active:   yes
    
     #
    As well as this, there is an option to limit 'delay' inhibitor locks to a maximum time interval. (This won't have any effect if a 'block' inhibitor is employed though.)
    InhibitDelayMaxSec=
    Specifies the maximum time a system shutdown or sleep request is delayed due to an inhibitor lock of type "delay" being active before the inhibitor is
    ignored and the operation executes anyway. Defaults to 5.
    Reference 'man logind.conf'

    I'll leave you to explore this further.
    Last edited by deano_ferrari; 16-Jun-2018 at 01:06.
    openSUSE Leap 15.0; KDE Plasma 5

  6. #6

    Default Re: Some apps keep my laptop from suspending/hibernating

    Found the funny fix actually. Even though I don't have an external monitor connected, this works:

    In Energy Saving, option suspend even when an external is connected - must be ticked.

    It now suspends successfully when LID is closed, though normal suspending still doesn't work. I suppose neither does hibernating...

    I will look into this later and will post solution for anyone who might encounter similar problem.

    Everyone thanks for time and attention

  7. #7

    Default Re: Some apps keep my laptop from suspending/hibernating

    Quote Originally Posted by zura1547 View Post
    Found the funny fix actually. Even though I don't have an external monitor connected, this works:

    In Energy Saving, option suspend even when an external is connected - must be ticked.

    It now suspends successfully when LID is closed, though normal suspending still doesn't work. I suppose neither does hibernating...

    I will look into this later and will post solution for anyone who might encounter similar problem.

    Everyone thanks for time and attention :)

    Okay... It worked before... Now it does same thing again :/

  8. #8
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,383
    Blog Entries
    1

    Default Re: Some apps keep my laptop from suspending/hibernating

    Quote Originally Posted by zura1547 View Post
    Okay... It worked before... Now it does same thing again :/
    I'm not surprised to read this - it seemed unlikely to me.
    openSUSE Leap 15.0; KDE Plasma 5

  9. #9

    Default Re: Some apps keep my laptop from suspending/hibernating

    Quote Originally Posted by zura1547 View Post
    Okay... It worked before... Now it does same thing again :/
    I tried some different things on the mounted folder and I have discovered weird thing... root can't access it! only my user can. How is that possible?

    it writes this when I try to cd in that directory: bash: cd: folder Permission denied

Posting Permissions

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