Prevent Laptop Screen from Turning Off When Lid is Closed on Debian 12 Server
If you are using Debian 12 Server on a laptop, you may have noticed that the screen turns off when you close the lid. This is a default behavior designed to save power, but it may not always be desirable, especially if you are using your laptop as a server and need to access it remotely. In this article, we will guide you through the steps to prevent the laptop screen from turning off when the lid is closed on Debian 12 Server.
Step 1: Open Terminal
To begin, open the Terminal on your Debian 12 Server. You can do this by pressing Ctrl + Alt + T on your keyboard or by searching for "Terminal" in the application menu.
Step 2: Edit the Logind Configuration File
Next, we need to edit the logind.conf file which contains the settings for handling various power management events. In the Terminal, type the following command to open the file in a text editor:
sudo nano /etc/systemd/logind.conf
You will be prompted to enter your password. After entering the password, the logind.conf file will open in the Nano text editor.
Step 3: Modify the Lid Switch Action
Within the logind.conf file, you will find various configuration options. Look for the line that starts with #HandleLidSwitch. By default, this line is commented out, which means the lid switch action is not defined.
To prevent the screen from turning off when the lid is closed, remove the '#' symbol at the beginning of the line and change the value to ignore. The modified line should look like this:
HandleLidSwitch=ignore
Once you have made the changes, press Ctrl + O to save the file and then press Ctrl + X to exit the Nano text editor.
Step 4: Restart the Systemd-Logind Service
After modifying the logind.conf file, we need to restart the systemd-logind service for the changes to take effect. In the Terminal, type the following command:
sudo systemctl restart systemd-logind
This will restart the service and apply the new configuration.
Step 5: Verify the Changes
To verify that the changes have been applied successfully, close the lid of your laptop. The screen should remain on even when the lid is closed. You can open the lid again to check if the screen turns back on.
Conclusion
By following these steps, you can prevent the laptop screen from turning off when the lid is closed on Debian 12 Server. This can be particularly useful if you are using your laptop as a server and need to access it remotely without any interruption. Remember that modifying system configuration files should be done with caution, and it's always a good idea to create a backup before making any changes.
References
| Reference | Description |
|---|---|
| Debian | https://www.debian.org/ |
| Nano text editor | https://www.nano-editor.org/ |
| Systemd | https://systemd.io/ |