8

So I've been using the command "poweroff" to shut down my Linux system, tried searching only if this is safe or not, mostly people just speak of "shutdown -h now" or something like that. So my question is: Is it safe to shut down Linux using the "poweroff" command?

Comments
  • 2
    why not? "shutdown now" is ok.

    -h
    Requests that the system be either halted or powered off after it has been brought down, with the choice as to which left up to the system.
  • 1
    @tracktraps So you're saying that 'poweroff' is safe?
  • 2
  • 2
    In normal conditions 'poweroff' behaving as alias for 'shutdown now'.
    https://askubuntu.com/questions/...
  • 5
    Yeah on Debian too,
    Long long ago, power of wasn't really leaving system sane. To shutdown nicely you would need to do :
    sync, umount -a, half, and poweroff
    especially on IBM's AIX systems or Sun's mainframes.
    Now simple shutdown will work nicely and give system 5min to do it's stuff. If you in a hurry do shutdown now as advised above. Also poweroff is doing mostly the same right now, but it's poweroff that aliases shutdown - now
  • 2
    @esavier Thank you for this very nice and eplanative answer :-)
  • 2
    @esavier
    I didn't made edit on time,
    one typo : halt not half,
    And some more info and explanations
    I looked in the kernel code and right now poweroff, depending on implementations, may be unsafe. It all depends on kernel, for example Debian distro, poweroff means just kernels call reboot(), but notice that reboot is used to simply shutdown machine too. On the older AIX system ( technically unix too ) poweroff () calls acpi power management to cease. This means all unwritten changes will be lost since those are memory buffered. Basically just a keyboard way of pushing power button. Since the "sync" and "halt" commands that force system to empty buffers and cease system operations.
    However, I searched and I can not find any version of poweroff or kernel implementations doing it right now. The oldest one I found have around 20 years. So yeah it is not advices but should be ok to call poweroff on the modern os'es
  • 0
    @esavier Oh okay, thank you for spending so much time on this :-)
  • 1
    @simo002m
    Its cool, I am Debian developer I like doing this stuff :)
  • 0
    @esavier Well it's an honor
Add Comment