In this guide, we will be showing you how to suspend your Ubuntu operating system.
By suspending Ubuntu, you effectively put the operating system to sleep by moving running programs to RAM. After the system moves everything into memory, the computer and any attached peripherals are put into a lower power consumption mode.
The advantage of using suspend is that you can save power and be able to come back to your computer where you left it.
Due to how suspend works, your system must remain powered at all times. If you happen to lose power, you will lose your session and any unsaved data. This is because RAM requires power to maintain the data stored within it.
The alternative to suspending Ubuntu is hibernating. Hibernating works differently from sleeping by storing your session on your hard drive instead of RAM. Due to this crucial difference, it allows your device to power off completely and also means your session should survive a power loss.
If you are wondering why you would use suspend over hibernate, there are a couple of reasons. Your device is likely to have issues restoring from a hibernation than a suspension. Additionally, restoring from a suspension is significantly faster.
Over the following two sections, we will show you how to suspend Ubuntu using both the desktop and the terminal.
Suspending Ubuntu from the Desktop
If you are using Ubuntu Desktop, suspending your device is a super straightforward process.
You can suspend the device in just a few short clicks. Please note that these steps were written for Ubuntu 22.04, but the position of these elements should be roughly the same for all releases.
1. First, you must bring up the actions menu by clicking the top-right corner of the screen.
2. With the actions menu open, click the “Power Off / Log Out
” option.
3. You should now be presented with a few different options.
To suspend Ubuntu, all you need do is click the “Suspend
” option. Your system will be immediately put to sleep.
4. Now, if you wait a few minutes, your Ubuntu system should be suspended.
It will remain suspended until it loses power or you press a button on your keyboard or mouse. Waking from sleep can take a few minutes as the system needs to restore itself from your RAM.
Using the Terminal to Suspend Ubuntu
Using the terminal, you can also easily suspend the Ubuntu operating system. All it requires is a simple single command.
If you are using Ubuntu Desktop, you must open the terminal before you put the device to sleep. You can easily bring up the terminal by pressing CTRL + ALT + T.
Please note that if you are sleeping your Ubuntu device over SSH, you must have Wake-On-LAN enabled. Otherwise, you would need a physical connection to wake the device.
1. Since Ubuntu moved to Systemd with the release of Ubuntu 16.04, suspending your system has been made simpler and safer.
Additionally, you don’t need to be the superuser to sleep your device.
To suspend your Ubuntu system from the terminal, you only need to run the following command.
systemctl suspend
2. Your system should now suspend. This process can take a few minutes as it moves everything it requires to RAM.
Once suspended, any physical input should wake the device back up. If you have enabled “Wake-on-LAN
“, you can also send a magic packet to wake your device from its sleep.
Conclusion
At this stage in the guide, you should now understand how to suspend/sleep the Ubuntu operating system.
As discussed in this guide, suspending your device puts it into lower power consumption mode. Everything required is kept within RAM until you wake it again.
Please comment below if you have any questions about putting your device to sleep.
You can also check out our many other Ubuntu tutorials. These tutorials will help you learn more about using Ubuntu.
If by any means Ubuntu 22.04 LTS system does not SUSPEND/SLEEP in any/all of the following cases and battery drains fully even with 100% charge within few hours→
1. By clicking Suspend from Power Off/Log Out options from top right hand corner options
2. By closing lid (Power settings already says so)
3. By using another power settings → suspend if the power button is pressed
4. By using command from terminal – systemctl suspend
(In all the above cases the Ubuntu system failed to suspend or sleep. Never had this issue with the same hardware (read Dell Latitude Laptop) with Ubuntu 18.04 LTS)
5. Even tried editing /etc/systemd/logind.conf by doing uncomment of the following lines –
1. HandleSuspendKey=suspend
2. HandleLidSwitch=suspend
3. HandleLidSwitchDocked=suspend/ignore (tried both)
4. restart
still no success!
Then try the solution as in my case:
1. Checked Gnome Tweaks (install it if not installed) for the tab General
2. The option Suspend when lid is closed was ON, I toggled it OFF
3. And Bingo! All of the above four options (1-4) started working.
4. In fact I reverted all the changes on /etc/systemd/logind.conf → restarted the system and SUSPEND still WORKED