Ubuntu – Can’t mount USB devices, shut down etc. as a user


I tried gnome3 and gnome3-staging ppas to test running Gnome 3.8. After a while I decided that Gnome 3.8 wasn't for me, so I did a ppa-purge of both the ppas. As described in gnome3-staging ppa page, I also did:

$ sudo apt-get purge libpam-systemd
$ sudo apt-get install libpam-xdg-support

The trouble is, I can't mount my external USB device anymore. When I try to mount it as a user, it fails:

$ udisks --mount /dev/sdc1 
Mount failed: Not Authorized

I am logged in an XFCE session, but the same thing happens in a fallback Gnome session, or from a Unity session. Also, in XFCE, "suspend" and "shut down" menus are grayed out.

I can't also open synaptic package manager from XFCE menus (sudo synaptic works).

After a lot of searching, it seems like it is a policykit issue. I see the following in my ~/.xsession-errors:

(polkit-gnome-authentication-agent-1:5805): polkit-gnome-1-WARNING **: Unable to determine the session we are in: No session for pid 5805

PID 5805 doesn't exist. If I try to start polkit-dnome-authentication-agent-1 from an xterm, I get the same error (different PID):

$ /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
(polkit-gnome-authentication-agent-1:15971): polkit-gnome-1-WARNING **: Unable to determine the session we are in: No session for pid 15971

(the ... lines are warnings from GTK about missing css files etc.).

polkitd is running:

$ pidof polkitd

Is there something I am missing?

Best Answer

  • For whatever DM you use (kdm, gdm, lightdm, etc.), do the following:

    1. Append the following to the top of the /etc/pam.d/<your_dm> file:

      session required pam_loginuid.so
      session required pam_systemd.so
    2. Logout, Restart X, Login

    3. Check that everything works

    4. Remove fix you applied in step 1.

    5. Logout, Restart X, Login

    6. Check that everything STILL works!

    This so-called fix can be removed once you login and check that you have a working system. It apparently allows the upgraded system to complete some process that fixes the underlying problem. Once done (after an admin login?), the fix can be removed.

    It also cleared up all the crash reports I was getting directly after login.

  • Related Question