Ubuntu16.04启用混合休眠

2017-9-11 笑看风云 linux知识

之前在这篇文章中写了如何在openSUSE上面启用混合休眠功能,当初在Ubuntu上面可以通过同样的方法启用混合休眠,今天发现在Ubuntu16.04上面就无法启用混合休眠,网上说是因为systemd和pm冲突.

经过一方努力我发现KDE的休眠按钮调用的systemd的休眠功能,systemd的休眠是通过systemd-hibernate进行休眠,systemd-suspend进行挂起操作,于是我们可以通过修改systemd的休眠服务把休眠功能替换成混合休眠.

打开/lib/systemd/system/systemd-hibernate.service

里面的内容是

  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

[Unit]
Description=Hibernate
Documentation=man:systemd-suspend.service(8)
DefaultDependencies=no
Requires=sleep.target
After=sleep.target

[Service]
Type=oneshot
ExecStart=/lib/systemd/systemd-sleep hibernate

然后把里面的hibernate改成hybrid-sleep,
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

[Unit]
Description=Hibernate
Documentation=man:systemd-suspend.service(8)
DefaultDependencies=no
Requires=sleep.target
After=sleep.target

[Service]
Type=oneshot
ExecStart=/lib/systemd/systemd-sleep hybrid-sleep

然后保存就行了.


现在通过KDE按钮进行休眠就是混合休眠,通过终端执行pm-hibernate依旧是正常休眠.


标签: Linux ubuntu 休眠

et_highlighter51

发表评论:

Powered by emlog sitemap