If your Ubuntu 24.04.1 LTS laptop powers off when the lid is closed, it is likely due to the power management settings. By default, Ubuntu may be set to suspend or power off instead of hibernating when the lid is closed. Another possible reason is a misconfiguration in the logind.conf file, which controls lid-close behaviors.

How to Prevent Ubuntu 24.04.1 LTS from Powering Off

To fix this issue:

  • Open a terminal and edit the logind.conf file:
    sudo nano /etc/systemd/logind.conf
  • Locate the line #HandleLidSwitch=ignore and change it to HandleLidSwitch=ignore (remove # to uncomment).
  • Save and exit, then restart the system using:
    sudo systemctl restart systemd-logind

Conclusion

The Ubuntu 24.04.1 LTS laptop powering off when the lid is closed can be fixed by adjusting power settings. Modifying the logind.conf file helps prevent unintended shutdowns.