Bug 407094 - Laptop suspends even if external monitor is plugged in
Summary: Laptop suspends even if external monitor is plugged in
Status: RESOLVED NOT A BUG
Alias: None
Product: Powerdevil
Classification: Unmaintained
Component: general (other bugs)
Version First Reported In: 5.15.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
: 407093 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-04-30 13:56 UTC by neopt
Modified: 2019-05-07 16:00 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
.config/powermanagementprofilesrc (845 bytes, text/plain)
2019-04-30 13:56 UTC, neopt
Details
kscreen-doctor -j (39.53 KB, text/plain)
2019-04-30 18:32 UTC, neopt
Details
Powerdevil message log (2.97 KB, text/plain)
2019-05-07 15:52 UTC, neopt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description neopt 2019-04-30 13:56:08 UTC
Created attachment 119747 [details]
.config/powermanagementprofilesrc

SUMMARY
On the systems settings module, I set the laptop lid close action to "Suspend", and unchecked the box "Even when external monitor is connected".
Powerdevil seems to ignore this setting and suspend the laptop whether an external monitor is plugged or not when I shut the lid.

STEPS TO REPRODUCE
1. Plug in external monitor 
2. Close lid

OBSERVED RESULT
System enters suspended state

EXPECTED RESULT
External monitor inhibits suspension.


SOFTWARE/OS VERSIONS
Operating System: NixOS 19.09pre177249
KDE Plasma Version: 5.15.3
KDE Frameworks Version: 5.57.0
Qt Version: 5.12.0
Kernel Version: 4.19.36
OS Type: 64-bit


ADDITIONAL INFORMATION
The issue appears to be a regression - before installing the last updates it worked just fine. Unfortunately I cannot rollback to the previous version easily to confirm this.

$ systemd-inhibit
     Who: UPower (UID 0/root, PID 2754/upowerd)
    What: sleep
     Why: Pause device polling
    Mode: delay

     Who: PowerDevil (UID 1000/salazar, PID 2995/org_kde_powerde)
    What: handle-power-key:handle-suspend-key:handle-hibernate-key:handle-lid-switch
     Why: KDE handles power events
    Mode: block

     Who: Screen Locker (UID 1000/salazar, PID 2917/ksmserver)
    What: sleep
     Why: Ensuring that the screen gets locked before going to sleep
    Mode: delay

3 inhibitors listed.

$ busctl get-property org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager Docked
b true

$ xrandr  | grep " connected"
eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 309mm x 174mm
DP-1-2 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 521mm x 293mm

$ journalctl -f
[...]
Apr 30 15:47:51 hostname systemd-logind[2229]: Lid closed.
Apr 30 15:47:51 hostname xsession[2806]: powerdevil: Suspend session triggered with QMap(("Explicit", QVariant(bool, true))("Type", QVariant(uint, 1)))
Apr 30 15:47:51 hostname xsession[2806]: powerdevil: Suspend session triggered with QMap(("Explicit", QVariant(bool, true))("SkipFade", QVariant(bool, true))("Type", QVariant(uint, 1)))
Apr 30 15:47:51 hostname xsession[2806]: powerdevil: Starting Login1 suspend job
Apr 30 15:47:51 hostname xsession[2806]: lock called
Apr 30 15:47:51 hostname xsession[2806]: powerdevil: Pausing all media players before suspending
Apr 30 15:47:51 hostname xsession[2806]: bluedevil: About to suspend
[...]
Comment 1 neopt 2019-04-30 14:00:28 UTC
*** Bug 407093 has been marked as a duplicate of this bug. ***
Comment 2 Kai Uwe Broulik 2019-04-30 15:18:51 UTC
Can you attach the output of kscreen-doctor -j please
Does the battery monitor have a text along the lines of "Your laptop is configured not to suspend when an external monitor is connected"?
Comment 3 neopt 2019-04-30 18:32:58 UTC
Created attachment 119754 [details]
kscreen-doctor -j
Comment 4 neopt 2019-04-30 18:50:57 UTC
The battery monitor does not show that text - which is strange. I attached the output of kscreen-doctor.
Comment 5 Kai Uwe Broulik 2019-05-02 08:29:34 UTC
Thanks. Very strange. The two connected screens are eDP-1 of type 7 ("Panel") and DP-1 of type 14 ("DisplayPort"). The internal screen isn't enabled but your external screen is, so it should identify it as external monitor and disable suspend.
The only cause I could see is that it doesn't notice the screen configuration change? When you kill powerdevil and restart it manually (should be somewhere around /usr/lib/x86_something/libexec/org_kde_powerdevil) in that configuration, does it then pick it up?
Comment 6 neopt 2019-05-07 15:52:38 UTC
Created attachment 119898 [details]
Powerdevil message log

I tried to kill powerdevil and restart it manually. I attach the messages it outputted - this did not solve the problem.

I then noticed this NixOS issue: https://github.com/NixOS/nixpkgs/issues/60312, so I tried to clear the .cache folder and restart plasma. With my surprise, it worked! The battery monitor is also back to displaying "Your laptop is configured not to suspend when an external monitor is connected" correctly.

I will be marking this as solved - if you need logs or more information, I will be happy to provide them. Thank you, Kai, for your help!
Comment 7 neopt 2019-05-07 16:00:37 UTC
Clearing the ~/.cache folder (specifically, deleting all the k*, plasma* and qt* subfolders) solved the issue for me.

I am not sure it is a powerdevil problem at this point, maybe some other plasma components fail to invalidate their caches. Also, NixOS changes paths of the various binaries usually located in /usr - the problem might never emerge in system where binaries and configuration files are held in the conventional Linux FHS.