How to prevent laptop sleeping after reboot/before login

I manage a small fleet of Fedora machines for myself, family, and friends. Some of those are remote; the reverse-tunnel to my server so I can access them even though they are NATted behind their respective home routers. That works well for always-on desktop systems.

However, one of them is a laptop belonging to an elderly friend of the family. She uses it every couple of weeks for web access when she needs a screen bigger than her phone’s. It’s on right now, the lid is closed, she’s logged into it, and it’s had lots of updates since it was last rebooted. I can reboot it, and it will reboot just fine, but after a few minutes it will put itself to sleep, and I can’t wake it up remotely. I’ve got it configured so it doesn’t suspend if she logs in and closes the lid; that’s the current state.

What must I do to keep it from suspending after rebooting regardless of the lid being open/closed and without her logging in? I’d like to keep it up-to-date and reboot it when needed without having to ask her to login.

This laptop is running F39, the login is under lightdm-1.32.0-7 with lightdm-gtk-greeter. Even though it’s running MATE-Desktop, that shouldn’t matter since the situation I’m concerned with is before lightdm ever starts running a particular desktop.

Look at /etc/systemd/sleep.conf. I normally copy this to /etc/systemd/sleep.conf.d/<somename>.conf and edit <somename>.conf by adding lines. This allows updates to change /etc/systemd/sleep.conf while preserving the previous content for reference.

1 Like

That seems to have done it, @gnwiii . Specifically, I created the file /etc/systemd/sleep.conf.d/50-pheonix.conf containing


and rebooted the machine remotely over an hour ago, and it’s running fine with the lid closed.

Thanks very much for the suggestion.

I have a similar file with the content


and my laptop and desktops never suspend nor hibernate.

This action of automatically sleep or suspend after 15 minutes was begun a few releases back and really impacted many who were using a workstation (and other spins) as an always on server and depending upon the system being accessible from remote locations 24/7. It seems you may have encountered the same thing

I do not copy the /etc/systemd/sleep.conf file into the new location since systemd first reads that file to get the default config then automatically parses the files located in /etc/systemd/sleep.conf.d/ and the last config read is the one that is effective.