help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting loginctl to work


From: Martin Castillo
Subject: Re: getting loginctl to work
Date: Mon, 27 Mar 2023 15:18:58 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0

Hi,

Am 27.03.23 um 12:21 schrieb SeerLite:
Hi! Is it maybe Polkit? Polkit was stopping me from suspending my laptop via 
SSH. The exact same behavior as you: no output and error code 1.

Since the only `loginctl` command I cared about was `suspend`, I added my user 
to the `power` group, added the `power` group to `operating-system`, defined 
the following extension:

     ; Rule template stolen from from gnu/services/desktop.scm: polkit-wheel
     ; and rule itself stolen from https://askubuntu.com/a/992878
     (define polkit-power-rules
       (file-union
        "polkit-power"
        `(("share/polkit-1/rules.d/power.rules"
           ,(plain-file
             "power.rules"
             "polkit.addRule(function(action, subject) {
         if (action.id == \"org.freedesktop.login1.suspend\" &&
             subject.isInGroup(\"power\")) {
             return polkit.Result.YES;
         }
     });")))))


and added the above to my services like:

     (simple-service 'polkit-power-rules polkit-service-type (list 
polkit-power-rules))

You'd have to do something but I'm guessing for `login1.poweroff` instead.

Thank you, that works. I think this kind of rule should be expected on most systems. It would be nice if this kind of polkit rule was predefined as a variable in guix, or the manual (or at least the cookbook) should give this as an example.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]