leo@blog:~$

Prevent Sleep on Lid Close in the Fedora 30 Terminal

One the ideas I’ve been kicking around lately is whether or not to leave OpenMediaVault behind in favor of a vanilla Fedora 30 server on my personal NAS. The main reason for going with OpenMediaVault in the first place was that I wanted an easy to configure Samba server. However, as I’ve adopted Linux full-time outside of gaming, Samba is becoming less and less of a requirement and SFTP is filling in the gap — quite nicely.

The testing phase began when I decided to fire up an older laptop and connect up a couple of USB hard disks to act as my storage. The idea is that I would get all the planning, like scripts and cron jobs, figured out before I ever deploy seriously. I knew I’d run into issues, especially since I’m more of a Debian/Ubuntu guy, but even better, I’ll get reacquainted with the way the Red Hat/Fedora community does things.

I plan on keeping track of my experiences with posts when I have to do things out of the ordinary, and maybe a few of the ordinary things, too.

One of those not-ordinary things has already cropped up. The lid, while open, was preventing the screen from turning off. This wasn’t a big deal, I thought, I’ll just close the lid! So, I try it, head back to my ssh session, and realize it’s died. I check the laptop. Asleep. I open the lid, and it springs back to life! ssh can resume! I realize I have to disable suspend on close, but since this was the server edition, which has no GUI, I had to figure out how to do this from the Terminal. Here’s what I did to accomplish that:

  1. Login and sudo vi /etc/systemd/logind.conf
  2. Find the line HandleLidSwitch=ignore and uncomment it (remove the # at the beginning of the line). If for some reason the line isn’t there, add it to the bottom of the file. Write and quit.
  3. Restart the systemd daemon with sudo systemctl restart systemd-logind

I had honestly expected it to be a bit more involved, but that was it! Close your lid with confidence!

4 thoughts on “Prevent Sleep on Lid Close in the Fedora 30 Terminal

  1. Thanks heaps. I also thought this would be quite difficult and had been putting off even looking. A quick search on the net came up with your post , clear and concise, and bingo. I can close the screen.
    So again, thanks heaps.
    I don’t suppose you have investigated laptop wifi ( wlp2s0 in my case ) being “unavailable” when using either nmcli or nmtli ?
    eth0 ( eps

    1. So glad you got some use out of it. Was driving me crazy until I figured it out.

      If nmcli doesn’t see it, then it’s considered “unmanaged.” Lots of factors here, but this is a good resource to start with.

      https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/getting-started-with-nmcli_configuring-and-managing-networking

      I’ll consider writing a post about how to let Network Manager handle connections.

Leave a Reply

Your email address will not be published. Required fields are marked *