pop-os / pop

A project for managing all Pop!_OS sources
https://system76.com/pop
2.47k stars 87 forks source link

Lenovo T480/490 does not suspend on lid close #820

Open jasper-jool opened 4 years ago

jasper-jool commented 4 years ago

Distribution (run cat /etc/os-release): NAME="Pop!_OS" VERSION="19.10" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Pop!_OS 19.10" VERSION_ID="19.10" HOME_URL="https://system76.com/pop" SUPPORT_URL="http://support.system76.com" BUG_REPORT_URL="https://github.com/pop-os/pop/issues" PRIVACY_POLICY_URL="https://system76.com/privacy" VERSION_CODENAME=eoan UBUNTU_CODENAME=eoan LOGO=distributor-logo-pop-os

Issue/Bug Description: Me and a few of my colleagues have a Lenovo T480/T490, when closing the lid the laptop wont suspend. journalctl registers the lid close event but the OS does not react on accordingly.

Steps to reproduce (if you know): Unplug everything, close lid.

Expected behavior: Laptop should go to sleep on closing lid.

Other Notes:

mmstick commented 4 years ago

There must be a particular hardware component in that specific model that isn't going into a low power state.

jasper-jool commented 4 years ago

There must be a particular hardware component in that specific model that isn't going into a low power state.

Well, pressing the suspend button (clicking battery icon in top bar > pauze button) in the OS does make the laptop go to sleep. So making the hardware going to sleep should be no issue. journalctl shows that the lid-closed event is received. I can't imagine it would be hardware related. Basicly the os has to execute the same code as the suspend button on receiving the event (which it does).

Correct me if I'm wrong ;-)

mmstick commented 4 years ago

I can't imagine it would be hardware related.

I say this because suspension is working with our hardware in the lab

jasper-jool commented 4 years ago

I can't imagine it would be hardware related.

I say this because suspension is working with our hardware in the lab

I understand ;-)

But how can we fix this for other hardware?

I would be able to write a daemon which simply calls systemctl suspend. But resolving this on OS level would be better of course.

danilkhromov commented 4 years ago

I have similar issue but it occurs only if i turn on the laptop while connected to thinkpad usb-c dock. If i disconnect the laptop after and close the lid it will not go into suspend. But if i turn on the laptop and then connect it to dock then suspend is working properly.

danilkhromov commented 4 years ago

So after some further googling i managed to find some clues for such behavior. There is gsd-power process running under gdm user, which prevents system from suspending when closing the lid. In my case this process is only exists when laptop was switched on while connected to docking station with two external montiors. @jasper-jool, maybe you can check if it is occurring for you under the same conditions?

The gsd-power process can be killed with this command:sudo pkill -u gdm gsd-power. Which will solve the issue until next restart.

There is also a possibility to create a kill script, but at least for me it doesnt look like a good idea.

Probably this issue is related to GNOME shell and not to pop!_os.

jasper-jool commented 4 years ago

@danilkhromov killing the process you mentioned does solve the problem for T480, not sure about the other systems, I can ask my collegues for that! I think you found out what the problem is!

danilkhromov commented 4 years ago

@jasper-jool good that in works for you too! I hope that it would be fixed on the shell level so there will be no need to kill processes.

jasper-jool commented 4 years ago

@jasper-jool good that in works for you too! I hope that it would be fixed on the shell level so there will be no need to kill processes.

It might be an issue related to gnome and not PopOs in specific.

danilkhromov commented 4 years ago

@jasper-jool good that in works for you too! I hope that it would be fixed on the shell level so there will be no need to kill processes.

It might be an issue related to gnome and not PopOs in specific.

Yeah, i was also thinking about that, by shell i meant gnome shell. Probably DE will be more correct in that case.

egoddard commented 4 years ago

I've been having this same issue the past few weeks on my darp6 running Pop 19.10. Running sudo pkill -u gdm gsd-power fixed suspend, though when resuming the lock screen was not shown.

→ cat /etc/os-release NAME="Pop!_OS" VERSION="19.10" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Pop!_OS 19.10" VERSION_ID="19.10" HOME_URL="https://system76.com/pop" SUPPORT_URL="http://support.system76.com" BUG_REPORT_URL="https://github.com/pop-os/pop/issues" PRIVACY_POLICY_URL="https://system76.com/privacy" VERSION_CODENAME=eoan UBUNTU_CODENAME=eoan LOGO=distributor-logo-pop-os

