Prevent suspend when lid close in Fedora 40


I trying out fedora 40, it’s awesome so far.
I usually close my laptop’s lid and let Youtube video or podcast play in the background.
I can’t do that anymore, when the lid is closed the laptop goes to suspended state.
I can’t prevent that anymore, I used to uncomment directives in /etc/systemd/logind.conf
That config file doesn’t even exist in F40 so I had to make it and add the following:


Like it is mentioned here That solution doesn’t work anymore.

I tried out sudo systemctl mask it works, but it’s not ideal, I want to be able to put my laptop to suspend state when It need to be. Not disable that option completely.

There also another option which works temporarily:
systemd-inhibit --what=handle-lid-switch zenity --info --text='Lid switch suspend blocked while open' --ok-label=Close

This is not ideal as well. I have to use the terminal each time I want to prevent laptop doing to suspended state when I close the lid.

Also, I couldn’t find the gsettings in F40 that control the lid action mentioned here

Is there simple user friendly solution in fedora 40 to prevent the laptop doing to suspended state when the lid is closed?

Thank you very much for your help!

Software Information:

  • Firmware Version: 1.60
  • OS Name: Fedora Linux 40 (Workstation Edition)
  • OS Build: (null)
  • OS Type: 64-bit
  • GNOME Version: 46
  • Windowing System: Wayland
  • Kernel Version: Linux 6.8.7-300.fc40.x86_64

I believe that config file was moved to /usr/lib/systemd/logind.conf.

I don’t have a laptop to test currently, but you should be able to do this by changing the #HandleLidSwitch=suspend line in that file to HandleLidSwitch=ignore.

1 Like

Thank you very much for your speedy reply!
I found that config file in the location you mentioned, did the modification, reboot but didn’t seem to work.
What worked is that I copied that file logind.conf into a folder I created in/etc/systemd/logind.conf.d/ This procedure is mentioned in config file itself.
I find it a bit complicated for a simple functionality. I Hope there would be a simple gui to do this!
This kinda of tinkering is what put some people off Linux adoption.

Thank you again for help!


Thank you very much for your help, Fred Go, people like you the world needs.

I installed it on my notebook to do some labs and I had the same problem related to the notebook lid, but your solution made me dream.

1 Like

Was that in the release notes :thinking: That seems like something that would be important to know.

I have this one-liner for F39 Server:

sudo mkdir -p '/etc/systemd/logind.conf.d' && echo -e "[Login]\nHandleLidSwitch=ignore" | sudo tee '/etc/systemd/logind.conf.d/99-laptop-server.conf' > '/dev/null'

1 Like