Linux Different Shutdown process from Kodi or ssh
#1
Hey,

I already asked this in the xbian forum, but no answer there (not much populated anyway...).

I realize that there seem different shutdown routines whether I choose "shutdown" from the Kodi menu or do a "sudo shutdown -h now" from ssh.
One thing are different things showing below the xbian progress bar while shutdown.

But the main thing I'm struggling with is:
I have a shutdown script inside /etc/rc0.d/K... (spawned from /etc/init.d/ by executing update-rc.d ...). It gets perfectly executed when I do a "sudo shutdown -h now", but not, when I select "Shutdown" from the Kodi menu.

Is there an explanation for this? What's the difference between these processes? Can I make Kodi to execute excatly the same as "sudo shutdown -h now" from the shutdown menu, at least after it's ready with it's own shutdown preparations?
Reply
#2
I don't know xbian but on Arch ARM you need polkit rules to get these functions to work.
Need help programming a Streamzap remote?
Reply
#3
(2020-04-24, 11:07)graysky Wrote: I don't know xbian but on Arch ARM you need polkit rules to get these functions to work.

Ok, good hint, thank You. According to https://wiki.debian.org/PolicyKit Debian continues to use PolicyKit instead of polkit rules.
So like described in https://superuser.com/a/354694 I looked up the Action with
Code:
pkaction
Found out that the
Code:
org.freedesktop.login1.power-off
Action must be the one.
Made a new file /etc/polkit-1/localauthority/50-local.d/allow_all_users_to_shutdown.pkla
Put in
Code:

[Allow all users to shutdown]
Identity=unix-user:*
Action=org.freedesktop.login1.power-off
ResultInactive=no
ResultActive=yes
But no success. still the ssh user xbian cannot perform a shutdown (strangely: I get a "-bash: shutdown: command not found". I'd expect a "...permission denied"), nor get the rc.d-Script run when I shutdown from Kodi menu.
Have I missed something?
Reply
#4
...aren't you using systemd?  Perhaps the rc.d stuff is symlinked?
Need help programming a Streamzap remote?
Reply
#5
(2020-04-24, 13:46)Gauner Wrote: "-bash: shutdown: command not found".'
Check the $PATH variable for that user.
shutdown (binary or symlink) should be in /sbin or /usr/sbin , some distros don't add /sbin:/usr/sbin to non-root users' path.

https://askubuntu.com/questions/433092/t...e-path-env
Reply
#6
(2020-04-24, 16:07)graysky Wrote: ...aren't you using systemd?  Perhaps the rc.d stuff is symlinked?

Yes, that stuff in rc.d is symlinked. update-rc.d does it that way. Dos that explain anything to You?
Reply
#7
(2020-04-24, 16:13)asavah Wrote:
(2020-04-24, 13:46)Gauner Wrote: "-bash: shutdown: command not found".'
Check the $PATH variable for that user.
shutdown (binary or symlink) should be in /sbin or /usr/sbin , some distros don't add /sbin:/usr/sbin to non-root users' path.

https://askubuntu.com/questions/433092/t...e-path-env 

Ok, with
Code:
/sbin/shutdown -h now
I get the expected "shutdown: Need to be root". So, still, the policykit seems not to work.
Reply
#8
Ok, however the problem seems Xbian specific. The solution is here:
http://forum.xbian.org/thread-4085-post-...#pid36579​

Xbian dowsn't use systemd, it uses upstart (the init.d- and rc?.d-way of things...).

Thanks all for Your help!
Reply

Logout Mark Read Team Forum Stats Members Help
Different Shutdown process from Kodi or ssh0