Kodi Community Forum

Full Version: shutdown/reboot does not work while SSH session open
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have noticed that the Shutdown and Reboot commands from the XBMC GUI do not work when I have another machine connected to my XBMC machine via SSH.

If no one is SSH'd in, the GUI power commands work fine.
ltwally Wrote:I have noticed that the Shutdown and Reboot commands from the XBMC GUI do not work when I have another machine connected to my XBMC machine via SSH.

If no one is SSH'd in, the GUI power commands work fine.

Whats wrong with this? its a feature.
Weird, this doesn't happen for me. I can reboot no problem either through the gui or by sudo reboot while logged in over SSH. Using Live 10.1 anyway. Don't know about shutdown though...
sraue Wrote:Whats wrong with this? its a feature.

I'm new to the linux-htpc crowd, so maybe this is how other such products operate... but it's definitely contrary to how other OS's operate. Coming from a general computing background, I would expect the reboot/shutdown buttons to do what they say they do, regardless of whether someone is SSH'd onto the machine.

Perhaps XBMC should instead display a prompt "Other users are connected to this device. Do you wish to continue? YES/NO".

Or, at the very least, it should throw up a message window saying that it will not power off as instructed because of someone SSH'd in.
Also, this raises the question: what happens if there is a hung SSH connection?
Quote:Also, this raises the question: what happens if there is a hung SSH connection?
I am sure you will find away to sort it out if that happen...

This could be due to policy settings, what I find strange is that when I tested this SSH did not NOT block reboot/shutdown while background x (gnome) session did.

You could check you settings in

Quote:sudo nano /usr/share/polkit-1/actions/org.freedesktop.consolekit.policy
change
Quote:<allow_active>auth_admin</allow_active> ==> <allow_active>yes</allow_active>
to give xbmc more access.

look for e.g. stop-muliple-users & restart-multipel-users
ltwally Wrote:I have noticed that the Shutdown and Reboot commands from the XBMC GUI do not work when I have another machine connected to my XBMC machine via SSH.

If no one is SSH'd in, the GUI power commands work fine.

Same thing for me. I have to run reboot -f for it to work.
ltwally Wrote:I'm new to the linux-htpc crowd, so maybe this is how other such products operate... but it's definitely contrary to how other OS's operate. Coming from a general computing background, I would expect the reboot/shutdown buttons to do what they say they do, regardless of whether someone is SSH'd onto the machine.

Perhaps XBMC should instead display a prompt "Other users are connected to this device. Do you wish to continue? YES/NO".

Or, at the very least, it should throw up a message window saying that it will not power off as instructed because of someone SSH'd in.

When someone is logged into the computer via ssh you have actually another logged in users. If you have more than 1 logged in users, who might or might not be doing work you do not want to shutdown, this is why its a feature.

Say your upgrading your computer over ssh, you would not want xbmc to shutdown then would you Smile

AFAIK we are not given that granuarity when we issue the shutdown, i.e. we don't get "there are X other users running", we could probably probe and guess thats why but we won't know. And as such even if we guess right thats it, there is no garantue we are allowed (its a different security level in linux to shutdown when multiple users are logged in than just the one) to do the shutdown, so we might fail as such the error message is wrong.

The only thing we could do is pop up "We are not allowed to shutdown, are there multiple users logged in?" which iirc we do?
topfs2 Wrote:The only thing we could do is pop up "We are not allowed to shutdown, are there multiple users logged in?" which iirc we do?

No. In fact, clicking on Shutdown/Reboot while someone else is logged in will cause XBMC to dump to login prompt on the console screen. This does not seem, to me, to be desired either.
topfs2 Wrote:When someone is logged into the computer via ssh you have actually another logged in users. If you have more than 1 logged in users, who might or might not be doing work you do not want to shutdown, this is why its a feature.

Say your upgrading your computer over ssh, you would not want xbmc to shutdown then would you Smile

I can see your perspective. However, every other OS on the planet works differently -- when the person at the console calls for a shutdown/reboot, the system complies. (Assuming they have a sufficient security/permission level to do so.)

If this were a vanilla Ubuntu system, for example, and I was sitting at the console working in gnome while you were ssh'd in, and I told it to shutdown... it would.

So, while I can see your perspective, it is contrary to what an outsider would expect.

Personally, I think that at the least there should be some sort of message box that pops up and says there are other users on the system. It doesn't have to say how many.

But to just have it dump to a login prompt or ignore the shutdown button entirely? That leaves the person sitting at the console going "WTF".