brs17 commented 4 years ago

I've been having this same issue the past few weeks on my darp6 running Pop 19.10. Running sudo pkill -u gdm gsd-power fixed suspend, though when resuming the lock screen was not shown.

→ cat /etc/os-release NAME="Pop!_OS" VERSION="19.10" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Pop!_OS 19.10" VERSION_ID="19.10" HOME_URL="https://system76.com/pop" SUPPORT_URL="http://support.system76.com" BUG_REPORT_URL="https://github.com/pop-os/pop/issues" PRIVACY_POLICY_URL="https://system76.com/privacy" VERSION_CODENAME=eoan UBUNTU_CODENAME=eoan LOGO=distributor-logo-pop-os

If you are having issues with System76 hardware, I would recommend you reach out to System76 support directly

danilkhromov commented 4 years ago

I've been having this same issue the past few weeks on my darp6 running Pop 19.10. Running sudo pkill -u gdm gsd-power fixed suspend, though when resuming the lock screen was not shown.

→ cat /etc/os-release NAME="Pop!_OS" VERSION="19.10" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Pop!_OS 19.10" VERSION_ID="19.10" HOME_URL="https://system76.com/pop" SUPPORT_URL="http://support.system76.com" BUG_REPORT_URL="https://github.com/pop-os/pop/issues" PRIVACY_POLICY_URL="https://system76.com/privacy" VERSION_CODENAME=eoan UBUNTU_CODENAME=eoan LOGO=distributor-logo-pop-os

Out of curiosity, do you have any docking stations or external monitors plugged in? And before killing the process can you run systemd-inhibit --list --mode=block and look if you have two gsd-power processes running, one owned by your user and one by gdm

egoddard commented 4 years ago

@danilkhromov I use a usb-c hub with an external monitor, but I unplug it before shutting the lid.

After a restart (and before plugging the hub in), systemd-inhibit --list --mode=block does list two inhibtors, one owned by gdm and one by my user:

WHO  UID  USER PID  COMM           WHAT                                                     WHY                       MODE 
gdm  120  gdm  1455 gsd-media-keys handle-power-key:handle-suspend-key:handle-hibernate-key GNOME handling keypresses block
eric 1000 eric 2814 gsd-media-keys handle-power-key:handle-suspend-key:handle-hibernate-key GNOME handling keypresses block
danilkhromov commented 4 years ago

@egoddard the interesting thing is that if you start your laptop while connected to dock or external screen, then you will have two gsd-power processes. And as soon as you disconnect, the one that is owned by your user will disappear, and the one owned by gdm will stay. And apparently this is the process that blocks laptop from going to sleep. Can you maybe run the command again but turn on the laptop while connected to dock, so we can check if the assumption is correct?

@mmstick looks like its not really a hardware issue but some gnome related thing.

kendoori commented 4 years ago

I have the same issue as detailed here: https://www.reddit.com/r/pop_os/comments/fgi634/suspend_on_lid_close/fk5nlvy/?context=3

opetznick commented 4 years ago

edit /etc/systemd/logind.conf

change line #HandleLidSwitchDocked=ignore to HandleLidSwitchDocked=suspend

and it should work.

MostHated commented 4 years ago

I have a t480 and I couldn't keep mine from suspending. I keep it plugged in and hooked to a wire on my desk and remote into it, but if I restart it, after about 10-15 seconds it would drop the network connection. Luckily, as @opetznick mentioned above, I set HandleLidSwitchDocked=ignore (which was commented out) and it seems to be good now. :+1:

danilkhromov commented 4 years ago

Seems like the issue was fixed with the latest Gnome version. I upgraded my system to 20.10 and now, when i disconnect my laptop from external monitor / docking station, it suspends on lid close.

fabiosantoscode commented 3 years ago

I was having the same issue on my T14, and because I remember changing something in the BIOS for my old X1 Carbon, I went looking and found this setting:

P_20210205_120110

I also disabled fast boot (displays the POST message instead of a logo and is slower to boot) a few days ago because I always do it, but I'm not sure if it helped.