Logout and shutdown as normal user in Debian Topic is solved

Need help with your Linux distro? All questions are good - not all answers are -but we try

Moderator: jkerr82508

User avatar
Snorkasaurus
Berserk
Posts: 587
Joined: 30 Dec 2013, 19:19
Contact:

Logout and shutdown as normal user in Debian

Postby Snorkasaurus » 19 Oct 2014, 04:35

Funny, on a stock Wheezy install with bare OpenBox, oblogout works as root but not user (reboot, shutdown, and "xscreensaver -lock" don't work).
VLC will not run as root at all.

I'm not actually interested in a "looker"... just a "doer". :-(

S.

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: Logout and shutdown as normal user in Debian

Postby viking60 » 19 Oct 2014, 09:41

I have split the posts and moved this here from Software - Rednotebook
Jup doers are good +1 .
You need a policykit to be able to log out or shut down as normal user.
Install policykit-1-gnome or some other policykit.

If you search for policykit in synaptic; what do you have installed?
Edit:
It looks like oblogout and Debian are not true friends - it is not in the repos - so it is probably not a good idea to use it then :confused
I log out or restart or shutdown with the docky panel - as normal user:
:A
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
Snorkasaurus
Berserk
Posts: 587
Joined: 30 Dec 2013, 19:19
Contact:

Re: Logout and shutdown as normal user in Debian

Postby Snorkasaurus » 19 Oct 2014, 14:45

I have

Code: Select all

user@opendeb:~$ dpkg --get-selections | grep policykit
policykit-1               install
policykit-1-gnome            install

But I would think that the problem is not dependencies since it works just fine as root (so all the dependencies must be there). I also do not need functions like hibernate or suspend, just reboot, shutdown, and logoff... so power related functions are irrelevant, just access to shutdown. I also have no synaptic since I am only doing a base install (no DE)
Image

and then adding what I need. In the screenshot above the default is to have Desktop Environment and Print Server checked as well.

Code: Select all

sudo apt-get install xorg openbox xdm
sudo apt-get install obconf obmenu
sudo apt-get install xfce4-panel xscreensaver
sudo apt-get install python-central python-gobject python-imaging python-dbus
wget https://launchpad.net/oblogout/0.2/0.2.0/+download/oblogout_0.2-0-0ubuntu1_all.deb
sudo dpkg -i oblogout_0.2-0-0ubuntu1_all.deb

I should also note that installing a desktop environment at Debian install time provides ways for regular users to shutdown and restart by default.

S.

User avatar
Snorkasaurus
Berserk
Posts: 587
Joined: 30 Dec 2013, 19:19
Contact:

Re: Logout and shutdown as normal user in Debian

Postby Snorkasaurus » 19 Oct 2014, 16:47

I guess it would be helpful to include that if I use the defaults for oblogout I get

Code: Select all

user@opendeb:~$ oblogout
Traceback (most recent call last):
  File "/usr/bin/oblogout", line 97, in <module>
    sys.exit(main())
  File "/usr/bin/oblogout", line 92, in main
    app = OpenboxLogout(config, local_mode)
  File "/usr/lib/python2.7/dist-packages/oblogout/__init__.py", line 82, in __init__
    self.load_config(config)
  File "/usr/lib/python2.7/dist-packages/oblogout/__init__.py", line 264, in load_config
    if not self.dbus.check_ability(button):
  File "/usr/lib/python2.7/dist-packages/oblogout/dbushandler.py", line 127, in check_ability
    return self._halpm.CanSuspend
  File "/usr/lib/python2.7/dist-packages/oblogout/dbushandler.py", line 58, in _halpm
    hal = self._sysbus.get_object ("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer")
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Hal was not provided by any .service files


If I install the hal package, I get the buttons but "shutdown" and "reboot" do nothing, and back in the console I get

Code: Select all

user@opendeb:~$ oblogout
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/oblogout/__init__.py", line 354, in click_button
    self.dbus.restart()
  File "/usr/lib/python2.7/dist-packages/oblogout/dbushandler.py", line 143, in restart
    if not self.__auth_perms("org.freedesktop.hal.power-management.reboot"):
  File "/usr/lib/python2.7/dist-packages/oblogout/dbushandler.py", line 94, in __auth_perms
    if self.__check_perms(id):
  File "/usr/lib/python2.7/dist-packages/oblogout/dbushandler.py", line 80, in __check_perms
    res = self._polkit.IsProcessAuthorized(id, os.getpid(), False)
  File "/usr/lib/python2.7/dist-packages/oblogout/dbushandler.py", line 50, in _polkit
    pk = self._sysbus.get_object ("org.freedesktop.PolicyKit", "/")
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.PolicyKit was not provided by any .service files


If I install policykit-1 and/or policykit-1-gnome I get the same.

If I edit /etc/oblogout.conf and change "usehal" from true to false I get

Code: Select all

user@opendeb:~$ oblogout
sh: 1: reboot: not found


If I type reboot at the command line I get

Code: Select all

user@opendeb:~$ reboot
bash: reboot: command not found


If I type /sbin/reboot I get

Code: Select all

user@opendeb:~$ /sbin/reboot
reboot: must be superuser.


If I type sudo /sbin/reboot at the command line it reboots (after asking for password of course)

So... If I then edit the /etc/oblogout.conf so that the reboot function has the full path to /sbin/reboot I get

Code: Select all

user@opendeb:~$ oblogout
sh: 1: reboot: not found


If I then edit the /etc/oblogout.conf so that the reboot function says /usr/bin/sudo /sbin/reboot I get

Code: Select all

user@opendeb:~$ oblogout
sh: 1: reboot: not found


Okay, so I edit the /etc/oblogout.conf so that the reboot function says /usr/bin/sudo reboot (without the path to reboot) and I get

Code: Select all

user@opendeb:~$ oblogout
sh: 1: reboot: not found


Oh I also tried adding this to /etc/sudoers

Code: Select all

user ALL=(ALL) NOPASSWD: ALL

and it does allow me to use sudo without a password prompt, however it does not help oblogout find /sbin/shutdown

Code: Select all

user@opendeb:~$ oblogout
sh: 1: reboot: not found


However, if I logout and log back in as root... BAM! It works under almost all of the above conditions.

S.

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: Logout and shutdown as normal user in Debian

Postby viking60 » 19 Oct 2014, 17:28

Well that sounds like a policykit problem, the policykit is not a dependency in Openbox.
I don't use oblogout in Debian because those external packages often cause problems.
PolicyKit is an application-level toolkit for defining and handling the policy that allows unprivileged processes to speak to privileged processes.

It is a framework for centralizing the decision making process with respect to granting access to privileged operations for unprivileged (desktop) applications.


What does

Code: Select all

dpkg --get-selections | grep libpolkit

say?

What login manager do you use (GDM?)?
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
Snorkasaurus
Berserk
Posts: 587
Joined: 30 Dec 2013, 19:19
Contact:

Re: Logout and shutdown as normal user in Debian

Postby Snorkasaurus » 19 Oct 2014, 17:39

These are installed as dependencies of policykit-1 and policykit-1-gnome...

Code: Select all

user@opendeb:~$ dpkg --get-selections | grep libpolkit
libpolkit-agent-1-0:amd64                       install
libpolkit-backend-1-0:amd64                     install
libpolkit-gobject-1-0:amd64                     install


Just for turds & giggles I tried

Code: Select all

dpkg --add-architecture i386
apt-get update
apt-get install libpolkit-agent-1-0:i386

But got the same results.

S.

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: Logout and shutdown as normal user in Debian

Postby viking60 » 19 Oct 2014, 17:48

You do have the same installed as I have, but I have x86_64.
These things can also be set in the login manager (lxdm gdm kdm etc).
Have you tried to install docky and log out with that one? If you add the session manager from the menu then it should log you out or reboot.

A workaround could be

Code: Select all

sudo chmod u+s /sbin/shutdown

This will add the suid mode to shutdown so that the normal user can do it (run shutdown without sudo).
That should work like the one you tried in the sudoers file:

Code: Select all

snorkasaurus ALL=(ALL) NOPASSWD: ALL

strange that it did not work....
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
Snorkasaurus
Berserk
Posts: 587
Joined: 30 Dec 2013, 19:19
Contact:

Re: Logout and shutdown as normal user in Debian  Topic is solved

Postby Snorkasaurus » 19 Oct 2014, 18:07

I think what I am going to go with is a gmessage (218k) script that I mostly stole from here with just a few modifications.

Code: Select all

sudo apt-get install gmessage

Then add it to the right-click menu for OpenBox like so
Image

and then myscript.sh looks like this

Code: Select all

#!/bin/bash
gmessage "What do ya wanna do?" -center -ontop -title "Hey!" -font "Sans bold 10" -default "Cancel" -buttons "_Cancel":1,"_Log out":2,"_Reboot":3,"_Shut down":4 >/dev/null
case $? in
   1)
   echo "Exit";;
   2)
   openbox --exit;;
   3)
   sudo shutdown -r now;;
   4)
   sudo shutdown -h now;;
