After a recent update on an Ubuntu 20.04:
$ systemctl suspend
Call to Suspend failed: Access denied
Some weeks ago worked fine this way, without any root privileges.
On journal:
dbus-daemon[1310]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.991" (uid=1000 pid=683426 comm="systemctl suspend " label="unconfined") interface="org.freedesktop.login1.Manager" member="SuspendWithFlags" error name="(unset)" requested_reply="0" destination="org.freedesktop.login1" (uid=0 pid=1512 comm="/lib/systemd/systemd-logind " label="unconfined")
The "rejected send message" is the dbus equivalent of "permission denied". And the reason why the permission is denied depend on the sender, the destination, the interface and the member.
A simple search return mostly issues related with hibernate. One way (1, 2) could be to add NOPASSWD to sudoers file (not the same), but seems a polkit issue.
What package update cause this behavior? There is other (maybe more elegant) solution other than editing sudoer file?
Edit:
$ grep -ri org.freedesktop.login1.suspend /usr/share/polkit-1/
/usr/share/polkit-1/actions/org.freedesktop.login1.policy: <action id="org.freedesktop.login1.suspend">
/usr/share/polkit-1/actions/org.freedesktop.login1.policy: <action id="org.freedesktop.login1.suspend-multiple-sessions">
/usr/share/polkit-1/actions/org.freedesktop.login1.policy: <annotate key="org.freedesktop.policykit.imply">org.freedesktop.login1.suspend</annotate>
/usr/share/polkit-1/actions/org.freedesktop.login1.policy: <action id="org.freedesktop.login1.suspend-ignore-inhibit">
/usr/share/polkit-1/actions/org.freedesktop.login1.policy: <annotate key="org.freedesktop.policykit.imply">org.freedesktop.login1.suspend</annotate>
$ grep -i suspend /usr/share/dbus-1/system.d/org.freedesktop.login1.conf
send_member="Suspend"/>
send_member="SuspendThenHibernate"/>
send_member="CanSuspend"/>
send_member="CanSuspendThenHibernate"/>
For some reason, using other similar regular user systemctl suspend -i
works flawlessly.
Tried also this with Result.YES
.
Using busctl monitor
:
‣ Type=error ... Sender=org.freedesktop.DBus Destination=:1.4594
ErrorName=org.freedesktop.DBus.Error.AccessDenied ErrorMessage="Rejected send message, 2 matched rules; type="method_call", sender=":1.4594" (uid=1000 pid=636652 comm="systemctl suspend -i " label="unconfined") interface="org.freedesktop.login1.Manager" member="SuspendWithFlags" error name="(unset)" requested_reply="0" destination="org.freedesktop.login1" (uid=0 pid=1512 comm="/lib/systemd/systemd-logind " label="unconfined")"
MESSAGE "s" { STRING "Rejected send message, 2 matched rules; type="method_call", sender=":1.4594" (uid=1000 pid=636652 comm="systemctl suspend -i " label="unconfined") interface="org.freedesktop.login1.Manager" member="SuspendWithFlags" error name="(unset)" requested_reply="0" destination="org.freedesktop.login1" (uid=0 pid=1512 comm="/lib/systemd/systemd-logind " label="unconfined")"; };
I had the same issue with systemctl reboot
/RebootWithFlags
. Same solution, added to /usr/share/dbus-1/system.d/org.freedesktop.login1.conf
(part of systemd
package).
systemctl suspend
/reboot
were working without root. It was a D-BUS Bus Configuration issue.