Ubuntu 16.04 doesn't shut down after suspend or hibernate
Forcing hibernate to power off the machine:
After looking around a long time for an answer to this that actually addressed the issue (not related ones), I found a tip here which got the job done for me:
Create a file in the pm
config directory:
sudo vim /etc/pm/config.d/hibernate_mode
that sets the variable HIBERNATE_MODE
like so:
HIBERNATE_MODE="shutdown"
After doing this, hibernate powered down the machine on completion like expected. An explanation for what setting HIBERNATE_MODE
does is in the manual for pm-hibernate:
Default method to power down the system when hibernating. If not set, the system will use the kernel default as a default value. Check /sys/power/disk for valid values. The default value will be surrounded by [square brackets].
My default in that file was platform
. Setting the variable above to shutdown
overrides this, and gets what we want happening.
Related information and tips for getting hibernate to work correctly:
As for those "related issues" everyone seems to have with hibernating, quick debugging tips:
Check that the command
sudo pm-hibernate
actually does something. If not, none of these other tips will make any difference. If it doesn't work, ensure 1) the size of your swap partition is greater than that of your RAM and 2) secure boot is disabled in your BIOS.-
Only once that command works, look at integrating hibernate into your system as you please. A couple of common ones:
-
Add hibernate to the Ubuntu menu: This seems to be the best answer to me. Official documentation also has a slightly different version.
Note: once hibernate is added to the Ubuntu menu, you may also need to fix the alternative call tosudo systemctl hibernate
. Apparently, (at least for Ubuntu 16.04) the Ubuntu menu option callssudo systemctl hibernate
instead ofsudo pm-hibernate
.systemctl hibernate
was fixed for me by adding the following content to file/etc/systemd/sleep.conf
:[Sleep]
HibernateMode=shutdownIf the file doesn't exists yet, you can create it. More info here.
Change the behaviour of the power button (by default it displays in interactive menu): To change it to directly hibernate, or shutdown you need to modify the associated gsettings entry. A lot of other answers go through the GUI way if that floats your boat. To see the available options use
gsettings range org.gnome.settings-daemon.plugins.power button-power
-
I had the same problem after upgrading from 15.10 to 16.04:
- Closing the lid did not do anything
- Manually suspending with the menu item in the system tray resulted in a half suspended state with the only way out to reset the system.
I solved these issues by
- upgrading the kernel to 4.4.8 (after this suspend from menu worked for me)
- Adding the line
HandleLidSwitchDocked=suspend
to /etc/systemd/logind.conf (wich made the lid switch to work again).
I think both issues are bugs that should be fixed (https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1574120).
By seeing your last image and EDIT 2, I can understand that Ubuntu can't find a Swap Partition on your system. So I suggest you should create a Swap partition equal to or larger than your RAM size, and try again by running
sudo pm-hibernate
You can create swap partition using GParted, run this to install it
sudo apt-get install gparted