So I started getting this annoying problem with my laptop. The battery was always dead when I was about to use the computer. Weird I thought. Maybe the battery had gone bad… Anyways. Plugged the charger in and moved on with my day.
Later that day I shut the lid, put the laptop in my laptop case and put it in my bag. Went home, pick my laptop out of the bag and it was damn hot… The fans were on full blast.
Something ain’t right. I now realised that the suspend feature probably does not work for some reason…
Troubleshooting
First I asked myself a few questions that needed to be answered:
- Can I manually suspend the computer through the terminal?
- Does the computer detect the lid close?
Manual suspend
systemctl suspend
Yes! It works…
Lid close event
$ sudo journalctl
systemd-logind[1127]: Lid closed.
systemd-logind[1127]: Lid opened.
The laptop seem to detect the lid being closed and opened. Good… Then what is wrong with my computer…
The solution according to the internet: /etc/systemd/logind.conf
After countless googling sessions each and every solution mentioned that you need to modify the logind.conf
. I uncommented the mentioned lines:
HandleLidSwitch=suspend
HandleLidSwitchDocked=suspend
LidSwitchIgnoreInhibited=yes
Restarted the laptop. Shut the lid and the computer did not go to sleep. What?!?
Ubuntu bug #1799038
After googling some more I found a bug on the ubuntu bug tracker that looked extactly like mine: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1799038.
The only thing that was different was that this bug targeted Ubuntu 18.10
. I was using Ubuntu 18.04
…
Updating to Ubuntu 18.10
I opted to update my machine to 18.10
.
$ sudo apt update
$ sudo apt upgrade
$ sudo apt dist-upgrade
Set Prompt=normal
in /etc/update-manager/release-upgrades
.
$ sudo do-release-upgrade
The 18.10 installation broke i3-gaps
. Disabled i3-gaps for now and closed the laptop lid. Fans still on…
Live with it or reinstall
I was very close to reinstalling the whole OS now…
The last thing I checked was the system inhibitation locks
. The man
page says the following:
$ man systemd-inhibit
Inhibitor locks may be used to block or delay system sleep and shutdown
requests from the user, as well as automatic idle handling of the OS.
This is useful to avoid system suspends while an optical disc is being
recorded, or similar operations that should not be interrupted.
Hmm this looks promising. Maybe something is blocking the system sleep… Let’s check:
$ systemd-inhibit --list
Who: xfce4-power-manager (UID 1000/user, PID 3344/xfce4-power-man)
What: handle-power-key:handle-suspend-key:handle-hibernate-key:handle-lid-switch
Why: xfce4-power-manager handles these events
Mode: block
Who: Unattended Upgrades Shutdown (UID 0/root, PID 1649/unattended-upgr)
What: shutdown
Why: Stop ongoing upgrades or perform upgrades before shutdown
Mode: delay
Who: ModemManager (UID 0/root, PID 1248/ModemManager)
What: sleep
Why: ModemManager needs to reset devices
Mode: delay
Who: UPower (UID 0/root, PID 2982/upowerd)
What: sleep
Why: Pause device polling
Mode: delay
Who: NetworkManager (UID 0/root, PID 1100/NetworkManager)
What: sleep
Why: NetworkManager needs to turn off networks
Mode: delay
Looks like xfce4-power-manager
is blocking
the suspend/hibernate key and the lid switch.
I think I’ve finally found the problem!!! I googled: xfce4-power-manager lid close
and found this topic on the askubuntu forum.
- The accepted answer did not work. (sudo apt-get install pm-utils)
Looking further down I found a answer by Joce
.
$ xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/logind-handle-lid-switch -n -t bool -s true
Restarted the computer, shut the lid. The computer went to sleep! Finally!!!