esac


Which presents me with this working prompt:
Image


I guess since OpenBox is not a DE the authors figure there is no need to provide shutdown/reboot functionality. :-(

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: Logout and shutdown as normal user in Debian

Postby viking60 » 19 Oct 2014, 18:12

Yes that seems to be a pragmatic solution. But that one will still prompt for the password before it shuts down, will it not?
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
Snorkasaurus
Berserk
Posts: 587
Joined: 30 Dec 2013, 19:19
Contact:

Re: Logout and shutdown as normal user in Debian

Postby Snorkasaurus » 19 Oct 2014, 18:20

Not if I add

Code: Select all

user ALL = (ALL) NOPASSWD: /sbin/shutdown

to my /etc/sudoers file. :-)

S.

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: Logout and shutdown as normal user in Debian

Postby viking60 » 19 Oct 2014, 18:23

Ah so it did work. Your problem is pretty much solved then.
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
Snorkasaurus
Berserk
Posts: 587
Joined: 30 Dec 2013, 19:19
Contact:

Re: Logout and shutdown as normal user in Debian

Postby Snorkasaurus » 19 Oct 2014, 18:38

It isn't a pretty solution but it does work... and since when do I care about "pretty" anyways? :-)
Now if I could just find a file manager with a tree pane for less than 498M I'd be a happy camper. I tried about a dozen and then tried three or four Windows file managers via wine, but nautilus was the best I could find (weighing in at a portly half Gig).
S.


Return to “Help”