
In this article, we will be discussing how to fix an issue that some users of the Dell XPS13 9370 laptop have experienced when running Ubuntu 18.04 – the laptop not suspending when the lid is closed.
To fix the issue of Dell XPS13 9370 not suspending on lid close in Ubuntu 18.04, you can try editing the logind.conf
file to enable lid switch suspension, testing the suspend functionality of your system, or creating a custom systemd
service to handle the lid close event. Restart your system after making any changes for them to take effect.
Understanding the Issue
The Dell XPS13 9370 is a popular laptop model among Ubuntu users due to its robust hardware and compatibility with the Linux operating system. However, some users have reported that their laptop does not suspend when they close the lid, a feature that is supposed to save power and extend battery life.
Prerequisites
Before we start, ensure that you have administrative access to your Ubuntu system. You’ll need to use terminal commands, and some of them require superuser (root) privileges.
Solution 1: Editing the Systemd Configuration
The first solution involves editing the logind.conf
file, which is part of the systemd
system and service manager.
- Open a terminal window.
- Enter the following command to open the
logind.conf
file in a text editor:
sudo nano /etc/systemd/logind.conf
- In the opened file, find the lines that read
#HandleLidSwitch=suspend
and#HandleLidSwitchDocked=suspend
. - Remove the “#” at the beginning of these lines to uncomment them. The lines should now read
HandleLidSwitch=suspend
andHandleLidSwitchDocked=suspend
. - Save the file and exit the text editor. In nano, you can do this by pressing
Ctrl+X
, thenY
to confirm saving changes, and finallyEnter
to confirm the file name. - Restart your system for the changes to take effect.
This change tells systemd
to suspend the system whenever the lid is closed, whether the laptop is docked or not.
Solution 2: Testing Suspend Functionality
If the above solution does not work, you should check if your system can suspend properly.
- Open a terminal window.
- Enter the following command to manually suspend your system:
sudo systemctl suspend
If your system does not suspend properly (i.e., the fans stay on, the power light stays on, etc.), it indicates a deeper issue with the suspend functionality on your system.
Solution 3: Creating a Custom Systemd Service
If the above solutions do not work, you can create a custom systemd
service to handle the lid close event. This solution is a bit more involved and requires creating a new script and service file.
- Create a new script file in
/usr/local/bin/
:
sudo nano /usr/local/bin/lid-close.sh
- In the new file, enter the following script:
#!/bin/bash
grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ]
then
sudo systemctl suspend
fi
This script checks if the lid is closed and, if it is, suspends the system.
- Save the file and make it executable:
sudo chmod +x /usr/local/bin/lid-close.sh
- Create a new
systemd
service file:
sudo nano /etc/systemd/system/lid-close.service
- In the new file, enter the following:
[Unit]
Description=Lid close actions
Before=sleep.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/lid-close.sh
[Install]
WantedBy=multi-user.target
This service runs the lid-close.sh
script when the system is about to enter sleep mode.
- Enable the new service:
sudo systemctl enable lid-close.service
- Restart your system for the changes to take effect.
This solution should fix the issue of your Dell XPS13 9370 not suspending when the lid is closed on Ubuntu 18.04. If you’re still experiencing issues, it may be worth reaching out to the Ubuntu community or Dell support for further assistance.
To open a terminal window in Ubuntu 18.04, you can use the keyboard shortcut Ctrl+Alt+T
. Alternatively, you can search for "Terminal" in the applications menu and click on the Terminal icon to open it.
To edit a file using the nano text editor in Ubuntu, you can use the command nano <file_path>
. For example, to edit the logind.conf
file mentioned in the article, you would use the command sudo nano /etc/systemd/logind.conf
. Once the file is open in nano, you can make your changes, save the file by pressing Ctrl+X
, then Y
to confirm saving changes, and finally Enter
to confirm the file name.
To restart your system in Ubuntu 18.04, you can use the command sudo reboot
. This will initiate a system restart. Alternatively, you can click on the power icon in the top-right corner of the screen and choose "Restart" from the drop-down menu.
To make a script file executable in Ubuntu, you can use the command chmod +x <file_path>
. For example, to make the lid-close.sh
script executable, you would use the command sudo chmod +x /usr/local/bin/lid-close.sh
. This command grants execute permissions to the script file.
To enable a systemd service in Ubuntu, you can use the command sudo systemctl enable <service_name>
. For example, to enable the lid-close.service
created in the article, you would use the command sudo systemctl enable lid-close.service
. This command ensures that the service starts automatically at boot.