I'm using Ubuntu Desktop 15.10 on a laptop and it runs an Apache server with SSH as well. When using a GUI, I have the power options set to not sleep at all even when the laptop lid is closed, but recently I stopped the X-System and am now using TTY1 instead to save resources. However, in TTY1, if I close the laptop lid, the computer goes to sleep and prevents the SSH and Apache server from working. Any way to prevent this easily? The realistic answer I bet is to use Ubuntu Server instead (unless I'm mistaken and Ubuntu Server will also sleep on lid close) but I don't exactly want to switch yet unless there's an easy way to switch to it like you can switch from ubuntu-desktop to lubuntu-desktop? Any advice is welcome to prevent the computer from sleeping


Try to edit the /etc/systemd/logind.conf file and modify the line:




Then reboot.


You have to do two simple step in your system to prevent lid close effects:

1) Change “When lid is closed”

Go to System Settings >> Power

– change options for “When a lid is closed ” as per given image to

On battery Power: Do Nothing

When Plugged In: Do Nothing

– same way change “show battery status in the menu bar” to Never

2) Now need to change lock system:

Go to

System Settings >> Brightness & Lock

Now turn off the lock as per given below image

source: ubuntu disable suspend on lid close

  • 3
    TTY1 usually refers to the command line (no GUI) and he did mention that he stopped the X server. So while your answer isn't bad, it does not apply here. – G Trawo Aug 1 '17 at 20:02
  • this is about ubuntu server so no GUI, no system settings. Just command line – Tooniis Aug 1 '17 at 20:36

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.