We have moved to a new Sailfish OS Forum. Please start new discussions there.
9

unreliable reboot command [released]

asked 2015-01-18 00:07:25 +0200

kimmoli gravatar image

updated 2015-04-22 17:20:09 +0200

While doing tinkering with phone, noticed that reboot command is kinda unreliable i.e. I just needed to remove battery from phone to get it back on.

heard that better way to reboot from commandline is dsmetool -b

As a workaround, i did add alias reboot='dsmetool -b'to /etc/bashrc but imho, reboot should be fixed to reboot phone properly.

edit retag flag offensive reopen delete

The question has been closed for the following reason "released in a software update" by kimmoli
close date 2015-09-10 09:55:28.272950

Comments

How about..(devel-su first)

shutdown -r now

Works for me everytime..;)

foss4ever ( 2015-01-18 04:15:07 +0200 )edit

this is a comment, not answering anyting :) as i didn't ask anything...

and no. i'm 5 and i want to use reboot

however shutdown -r now seems to do things little differently. (shouldn't reboot call shutdown -r unless forced?)

kimmoli ( 2015-01-18 10:09:55 +0200 )edit
3

Interesting, both rebootand shutdown are symlinks to systemctl.
Looking at systemd sources there is this:

if (program_invocation_short_name) {
    if (strstr(program_invocation_short_name, "halt")) {
        arg_action = ACTION_HALT;
        return halt_parse_argv(argc, argv);
    } else if (strstr(program_invocation_short_name, "poweroff")) {
        arg_action = ACTION_POWEROFF;
        return halt_parse_argv(argc, argv);
    } else if (strstr(program_invocation_short_name, "reboot")) {
        if (kexec_loaded())
            arg_action = ACTION_KEXEC;
        else
            arg_action = ACTION_REBOOT;
            return halt_parse_argv(argc, argv);
       } else if (strstr(program_invocation_short_name, "shutdown")) {
       ...

and I wonder whether in Jolla case it gets to the kexec reboot.
Anyway we are in the magic world of systemd ;)

simosagi ( 2015-01-18 10:53:26 +0200 )edit
3

why i didn't look where it links :P

Seem shutdown -r makes same things as reboot

case 'r':
  if (kexec_loaded())
    arg_action = ACTION_KEXEC;
  else
    arg_action = ACTION_REBOOT;
break;

But there is a difference, with reboot halt_parse_argv() gets called, where is this

if (utmp_get_runlevel(&runlevel, NULL) >= 0)
  if (runlevel == '0' || runlevel == '6')
    arg_force = 2;

so shutdown -r does not force reboot depending on runlevel?

Noticeable difference is that shutdown -r gracefully terminates ssh session, but reboot leaves it open.

kimmoli ( 2015-01-18 11:35:48 +0200 )edit
1

when calling dsmetool -b, it will finally call systemctl --no-block reboot and, when pressing power-key to shutdown, dsme calls systemctl --no-block shutdown

systemctl --no-block reboot causes backlight to go bright, then display goes off and reboot cycle starts.

/usr/sbin/reboot and shutdown -r now seems to cause popup saying sim-card is removed before rebooting - sometimes.

ok, got it reproduced. display off and devicelock active, reboot -> stuck, green led blinking few times,after ~minute it woke up (or did i press powerkey..)

Display off, devicelock active dsmetool -b -> clean reboot

meh, i don't know. I use my alias.

kimmoli ( 2015-01-18 14:16:07 +0200 )edit

1 Answer

Sort by » oldest newest most voted
3

answered 2015-03-15 16:12:19 +0200

spiiroin gravatar image

updated 2015-09-10 09:52:40 +0200

You can think about it this way:

  • Removing battery works, but even kernel has no chance to react.
  • Rebooting via kernel syscall works, but systemd has no chance to react (unmount filesystems etc)
  • Rebooting via systemd works, but dsme (where the shutdown policy is) is bypassed & apps do not get pre-warning.
  • Rebooting via dsmetool is the only way that goes through all the same hoops as shutdown via powerkey.

So, there are many ways to do a reboot. The one which is most correct depends on your situation, but going through dsme is the least likely to cause issues like premature termination of emergency call - especially if automated somehow (via some script / whatnot).

EDIT:

As a convenience for users, from SailfishOS >= 1.1.9.2 onwards: "reboot", "poweroff", "halt" and the likes of "shutdown -r now" made from interactive shell are caught via shell functions and compatible dsmetool action is invoked.

Ref: https://bugs.merproject.org/show_bug.cgi?id=1049

edit flag offensive delete publish link more

Comments

1

Could the reboot and shutdown commands be changed to symlinks (or something) that they use dsmetool way to reboot/shutdown ?

kimmoli ( 2015-04-22 17:21:33 +0200 )edit

......1049

kimmoli ( 2015-06-01 18:46:44 +0200 )edit

Question tools

Follow
6 followers

Stats

Asked: 2015-01-18 00:07:25 +0200

Seen: 813 times

Last updated: Sep 10 '15