The lid closes, the laptop stays awake
You close the lid on your Fedora laptop. The screen goes dark. You pack it into your bag. Ten minutes later, you feel heat radiating through the fabric. The battery is draining. The fans are still spinning. The system ignored the lid switch.
This happens because systemd-logind treats the lid event as a request, not a command. It checks for inhibitors before suspending. An inhibitor is a process that signals it is performing critical work. A running container, a virtual machine, or a media player can hold an inhibitor. Fedora's default configuration respects these inhibitors to prevent data loss. The result is a laptop that refuses to sleep when you expect it to.
You can override this behavior. The fix involves creating a drop-in configuration for logind. This tells the system to suspend regardless of inhibitors, or to suspend under specific power conditions.
How systemd-logind decides what to do
systemd-logind manages seats, sessions, and users. It listens for hardware events from the kernel. When you close the lid, the ACPI subsystem sends a button/lid event. logind receives this event and consults its configuration to decide the action.
The configuration defines three distinct scenarios:
- LidSwitch: The behavior when the lid closes on battery power.
- LidSwitchExternalPower: The behavior when the lid closes while plugged into AC power.
- LidSwitchDocked: The behavior when the lid closes while the laptop is docked.
Fedora ships with conservative defaults. LidSwitch is usually set to suspend. However, LidSwitchExternalPower often defaults to ignore. This means your laptop will sleep when you close the lid on battery, but will stay awake when plugged in. This default exists to support users who run their laptops as desktop replacements with external monitors. If you are not using a dock, this default causes confusion.
logind also checks for inhibitors. If any process has registered an inhibitor for sleep, logind blocks the suspend action. This prevents the system from sleeping while a container is writing to disk or a VM is running. You can see active inhibitors with loginctl list-inhibitors. If the list is not empty, logind will refuse to suspend unless you configure it to ignore inhibitors.
Convention aside: Configuration files in /etc/ are for user modifications. Files in /usr/lib/ ship with packages. Never edit files in /usr/lib/. Your changes will vanish on the next package update. Create drop-ins in /etc/systemd/system/ to persist safely.
Override the default behavior
Create a drop-in configuration to force suspend on lid close. This overrides the package defaults and applies to all three power states.
Here is how to create the drop-in directory and write the configuration file.
# Create the drop-in directory if it does not exist.
# systemd merges all .conf files in this directory with the main logind.conf.
sudo mkdir -p /etc/systemd/system/logind.conf.d
# Write the override configuration.
# The 99- prefix ensures this file loads after package defaults, taking precedence.
# Using tee with a here-doc avoids issues with echo and special characters.
sudo tee /etc/systemd/system/logind.conf.d/99-lid-suspend.conf > /dev/null << 'EOF'
[Login]
# Suspend when lid closes on battery power.
LidSwitch=suspend
# Suspend when lid closes while plugged into AC power.
LidSwitchExternalPower=suspend
# Suspend when lid closes even if docked.
LidSwitchDocked=suspend
EOF
Reload the systemd-logind service to apply the changes. Do not restart the service. Restarting kills the service and may drop active sessions. Reloading applies configuration changes safely.
# Reload logind to apply changes without rebooting.
# reload applies config changes; restart kills and restarts the service, which may drop active sessions.
sudo systemctl reload systemd-logind
Reload the service before testing. The configuration does not apply to sessions that are already active until the daemon picks up the new settings.
Handle inhibitors and containers
If you run Podman, Docker, or QEMU/KVM, you likely have inhibitors active. Even with LidSwitch=suspend, logind may still block suspension if an inhibitor is present. You need LidSwitchIgnoreInhibited.
Add LidSwitchIgnoreInhibited=yes to the configuration. This forces suspension even when inhibitors exist. Use this carefully. If a container is writing to disk, forcing suspend might cause corruption. Most modern storage stacks handle suspend safely, but the risk exists. If you run critical workloads, ensure your applications support suspend or use LidSwitchIgnoreInhibited only when you trust the background processes.
Update the configuration file to include the inhibitor override.
# Add this line to the [Login] section in 99-lid-suspend.conf.
# This overrides inhibitors and forces suspend when the lid closes.
LidSwitchIgnoreInhibited=yes
Reload logind again after editing the file. The daemon does not watch for file changes automatically. You must trigger the reload manually.
# Reload logind to pick up the new inhibitor setting.
sudo systemctl reload systemd-logind
Check for active inhibitors to understand what is running. This helps you decide if ignoring inhibitors is safe.
# List all active inhibitors.
# This shows which processes are preventing sleep.
# Columns: who, what, where, why.
loginctl list-inhibitors
If you see podman or qemu in the output, those processes are holding the inhibitor. The why column explains the reason. If the reason is vague, check the process logs.
Verify the inhibitor override is active.
# Check the active property value.
# This confirms logind read the drop-in file correctly.
loginctl show -p LidSwitchIgnoreInhibited
The output should be LidSwitchIgnoreInhibited=yes. If it shows no, the configuration file has a syntax error or the drop-in is not loading. Check the file permissions and syntax.
Verify the configuration
Confirm the lid switch behavior is set correctly. You can query logind properties directly.
# Check the active property value for each lid setting.
# This confirms logind read the drop-in file correctly.
loginctl show -p LidSwitch
loginctl show -p LidSwitchExternalPower
loginctl show -p LidSwitchDocked
All three should return suspend. If any return ignore, the configuration did not apply. Verify the drop-in file exists and contains the correct keys.
Test the lid switch. Close the lid and wait a few seconds. The system should suspend. Open the lid to wake it. If the system does not wake, the issue is likely hardware or kernel-related, not logind. Check the kernel logs for wake-up failures.
# Check logind logs for errors or inhibitor messages.
# The -u flag filters for the unit. The -e flag jumps to the end.
journalctl -xeu systemd-logind
Look for messages containing Inhibitor or Refusing. If you see Refusing to sleep because inhibitors are present, the inhibitor override is not working. Verify LidSwitchIgnoreInhibited=yes is set and the service was reloaded.
If the lid switch is broken, acpi_listen can help diagnose the hardware.
# Monitor ACPI events to verify the hardware sends a signal.
# Close the lid and watch for button/lid close events.
sudo acpi_listen
If you close the lid and see no output, the hardware switch is faulty or the kernel driver is missing. No amount of logind configuration will fix a broken switch. Check the kernel bugzilla or hardware compatibility lists.
Run journalctl -xe first. Read the actual error before guessing.
Common pitfalls and error patterns
The lid closes, but the screen stays on. This usually means LidSwitchExternalPower is set to ignore and you are plugged in. Check the property with loginctl show -p LidSwitchExternalPower.
The lid closes, but the system does not suspend. Check loginctl list-inhibitors. If the list is not empty, an inhibitor is blocking sleep. Add LidSwitchIgnoreInhibited=yes to the configuration.
The system suspends but does not wake. This is a kernel or firmware issue. logind successfully sent the suspend command. The failure happens deeper in the stack. Check journalctl -k for kernel errors related to suspend or resume. Update the kernel and BIOS if possible.
The configuration changes do not persist after reboot. You edited a file in /usr/lib/systemd/. Stop editing files in /usr/lib/. Use drop-ins in /etc/systemd/system/ instead.
The drop-in file is ignored. Check the filename. It must end in .conf. Check the directory. It must be /etc/systemd/system/logind.conf.d/. Check the syntax. The section header must be [Login]. Keys must be valid. Invalid keys cause logind to log an error and skip the file. Check journalctl -u systemd-logind for syntax errors.
Trust the package manager. Manual file edits drift, snapshots stay.
Choose the right lid behavior
Use LidSwitch=suspend when you want the standard sleep behavior on battery power.
Use LidSwitchExternalPower=suspend when you want the laptop to sleep on AC power just like on battery.
Use LidSwitchExternalPower=ignore when you run the laptop as a desktop with a monitor and do not want it sleeping when closed.
Use LidSwitchDocked=suspend when you want the laptop to sleep even when docked.
Use LidSwitchDocked=ignore when you use a dock and want the system to stay running when the lid is closed.
Use LidSwitchIgnoreInhibited=yes when you run containers or VMs and want the lid to force sleep regardless of background processes.
Use LidSwitch=lock when you prioritize security and want the screen to lock but the system to stay awake.
Use LidSwitch=poweroff when you want the laptop to shut down completely upon closing the lid.
Snapshot the system before the upgrade. Future-you will thank you.