issue with SHUTDOWN and MOUNT despite of entry in SUDOERS

Hello

I try to configure my OpenSuSE 11.4 64 bit with display manager SLIM and GNOME. I can log in to my account however I have issues with commands like mount or shutdown.
The standard way which I know is to add my user to* /etc/sudoers* file. This is what I did. When I execute “sudo -l” the I can see this:

Matching Defaults entries for rafal on this host:
    always_set_home, env_reset, env_keep="LANG LC_ADDRESS LC_CTYPE LC_COLLATE
    LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC
    LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE",
    targetpw

User rafal may run the following commands on this host:
    (ALL) ALL
    (ALL) NOPASSWD: /sbin/shutdown
    (ALL) NOPASSWD: /bin/mount

however when I try to mount a disk I get this error:

rafal@linux-wfz6:~> /bin/mount /dev/sdb1 /mnt/usb
mount: only root can do that

I tried to follow the instructions from here:
https://bbs.archlinux.org/viewtopic.php?id=141155

I have changed /usr/share/polkit-1/actions/org.freedesktop.consolekit.policy in that way that in all sections I have “YES” in allow_inactive.

What can be wrong with my SUDOERS ?
Even if I switch to GDM with GNOME it does not work.

here list of my users grouos:

rafal@linux-wfz6:~> groups
users disk www audio floppy cdrom video pulse haldaemon

any suggestions ?
regards
Rafal

Have you tried:


sudo /bin/mount /dev/sdb1 /mnt/usb

hi,
yes…this works, however my point is this:
My GNOME should automatically mount new devices. Whenever I put the USB drive I get an error that I am not authorized. I guess this is because I cannot execute “mount” without “sudo” and whole path to the program.
GNOME has in menu “Shutdown”…when I press the button, I cannot shutdown my pc. This is a little bit annoying, therefore I would like to make it work

is there any way to authorize the user to execute “mount” or “shutdown” ?

regards
Rafal

Hi
Fire up dconf-editor and check org->gnome->desktop->media-handling or
via gsettings;


gsettings get org.gnome.desktop.media-handling automount
gsettings get org.gnome.desktop.media-handling automount-open

Both should be true.


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.2 (x86_64) Kernel 3.4.6-2.10-desktop
up 3 days 18:54, 4 users, load average: 0.01, 0.03, 0.05
CPU Intel i5 CPU M520@2.40GHz | Intel Arrandale GPU

hi
both are “true” …and I know that system automount works. the issue is that when GNOME tries to do automount I see message box that I am not authorized.
I see “Authetication is required”
regards
Rafal

Create a new user on your system, and see if it work for that new user.

Mounting a USB or CD or DVD works fine for me in KDE. I don’t normally use Gnome, but when I have occasionally tried it for testing purpose, mounting works fine there, too. In Gnome, the USB automatically mounts. In KDE, the device notifier pops up and I click something if I want it to mount (I prefer the KDE way).

Try with that new user account, so with brand new settings. If it works there, then there’s a problem in your own settings. If it doesn’t work there, then there is a system-wide problem.

Come to think of it, I normally login at the GUI. I’m not sure whether things break if using “startx”.

Hi
ok…I found the root cause though do not yet know how to solve it.

the problem is that polkit-gnome-authentication-agent-1 is not running

here what i see when I log in to gnome with SLIM:

linux-wfz6:/home/rafal # ps aux | grep polkit
root      1552  0.0  0.0 133164  4868 ?        Sl   10:18   0:02 /usr/lib/polkit-1/polkitd
root     18855  0.0  0.0   6772   824 pts/0    S+   15:53   0:00 grep polkit
linux-wfz6:/home/rafal # ps -C polkit-gnome-authentication-agent-1
  PID TTY          TIME CMD

and here what I can see when I do it with GDM and GNOME:

