Ubuntu Stop Suspend

By default, when Ubuntu Server is installed on a laptop. The system will then enter suspend mode when the lid is closed. Below are steps to allow the Ubuntu server to continue working even when the lid is closed.

A fantastic way to test this is to start a continuous ping from another computer with the laptop server. If you close the lid and the ping stops then the changes below will need to be implemented.

Stop Suspend when the Laptop lid is closed on Ubuntu Server

By default, Ubuntu Server will suspend when the laptop lid is closed. If this is the case. Then we will need to go into the Ubuntu Server’s OS files and change its configuration.

First type the following into the CLI (Command Line Interface).

sudo nano /etc/systemd/logind.conf

Use the arrow keys to move down.
Then change the following to ignore by removing the #’s at the beginning of the lines.

handlelidswitch=ignore
handleswitchdocked=ignore
handleSuspendKey=ignore

Save and close the file: After making these changes, save the file and exit.
CTRL+o to save.
Then Y and press Enter to confirm the save.
CTRL+X to exit.

Restart systemd-logind service: To apply the changes, restart the systemd-logind service:

sudo systemctl restart systemd-logind

Test the changes: Now, to test if the changes stuck. Try closing the laptop lid. Then check if you can still ping the laptop from another computer. The services should remain active, and the laptop should not suspend or hibernate.

PWJ features a dedicated collection of articles focused on Ubuntu Server. Designed to help both beginners and experienced users learn how to set up, manage, and optimize their servers.

View my list of articles below!

Similar Posts

  • Ubuntu Server Programs

    This is list of programs I use on my Ubuntu Servers with some very basic information. Some of my favorite and most useful Ubuntu Server programs include Network-Tools, Ranger, TMUX, and CMUS for efficient terminal-based management. Network-Tools helps with quick network diagnostics,…

  • Ubuntu Samba Server

    If you need to create a shared drive on an Ubuntu Server that Windows and Linux users can access, SAMBA is the perfect solution. This article will guide you through installing SAMBA, configuring a shared folder, and setting up user permissions. Step…

  • Two-Line Prompt

    To have your terminal show the input command on its own line, with your username and the current working directory (PWD) on a separate line, you will need to modify the shell prompt (PS1) in your terminal configuration. Here’s how you can…

  • Ticker for Terminal

    The Ticker program is a powerful command-line tool. It tracks real-time stock and cryptocurrency prices directly within the Ubuntu Server terminal. It allows users to monitor market activity without needing a graphical interface. This makes it ideal for server environments or lightweight…