[Switch] how to enable the Ubuntu sleep mode
We all know that Windows has a sleep mode, and Ubuntu does. In the sleep mode, all the content in the memory can be written to the hard disk when the user leaves temporarily. When the user starts the system next time, it can be directly started to the last saved time status.
For example, you are using LibreOffice to process a document, and you have opened a lot of reference webpages and other files. It's time to get off work, if you come back the next day to find reference pages and files that will affect your writing ideas, you can now sleep Ubuntu when you leave. After Ubuntu sleep, all the unfinished processing tasks are written to the hard disk and then shut down. The last State is automatically called from the hard disk the next time you start the system.
Check if the Ubuntu sleep mode is normal
Now we need to check whether the current Ubuntu allows sleep mode, to allow sleep, we 'd better allocate a SWAP partition of the same size as the memory to the current system (most users will allocate it during system installation ). Use the "Ctrl + Alt + T" shortcut to open a terminal and execute the following command:
sudo pm-hibernate
After the command is executed, Ubuntu will automatically shut down and power off. After the reboot, if everything is normal, we can directly restore to the status when the previous shutdown, which indicates that the current Ubuntu system's sleep mode works normally.
Note: If the status and session before shutdown are not recovered or other errors occur, they may be caused by multiple reasons. You must first troubleshoot the errors before proceeding to the next step.
Enable sleep again
If the above steps confirm that the Ubuntu sleep mode works properly on your system, we can add the "Sleep" button back to our menu.
Run the following command in/Etc/polkit-1/localauthority/50-local.d/CreateCom. ubuntu. enable-hibernate.pklaFile:
sudo vi /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
Write the following content into the above file:
[Enable Hibernate in logind]Identity=unix-user:*Action=org.freedesktop.login1.hibernateResultActive=yes
Ubuntu fully supports the low-power mode from 14.04. You can call the above configuration file. However, if you are using an earlier version of Ubuntu, try the following method:
[Enable hibernate in upower]Identity=unix-user:*Action=org.freedesktop.upower.hibernateResultActive=yes
Note: The preceding statement is not applicable to Ubuntu 13.10.
If you are not sure or want to be safe, you can write both writing methodsCom. ubuntu. enable-hibernate.pklaConfiguration file.
[Enable Hibernate in upower]Identity=unix-user:*Action=org.freedesktop.upower.hibernateResultActive=yes [Enable Hibernate in logind]Identity=unix-user:*Action=org.freedesktop.login1.hibernateResultActive=yes
After the configuration file is modified, We need to restart the system or restart the indicator session:
killall indicator-session-service
After restart, the "Sleep" option will appear.
Hibernation is a very practical function, but it is a pity that it is removed by Ubuntu by default, but we can easily enable the hibernation mode through the method described in this article, if you are interested, try it now.