更新到16.04后无法关闭xubuntu

我今天从Xubuntu 16.04 beta-2更新到16.04。 现在我无法关闭我的笔记本电脑,但我可以重新启动。 当我尝试GUI方式它只是注销。
当我尝试

sudo shutdown -h now 

我收到以下错误:

 Failed to start poweroff.target: Transaction is destructive. See system logs and 'systemctl status poweroff.target' for details. 

输出/var/log/messages

 tail /var/log/messages tail: cannot open '/var/log/messages' for reading: No such file or directory 

输出systemctl status poweroff.target

 ● poweroff.target - Power-Off Loaded: loaded (/lib/systemd/system/poweroff.target; disabled; vendor preset: Active: inactive (dead) Docs: man:systemd.special(7) 

我在我的笔记本电脑戴尔Inspiron 5110有同样的问题。试过这个,我的电脑关机正常

 sudo init 0 

在Ubuntu 16.04中的Xubuntu中,接受的答案sudo init 0对我不起作用。

在等待补丁时,我可以关闭笔记本电脑:

使用poweroff

  • sudo poweroff -f

-f强制计算机关闭而不联系init系统。

检测阻止计算机关闭的进程

在我的情况下,总是存在阻止断电过程的tty过程。 因此检测它,杀死进程并启动systemctl目标。

  • ps aux | grep tty

    根983 0.0 0.0 15408 1128? Ss 11:49 0:00 / bin / systemd-tty-ask-password-agent –wall

  • 杀死进程: sudo kill 983

  • 关闭计算机:首先sudo systemctl start poweroff.target ,如果失败则再次执行命令: sudo systemctl start poweroff.target

相关问题

  • Debian不会关闭(无法启动poweroff.target:事务具有破坏性)
  • Ubuntu 16.04无法关闭电源:poweroff.target已禁用

@ marcanuy的答案适用于Ubuntu 16.04。 如果你想在该答案中使用第二种方法,可以在.bashrc中放入一个脚本来轻松完成:

 shutdown_workaround() { TTY_PID=$(ps aux | grep -v grep | grep -Po "root +\K[0-9]+(?= .*systemd-tty-ask-password-agent)") sudo kill $TTY_PID sudo systemctl start poweroff.target || sudo systemctl start poweroff.target }