0

Since I am new and cannot comment on this yet, I'll open a new question...

The question is about Systemd/Systemctl not allowing one to shutdown or reboot.

The answer I wanted to comment on is saying that you can simply type:

systemctl enable poweroff.target

to resolve the issue. This however, at least on my system, does not work.

As you can see in the below attempt, I was logged in (sudo su) to root, and even root isn't allowed to reboot:

root@Vidar:/home/bokkie# systemctl enable poweroff.target
root@Vidar:/home/bokkie# shutdown -r now
Failed to start reboot.target: Transaction is destructive.
See system logs and 'systemctl status reboot.target' for details.
root@Vidar:/home/bokkie# 

The only option I seem to have to reboot is to do a hard (longer power button press) shutdown.

Can I replace systemd, or somehow convince systemctl that shutting down/rebooting is allowed? If yes, how?

3
  • Is this Ubuntu 14.04? Then the way to shut it down is sudo shutdown -p now. Your running systemd which is for Ubuntu 16.04 and above Sep 25, 2017 at 12:27
  • I'd love for the answer to be so simple... root@Vidar:/home/bokkie# shutdown --help [...] -H --halt Halt the machine -P --poweroff Power-off the machine -r --reboot Reboot the machine [...] root@Vidar:/home/bokkie# shutdown -P now [...] root@Vidar:/home/bokkie# I don't want to power off. I want to reboot. And no, it's still not working...
    – Bokkie
    Sep 25, 2017 at 12:34
  • 2
    I don't know what you mean by simple, but systemctl doesn't exist on Ubuntu 14.04 Sep 25, 2017 at 12:36

2 Answers 2

1

In Ubuntu 16.04

systemctl enable poweroff.target

creates a symlink at /etc/systemd/system/ctrl-alt-del.target which changes the behaviour of hitting ctrl+alt+delete to poweroff instead of reboot

To reboot using systemctl you should run

systemctl isolate reboot.target 

If you really need to reboot and nothing seems to work, there is an alternative way. This is pretty similar to holding the poweroff button, but I don't recommend using this unless it's a last resort. You can run:

echo b > /proc/sysrq-trigger

which will immediately reboot without doing anything (including unmounting filesystems) - which can cause filesystem corruption etc. More details can be found here and here.

This may also be useful.

3
  • Powering off is easy, the power button will do just fine. I want to reboot... ;-) root@Vidar:/home/bokkie# systemctl isolate reboot.target Failed to start reboot.target: Transaction is destructive. See system logs and 'systemctl status reboot.target' for details. root@Vidar:/home/bokkie# back to square one: destructive transaction, reboot.target being disabled/dead... as per the post I linked.
    – Bokkie
    Sep 25, 2017 at 12:50
  • I'd like to know why the transaction is destructive... So that I may prevent it from becoming destructive again. I'd also like to tell systemd to shove it...
    – Bokkie
    Sep 25, 2017 at 12:53
  • If you want to remove systemd have a look at without-systemd.org/wiki/index.php/… Sep 25, 2017 at 13:11
0

It worked, after I entered my password for access to my encrypted home dir... I looked at syslog just before trying again, and found:

Sep 25 14:57:14 Vidar systemd[1]: message repeated 3 times: [ Requested transaction contradicts existing jobs: Transaction is destructive.]
Sep 25 14:57:22 Vidar systemd-cryptsetup[25670]: Loading of cryptographic parameters failed: Invalid argument
Sep 25 14:57:22 Vidar systemd-cryptsetup[25670]: Failed to activate: Invalid argument
Sep 25 14:57:23 Vidar systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
Sep 25 14:57:23 Vidar systemd[1]: Failed to start Cryptography Setup for cryptswap1.
Sep 25 14:57:23 Vidar systemd[1]: Dependency failed for dev-mapper-cryptswap1.device.
Sep 25 14:57:23 Vidar systemd[1]: Dependency failed for /dev/mapper/cryptswap1.
Sep 25 14:57:23 Vidar systemd[1]: dev-mapper-cryptswap1.swap: Job dev-mapper-cryptswap1.swap/start failed with result 'dependency'.
Sep 25 14:57:23 Vidar systemd[1]: dev-mapper-cryptswap1.device: Job dev-mapper-cryptswap1.device/start failed with result 'dependency'.
Sep 25 14:57:23 Vidar systemd[1]: [email protected]: Unit entered failed state.
Sep 25 14:57:23 Vidar systemd[1]: systemd[email protected]: Failed with result 'exit-code'.

I'll close this question.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .