4

A new auth prompt has started popping up in the past few days (see title) (Ubuntu 18.04). This happens about half the time, anecdotally, when rebooting from the login screen without having logged in.

Thanks to this discussion, I was able to figure out that the relevant action, org.freedesktop.login1.reboot-ignore-inhibit, is configured in /usr/share/polkit-1/actions/org.freedesktop.login1.policy (the link specifies a different file, but it's from 2011, so no surprise, things have changed). I think, given that, I can disable this action.

However, what I'd really like to do is find out which application is asking to inhibit rebooting and why. I imagine at least the "which" part can be answered via journalctl, but I don't know what to look for. Can anyone point me in the right direction?


EDIT: Using WinEunuuchs2Unix's answer, I was able to find lines like the following in journalctl:

... Operator of unix-session:c2 successfully authenticated as unix-user:randy to gain TEMPORARY authorization for action org.freedesktop.login1.reboot-ignore-inhibit for system-bus-name::1.40 [/usr/lib/gnome-session/gnome-session-binary --autostart /usr/share/gdm/greeter/autostart] (owned by unix-user:gdm)

So I guess gdm is the culprit. However, I'm still not sure why this is happening. I'll emphasize again that I was not logged in when the inhibitor was triggered.

thisisrandy
  • 143
  • 1
  • 6

1 Answers1

7

You can get a list of all systemd inhibitors with this:

$ systemd-inhibit --list
 Who: rick (UID 1000/rick, PID 2358/unity-settings-)
What: sleep
 Why: GNOME needs to lock the screen
Mode: delay

 Who: rick (UID 1000/rick, PID 2358/unity-settings-)
What: handle-power-key:handle-suspend-key:handle-hibernate-key
 Why: GNOME handling keypresses
Mode: block

 Who: NetworkManager (UID 0/root, PID 1189/NetworkManager)
What: sleep
 Why: NetworkManager needs to turn off networks
Mode: delay

 Who: Unattended Upgrades Shutdown (UID 0/root, PID 1372/unattended-upgr)
What: shutdown
 Why: Stop ongoing upgrades or perform upgrades before shutdown
Mode: delay

 Who: rick (UID 1000/rick, PID 2358/unity-settings-)
What: handle-lid-switch
 Why: Multiple displays attached
Mode: block

5 inhibitors listed.

However the list isn't dynamic. For example, the list doesn't change when you open a file for editing. Editing a file will inhibit rebooting.

This is how you can see inhibits due to files that need saving:

$ dbus-send --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager org.gnome.SessionManager.GetInhibitors

method return time=1573403207.555584 sender=:1.49 -> destination=:1.1853 serial=7743 reply_serial=2 array [ ]

$ gedit temp &

Now type some text into gedit but don't save the file

$ dbus-send --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager org.gnome.SessionManager.GetInhibitors

method return time=1573403241.678869 sender=:1.49 -> destination=:1.1855 serial=7747 reply_serial=2 array [ object path "/org/gnome/SessionManager/Inhibitor1727" ]

In the first dbus command there are no inhibitor locks. Then gedit is used to modify a new file. In the second dbus command an inhibitor exists.