You are not logged in.
Stupid question, but I haven't found anything...
I need to run 'systemctl suspend' etc. commands as user and connect it to openbox. I get only
$ systemctl suspend
Failed to issue method call: Access denied
Failed to issue method call: Access denied
How can I authenticate user to do that?
edit: according to Lennart Poettering, the solution is to
Invoke the PowerOff() call on the org.freedesktop.login1.Manager interface of the /org/freedesktop/login1 object on the org.freedesktop.login1 service. Which is basically what "systemctl poweroff" does.
But that also needs authentication:
$ dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Suspend" boolean:true
Error org.freedesktop.DBus.Error.AccessDenied: Operation not permitted
Last edited by lahwaacz (2012-08-28 09:01:40)
Offline
I've added
%users ALL = NOPASSWD: /usr/bin/systemctl suspend
to my sudoers file for all my systemctl reboot, hibernate, etc. commands. Works fine.
Scott
Offline
According to the wiki, this should work if you are in the only session running. Is this a case where you there are other sessions running as well so it wants to ask for a password? Even then, I thought it was meant to ask for a password rather than giving an error?
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
Mine works fine w/o password. I believe the wiki states that this should be totally doable as long as you are the *only* user logged into the machine at the time. I have not had this issue, though the dbus command suspends my computer no problem. So I think Lennart Poettering is (obviously) right.
This is a console kit thing, yeah? When you issue a 'systemctl' does it tell you that console-kit*.service succeeded and in the case of the daemon, is running?
Offline
I've added
%users ALL = NOPASSWD: /usr/bin/systemctl suspend
to my sudoers file for all my systemctl reboot, hibernate, etc. commands. Works fine.
Scott
I know about this method, but I'm not interested in it. I want to know how this is supposed to work.
Mine works fine w/o password. I believe the wiki states that this should be totally doable as long as you are the *only* user logged into the machine at the time. I have not had this issue, though the dbus command suspends my computer no problem. So I think Lennart Poettering is (obviously) right.
This is a console kit thing, yeah? When you issue a 'systemctl' does it tell you that console-kit*.service succeeded and in the case of the daemon, is running?
According to wiki, you can replace ConsoleKit's functionality with systemd. That's exactly what I've done. And yes, I'm the only user logged in and there's only one session on my computer.
The official systemd wiki says:
PowerOff(), Reboot(), Hibernate(), Suspend() require org.freedesktop.login1.power-off, org.freedesktop.login1.power-off-multiple-sessions, org.freedesktop.login1.power-off-ignore-inhibit, org.freedesktop.login1.reboot, org.freedesktop.login1.reboot-multiple-sessions, org.freedesktop.login1.reboot-ignore-inhibit, org.freedesktop.login1.suspend, org.freedesktop.login1.suspend-multiple-sessions, org.freedesktop.login1.suspend-ignore-inhibit, org.freedesktop.login1.hibernate, org.freedesktop.login1.hibernate-multiple-sessions resp. org.freedesktop.login1.hibernate-ignore-inhibit, depending whether there are other sessions around or active inhibits.
I guess that I need to grant this permissions using polkit, but how can I do that?
Offline
Now I've rebuilt polkit with --enable-systemd, and everything works as expected. I've done this before, but some upgrade overwrote this.
Marking as [SOLVED]...
Offline
lahwaacz, how do you rebuild polkit?
Offline
lahwaacz, how do you rebuild polkit?
Read the wiki.
Btw. current version of polkit in [extra] is built with systemd support, as the systemd is the default init system in Arch.
Offline