I have installed Ubuntu Server 14.04 on a laptop. I want to change some power management options from the terminal (I don't have GNOME or a GUI installed, and I don't want to either). The current behavior is:

  1. The laptop goes to sleep/hibernate, causing the server to stop working, when I close the lid. Ideally, I'd be able to close the lid, have the screen turn off, but still have the server working.
  2. The laptop turns off the screen after some short time of inactivity (which is fine, I just list this to be complete). After some hours of inactivity, the laptop shuts down completely by itself, even when plugged in.
  3. A brief press of the power button shuts down the system. I want to avoid this, as it is quite easy to press the power button: I'd rather have to shut it down explicitly via the terminal.

I have tried some solutions found on askubuntu, but none of them works. Specifically, I have removed acpid from the system. Weirdly enough, this didn't change anything. After that, I commented out the relevant lines in /etc/acpi/events/powerbtn. Again, this didn't change anything: the system still shuts down after a brief touch of the power button. Acpid no longer runs, but it still seems like /etc/acpi/powerbtn.sh is executed (which was the action for powerbtn). I have looked at the ubuntu manpage entry for acpi to try to figure out if it was still running somehow, but I'm not experienced enough to understand it completely.

Any help would be welcome.


I found my solution in this answer here. In /etc/systemd/logind.conf, I edited the lines




And then reboot the system.

The laptop shutting down overnight was actually something else. I used a power socket in a weird place for the server, to prevent the plug from being accidentally pulled. The socket turned out to be controlled by the same button that I use to switch the lights on and off. When I switched the lights off at night, I denied power to the server. In the morning, I would turn on the light, check the server, found out that it turned off again and boot it (without a problem because the power would work again after switching on the lights).


I solved this issue on my "laptop server". In addition to the steps described in this answer, I had to complete some additional steps:

Be sure to un-comment the settings by removing the leading # !

There are a number of related settings, including importantly, HandleLidSwitchExternalPower, which if you have your laptop plugged in, must also be set.

# Additional power options I have not yet tested:

# Main items I set to ignore for lid:

# More Additional items I have not yet tested:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.