Shutdown via cli / whats the correct way

I read somewhere that shutdown now should not be used to turn off the device on the command line interface (CLI). Therefore:

What is the correct way to shutdown a SFOS system on a phone, when on the CLI? For example by a bash script et cetera. Thanks.

Do you know where you read it?

1 Like

It was here or in the old TJC portal. A search doesn’t reveal that sentence. Therefore here the question.

There is this unreliable reboot command [closed] - about differences between shutdown -r and reboot and it also links to some bug in Mer, but that’s been fixed since 2015

‘shutdown -h now’ as devel-su works fine on my Volla @ Tested it just now.

edit: Sony Xperia 10 also shuts down with this command, but then reboots immediately (very old bug, not fixed by Jolla since 3 years or longer)

devel-su poweroff

Tested just now; the above command shuts down both of my devices without any reboot. (Xperia 10 II @ Jolla1).

See here for descriptions of each command; Linux halt, poweroff, and reboot command help

  • halt instructs the hardware to stop all CPU functions.
  • poweroff sends an ACPI signal which instructs the system to power down.
  • reboot instructs the system to reboot.
1 Like

@throwaway69 thank you to find the right pointer! Indeed its that what I had in mind. The standard commands are wrapped with specific ones that are important for this platform (mobile + sfos) as depicted here [ unreliable reboot command [closed] - ] and here [ Make command line reboot go through dsme when applicable by spiiroin · Pull Request #95 · nemomobile/dsme · GitHub ].

@Seven.of.nine , @Edz your command invocations are catched by the mentioned wrapper. That said, it applies only for interactive execution (bash). For applications, scripts, etc the right way should be explicitly considered and that is my case here. For example a kill switch …

Thanks again and have a nice day.

1 Like

@Edz ‘poweroff’ as devel-su shuts down my X10 fine with no reboot, while ‘shutdown -h now’ works only at the Volla phone. You helped me much!

@leon kill switch is a very good idea!

As SailfishOS is using systemd init system, I guess that best way is to use systemctl poweroff. As the /usr/sbin/poweroff is symlink to /usr/bin/systemctl, it behaves like alias I believe…


BTW, is it possible to shutdown the device via CLI as normal user (or script/bin) by using the dsmetool interface? Any DBUS or polkit possibilities available?