我正在尝试使用来自i3的快捷方式进行hibernate。我的i3配置文件如下所示:
14 # Keyboard friendly exit
15 set $exit exit: [l]ock, [e]logout, [h]ibernate, [r]eboot, [s]hutdown
16 mode "$exit" {
17 bindsym h exec "i3lock; systemctl hibernate"; mode "default"
18 bindsym l exec i3lock -c 000000; mode "default"
19 bindsym e exec i3-msg exit
20 bindsym r exec systemctl reboot
21 bindsym s exec systemctl poweroff
22 bindsym Escape mode "default"
23 bindsym Return mode "default"
24 }当我在正确的模式下按h时,我的PC会锁定自己,但不会休眠。我试过用systemctl hibernate代替sudo systemctl hibernate,但也不起作用。
在终端上,我可以sudo systemctl hibernate到hibernate,而systemctl hibernate将提示我使用此消息进行身份验证。
Failed to hibernate system via logind: Access denied
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'hibernate.target'.
Authenticating as: $User,,, ($user)
Password: 我能够正确地从i3关闭和重新启动,但不是hibernate。
编辑:我有一个交换分区和hibernate函数,如果用sudo sytemctl hibernate命令行完成的话。
我的小弟弟看起来是这样的:
# Swap
UUID=424242-4242-4242-4242-4242424242 none swap sw 0 0发布于 2020-10-01 16:59:17
您能不能在systemctl hibernate上为nopasswd在sudoers中创建一个新行,看看您的进展如何?我已经将hibernate映射到Alt + Shift + F4,并将我的id配置为运行没有passwd的sudo systemctl hibernate
which systemctlsudoers档案:
midway ALL=(ALL) NOPASSWD: #placeholder# hibernatei3配置:
bindsym Mod1+Shift+F4 exec sudo #placeholder# hibernate希望这更容易理解。
https://askubuntu.com/questions/1279120
复制相似问题