Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi everyone,
before systemd I used to use "init 0" to gracefully shutdown the the system.
Although recently I have heard that in systemd I should not use "init commands" anymore and to shutdown the system gracefully use "poweroff" command.
That is a surprise to me as up to now "poweroff" ment to me cut-off power immediately.
Any comments on that/your opinions & experience ?
Since systemd does not have runlevels init 0 if it works at all would be a shortcut to systemctl command.
poweroff, shutdown and halt are all shortcuts to systemctl and I think that in the old days poweroff actually called shutdown which would be the preferred way.
I know I just push my power button (laptop here) and it shuts down gracefully, with systemd and systemV, runit (void linux). I do remember seeing/reading in one of them ("scripts") how this was tied to the 'shutdown now' command.
In sysvinit, Poweroff always meant "Shutdown, then switch off via ACPI (soft off)", whereas Halt meant "Shutdown and wait for instructions". I assume systemd uses the same conventions.
If you can get a graceful shutdown by pressing the power button, this must work via ACPI. If you look in /etc/acpi, you should find a script for handling the power button press event. Because it's an ACPI thing, it shouldn't be affected by what kind of init system you have, as long as that system recognises the shutdown command which the script uses.
Things are rarely that cut-and-dried - more true with systemd. FWIW I have always used "poweroff" command; never had an issue.
First place to look for power control options might be "man logind.conf"
@hazel, I don't know for certain as I avoid it like the plague, but I wouldn't be surprised to hear that acpid is one of the daemons that systemd has "assimilated".
That is a surprise to me as up to now "poweroff" ment to me cut-off power immediately.
In my system (Slackware) halt, reboot and poweroff are all the same executable and do a "gracefull" shutdown, optionally followed by a poweroff or reboot
Code:
-rwxr-xr-x 1 root root 12312 2013-08-17 05:24:42 halt
lrwxrwxrwx 1 root root 4 2015-10-05 09:09:44 poweroff -> halt
lrwxrwxrwx 1 root root 4 2015-10-05 09:09:44 reboot -> halt
I haven't switched to the systemd commands yet...I still use init 0 or init 6...but I should. /sbin/init is a link to systemd and could go away in some future release.
Again since /sbin/shutdown and /sbin/poweroff commands are symlinks to systemctl and both work fine (i.e. poweroff or systemctl poweroff). I use poweroff since its easier to type.
I have not used init 0 command in a very long time and it is symlinked to /lib/systemctl. I just tried it on a CentOS and it still stops the system.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.