Saturday, January 7, 2023

Disabling sleep on Ubuntu 22.04

I just upgraded one of my Linux servers to Ubuntu 22.04 LTS, from 21.10, which was already at end of life.  The upgrade process went fairly well, and since I needed to reboot the computer (and there were already interruptions of the VMs running on this machine), I decided to start upgrading the software on some of these machines.

While I was going through this process, everything became unresponsive, both the host server and the VMs, and these connections were closed.  I walked to the Linux host server, and I noticed that the machine was asleep.  Once I pushed the power button, the machine woke back up, and I was able to connect again.

I wanted to find a way that I could prevent the server from going to sleep.  The Ubuntu sleep service allows this behavior to be controlled.

I used the following commands to disable sleep on the Ubuntu server:

systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
Once I ran that command, I verified that sleeping would be "masked" with: 

systemctl status sleep.target

The output indicates that sleeping is masked:




No comments:

Post a Comment

Making Your Home Automation Work for You and Your Guests: A Guide to Smart Home Guest Management

Home automation is a fantastic way to make your home more comfortable and reduce the amount of manual work you need to do. Automating your l...