While setting up Ubuntu 20.04 LTS on a tablet/laptop (Medion Akoya), I faced a very strange issue. I wanted to install Ubuntu via a live USB stick.
Once the Ubuntu live system was booted completely, the laptop went to sleep. I was able to wake it by pressing the power button, but after some random 20-30 seconds, it would suspend again, over and over. Within a few cycles of going to sleep and waking the PC again, I was able to run a command on the shell.
The output of
dmesg let me know that it was an issue connected to
systemd always suspending my machine. After some research, I found a solution to this problem. The core problem is that
systemd wants to suspend your PC because it thinks the laptop lid is closed.
There is a way to prevent this (by editing the file
/etc/systemd/logind.conf), but unfortunately this was not possible in my live environment, as it requires a reboot. Rebooting the live system will discard all changes to the file system and the error would persist.
Fortunately, DELL Austria provides a solution to this problem. Run the following commands in a terminal, and systemd will stop hibernating/suspending your device:
systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
After successfully installing Ubuntu on the PC, the error came back, obviously, as the issued command was only a temporary fix. But as the PC was now installed with Ubuntu 20.04, i could go the normal way of preventing the laptop-lid-close-bug.
I edited the file
sudo nano /etc/systemd/logind.conf
and uncommented the following line, by removing the leading hash:
Here it says
suspend, which is not the preferred behaviour, therefore I changed it to
Save the file by pressing
CTRL+O and exit from the editor by pressing
CTRL+X and reboot the PC.