I have a laptop that has been installed with ubuntu 20.04 that is being used as a server. Thus I want it to never suspend.
By default it automatically suspends when the lid is closed.
As I can only access it via ssh (and there is no X installed anyway) I need to disable it via the CLI.
Multiple sites suggest using
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
This does indeed stop the laptop from suspending while the lid is closed, but results in systemd-logind consuming 100% cpu and continuously logging the following: (multiple times per second)
systemd-logind[514]: Suspending...
systemd-logind[514]: Unit suspend.target is masked, refusing operation.
systemd-logind[514]: Failed to execute suspend operation: Permission denied
Can anyone tell me how to properly disable suspending?