Ubuntu启用休眠hibernate

来源:互联网 发布:七格格淘宝 编辑:程序博客网 时间:2024/06/07 20:07

Ubuntu默认关闭了休眠模式,因为休眠模式很实用,我们可以通过设置打开休眠模式。

一、测试Ubuntu系统是否支持休眠模式

sudo pm-hibernate

执行该命令后,系统会自动关闭断电,重新打开系统后,如果能恢复到该命令执行前的状态则表明该系统支持休眠模式。下面我们就通过设置启用Ubuntu的休眠模式。


二、创建设置文件并写入内容

在/etc/polkit-1/localauthority/50-local.d/目录中创建一个名叫com.ubuntu.enable-hibernate.pkla文件。

sudo vi /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

并在该文件中写入如下内容:

[Enable Hibernate in logind]Identity=unix-user:*Action=org.freedesktop.login1.hibernateResultActive=yes

如果是Ubuntu14.04之前的版本,可以在com.ubuntu.enable-hibernate.pkla文件中写入下面的内容:

[Enable hibernate in upower]Identity=unix-user:*Action=org.freedesktop.upower.hibernateResultActive=yes

当然保险起见,可以将两份内容都同时写入com.ubuntu.enable-hibernate.pkla文件中:

[Enable Hibernate in logind]Identity=unix-user:*Action=org.freedesktop.login1.hibernateResultActive=yes[Enable hibernate in upower]Identity=unix-user:*Action=org.freedesktop.upower.hibernateResultActive=yes

保存文件:

:wq!

三、重启indicator或者重启系统

killall indicator-session-service

若要重启系统可使用命令:

sudo reboot

此时,右上角的【休眠】已经启用。

0 0