I have a brand new 20.04LTS Laptop that keeps going to sleep. When it goes to sleep, it does not wake up without a forced reboot (holding the power button).
I have disabled sleep and hibernate with this command:
systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
It's been properly disabled, according to this output.
● sleep.target
Loaded: masked (Reason: Unit sleep.target is masked.)
Active: inactive (dead)
● suspend.target
Loaded: masked (Reason: Unit suspend.target is masked.)
Active: inactive (dead)
● hibernate.target
Loaded: masked (Reason: Unit hibernate.target is masked.)
Active: inactive (dead)
● hybrid-sleep.target
Loaded: masked (Reason: Unit hybrid-sleep.target is masked.)
Active: inactive (dead)
It does not go to sleep after a specific amount of time. For example, it stayed powered on with the lid closed for a 5 hour car trip and unplugged the entire time. However, within 2 hours of plugging it in it went to sleep. Other times, it will go to sleep within 30 minutes of being unplugged. The longest I've had it go without going to sleep is about 36 hours.
How else can I prevent Ubuntu 20.04LTS from going to sleep or hibernating, especially when it is plugged in?