6

I updated from Xubuntu 16.04 beta-2 to 16.04 today. And now I can't shutdown my laptop but I am able to restart. When I try it the GUI way it just logging out.
When I tried

sudo shutdown -h now

I got the following error:

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

Output of /var/log/messages:

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

Output of 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)
  • 1
    I experience exactly the same on my DELL Precision 5510 with a fresh 16.04 installation. Hope, someone comes up with a solution to this issue. – Bunjip Apr 23 '16 at 14:23
  • @Bunjip I've posted some alternatives to the previous answer – marcanuy Jun 19 '16 at 15:59
  • Thnx @marcanuy - I'll keep this in my mind in case I should ever experience this behaviour again. I ended up re-installing 16.04 from scratch and have not had this issue anymore – Bunjip Jun 20 '16 at 7:41
  • This happened to me after installing a bunch of patches with no reboots in-between. I suspect that at least two of them 'didn't play well together'. – Ben Aveling Jan 11 '18 at 2:51
3

I have same problem in my laptop dell Inspiron 5110. After tried this, my computer shutdown normaly

sudo init 0
  • 1
    Even with this command my laptop (ideapad 500 acz) remains on, while shutdown process is complete. – Sharique May 8 '16 at 8:01
  • I experience the same problem with Ubuntu 16.04. My laptop is an Acer Aspire V 11 Touch. sudo init 0 did not work in my case and led to the same error message. sudo poweroff -f suggested by user marcanuy below worked, although drastically. I should also mention that in my case this has been a one-off incident. After powering on the problem with shutdown has not come up once again. – XavierStuvw Aug 24 '16 at 20:34
  • I had this problem. This didn't work for me. – Ben Aveling Jan 11 '18 at 2:48
10

The accepted answer sudo init 0 doesn't work for me in Xubuntu based in Ubuntu 16.04.

While waiting for a patch this is how I can shutdown my laptop:

Using poweroff

  • sudo poweroff -f

-f to force the computer to shutdown without contacting the init system.

Detecting the process that prevents the computer to shutdown

In my case there is always the tty process that blocks the poweroff process. So detecting it, killing the process and starting the systemctl target.

  • ps aux | grep tty

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

  • Kill the process: sudo kill 983

  • Shutdown the computer: First sudo systemctl start poweroff.target and if it fails execute the command again: sudo systemctl start poweroff.target.

Related questions

  • Is the second way preferred? Does shutting down without contacting the init system have risks? – Garrett Dec 29 '17 at 22:50
  • 1
    @Garrett It won't be as safe as using unit, not sure about the risks involved but I never had problems with it, would be interesting to see that in its own question here though. – marcanuy Dec 29 '17 at 23:04
  • 1
    @Garrett, man poweroff has you covered "-f [...] When specified once, this results in an immediate but clean shutdown by the system manager. When specified twice, this results in an immediate shutdown without contacting the system manager. See the description of --force in systemctl(1) for more details" – ndemou Nov 14 '18 at 13:33
1

@marcanuy's answer works for me on Ubuntu 16.04. If you want to use the second method in that answer, here is a script you can put in your .bashrc to do that easily:

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
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.