linux-wfz6:/home/rafal # ps aux | grep polkit
root      1474  0.1  0.0 141592  4980 ?        Sl   15:59   0:00 /usr/lib/polkit-1/polkitd
gdm       2449  0.0  0.1 212440  8660 ?        Sl   16:00   0:00 /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
rafal     4557  0.0  0.0 193900  6596 ?        Sl   16:04   0:00 /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
root      4663  0.0  0.0   6772   832 pts/1    S+   16:05   0:00 grep polkit
linux-wfz6:/home/rafal # ps -C polkit-gnome-authentication-agent-1
  PID TTY          TIME CMD
 2449 ?        00:00:00 polkit-gnome-au
 4557 ?        00:00:00 polkit-gnome-au

…so
when I want to use GDM and GNOME i delete my xinitrc
when I want to use SLIM and GNOME I put in xinitrc:
exec gnome-session

I guess I have to put more.
can anybody advise how to start GNOME from xinitrc in clean way…so it will run like with GDM?

regards
Rafal

Maybe put in your xinitrc


/usr/lib/polkit-gnome-authentication-agent-1 &
exec gnome-session

There might be other commands that you should also start before that “exec” line.

adding

/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &

into .xinitrc does not work

and when I execute this command as root I get:

linux-wfz6:/home/rafal # /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &
[1] 4082
linux-wfz6:/home/rafal # 
(polkit-gnome-authentication-agent-1:4082): polkit-gnome-1-WARNING **: Unable to determine the session we are in: GDBus.Error:org.freedesktop.ConsoleKit.Manager.GeneralError: Unable to lookup session information for process '4082'

But what does “does not work” mean here?

Is polkit-gnome-authentication-agent-1 running in the resulting session, but mounting still does not work (this would not surprise me)?

Or is polkit-gnome-authentication-agent-1 not even running? If it is not even running, then check “.xsession-errors” to see if there is an error message.

I am not surprised by the failure to start the gnome polkit agent at a root terminal. It needs to be started as part of your Xwindows session, and I am pretty sure that it is supposed to run as you rather than as root.

I meant when I add this line there is no difference. I do not see agent is running (like it is when I am using GDM).

I think it must have something to do how GDM and GNOME are started in OpenSuse
Please check a question I posted here:
display manager start twice

When I want to used GDM I have to delete .xinitrc (or remove “gnome=session” there). Otherwise I get error like “could not aquire name on session bus”.

on this page: https://bbs.archlinux.org/viewtopic.php?id=149014 it says I should put it in autostart config file. So which file this should be in the case of opensuse ?

I don’t have an answer to the questions raised there.

I’m guessing that it is saying you should create a file in $HOME/.config/autostart and use that to start the polkit agent. And, yes, that should work.

I’m not sure whether the polkit agent problem is the only problem that you are having. You could try manually starting it from a terminal in your session, and see if it helps.

On 2012-10-07 16:16, rafdre wrote:
>
> Hi
> ok…I found the root cause though do not yet know how to solve it.
>
> the problem is that polkit-gnome-authentication-agent-1 is not running
>
> here what i see when I log in to gnome with SLIM:

> I guess I have to put more.
> can anybody advise how to start GNOME from xinitrc in clean way…so
> it will run like with GDM?

So, you are not using gdm; that’s the cause.
In this thread here an
interesting idea came up:
Back to
Basics With X and systemd
. Although it mentions systemd, it might give you ideas. It is
about using startx in a new way.


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)

yes. Thats what I said in my first post:

 I try to configure my OpenSuSE 11.4 64 bit with display manager SLIM and GNOME.

SLIM is replacement for GDM. I do want to use GNOME, though I do not want to have GDM (in the previous OpenSuse releases when I installed blackbox I was able to log in to this window manager, with new Opensuse release using GDM I was not able anymore to do it by choosing a session in log in screen).
I will check the threads you mentioned though whe I quickly checked the first one this was something about audio.
Actually I had as well issue with audio when I switched to SLIM. There was no sound in the system. I solved it when I assigned my user to “Audio” group. Apparently this assignment is not necessary when GDM is used.

cheers
Rafal

the solution was very simple :wink:
as usual I forgot about the simplest one.
here i used SLIM 1.3.3 which I compiled by myself
now I found SLIM 1.3.4 here : software.opensuse.org:
after I installed it, everything works as I wanted