*shrug* That's just my opinion.
ltwally Wrote:I can see your perspective. However, every other OS on the planet works differently -- when the person at the console calls for a shutdown/reboot, the system complies. (Assuming they have a sufficient security/permission level to do so.)

If this were a vanilla Ubuntu system, for example, and I was sitting at the console working in gnome while you were ssh'd in, and I told it to shutdown... it would.

So, while I can see your perspective, it is contrary to what an outsider would expect.

Personally, I think that at the least there should be some sort of message box that pops up and says there are other users on the system. It doesn't have to say how many.

But to just have it dump to a login prompt or ignore the shutdown button entirely? That leaves the person sitting at the console going "WTF".

*shrug* That's just my opinion.

First, its hard to compare it to different operating systems as windows for example, doesn't really have the remote login stuff like ssh nor its normal to use. If you do remote desktop with windows your actually becoming the active user IIRC, i.e. what vnc does. This in linux counts the same as with remote desktop. I'm fairly certain that if you would create 2 desktop users on windows and have both logged in it would tell you that the other user needs to logout first, or atleast require administrative credentials to do the shutdown.

So to go back to linux and ubuntu, if you do a vanilla install off ubuntu and just install ssh and logg on via that and try to shutdown, it will ask for administrative credentials so it works the exact same way.

XBMC on the other hand is not coupled with policy kit atm (the system which handles the popup and switch to higher priviledges in ubuntu and other linux distros) and as such we can't really do what vanilla ubuntu does. Part of the binary addons will be to implement this though as its needed for binary addons and at that time we _can_ behave as vanilla ubuntu does.

So you see that saying its not how other OS does is wrong, and doesn't apply in the discussion and especially doesn't for linux based XBMC (and xbmc running on linux NEEDS to behave as linux, otherwise the integration is lost). Besides, even if it did apply you could argue that every other OS does it wrong as allowing shutdown when another user is logged on _is_ wrong, atleast without administrative permission.

Also, as I said, it previously did pop up and stated other users where logged on (I implemented it) so if it does not please file a trac ticket, it certainly should do that.

ltwally Wrote:No. In fact, clicking on Shutdown/Reboot while someone else is logged in will cause XBMC to dump to login prompt on the console screen. This does not seem, to me, to be desired either.

Definitely not desired, please file a trac ticket

Cheers,
Tobias
vikjon0:

Thanks for the recommendation. That solved it!
ltwally Wrote:I have noticed that the Shutdown and Reboot commands from the XBMC GUI do not work when I have another machine connected to my XBMC machine via SSH.

If no one is SSH'd in, the GUI power commands work fine.


Uh......thats EXACTLY how its supposed to work.

It would piss me off if it didnt. Do you really want someone rebooting the machine while you're logged in doing something?


You're highly exaggerating with talk like "Every other OS on the planet".
Be serious dude. There is a right way and a wrong way to do things.

If you want to reboot from the GUI then log off the SSH session. Pretty simple.
FishOil Wrote:You're highly exaggerating with talk like "Every other OS on the planet".
Be serious dude. There is a right way and a wrong way to do things.

If you want to reboot from the GUI then log off the SSH session. Pretty simple.

Hey, I'm not interested in a flame war... but every single multi-user system I've ever used, from Windows to OSX to the various *nix systems... ALL of them would shutdown/reboot when told to do so. At the most, some of them put up a warning and asked if you wanted to continue.

XBMC silently fails. And then dumps me to a login screen.

So, YES, this is COMPLETELY different from any other system I have ever been on. And I've been on more than a few.

You may enjoy the behaviour of XBMC. That's fine.

My comment was that this behaviour is different from the rest of the world. That's a pretty solid fact.

I'm very sorry if it bothers you. End of discussion.
ltwally Wrote:Hey, I'm not interested in a flame war... but every single multi-user system I've ever used, from Windows to OSX to the various *nix systems... ALL of them would shutdown/reboot when told to do so. At the most, some of them put up a warning and asked if you wanted to continue.

XBMC silently fails. And then dumps me to a login screen.

So, YES, this is COMPLETELY different from any other system I have ever been on. And I've been on more than a few.

You may enjoy the behaviour of XBMC. That's fine.

My comment was that this behaviour is different from the rest of the world. That's a pretty solid fact.

I'm very sorry if it bothers you. End of discussion.

Ignore fishoil, read my response and answer / do what it says Smile