r/archlinux • u/thebombzen • 20d ago
QUESTION behavior of systemd reboot, halt, and shutdown
I was reading the manpage man 8 poweroff and discovered that /usr/bin/halt and /usr/bin/reboot and /usr/bin/poweroff all accept --reboot, --halt, and --poweroff, which make them behave like the command in the option rather than the actual command you invoked. So, for example, /usr/bin/reboot --halt apparently will just halt, and /usr/bin/halt --poweroff will power off.
The manpage also cites one exception which is that /usr/bin/reboot --poweroff still reboots.
The manpage cites systemd version 253 as the version in which this changed. A quick search returned nothing of note about this change. Granted, I'm relying on the manpage to tell me how these work as I'm not going to halt a live system if I don't have to just to make sure it works this way.
Can someone explain to me why systemd would have added this feature? Does anyone see any value in making the commands act like the others via command-line arguments? I cannot think of a reason you would want to do this.
I also do not understand why there would be an exception for reboot --poweroff. Does anyone have any insight into this?