* getting loginctl to work
@ 2023-03-22 21:20 Martin Castillo
2023-03-23 19:09 ` Csepp
2023-03-27 10:21 ` SeerLite
0 siblings, 2 replies; 5+ messages in thread
From: Martin Castillo @ 2023-03-22 21:20 UTC (permalink / raw)
To: help-guix
[-- Attachment #1: Type: text/plain, Size: 933 bytes --]
Hi,
I have guix system installed and want `loginctl poweroff` to work. I'm
logged in via ssh. The vm is started using
qemu-system-x86_64 -drive media=disk,file=geex-unenc.img,format=raw
-bios /usr/share/ovmf/x64/OVMF.fd -m 2G -smp 3 -nic
user,model=virtio-net-pci,hostfwd=tcp::2223-:22 -enable-kvm
Currently loginctl does not work:
$ strace -o loginctl.str loginctl poweroff
returns 1 and prints no errors.
loginctl.str shows some partial error message. I don't know how to get
loginctl or dbus to be more verbose and show me the error.
/var/log/secure does not show anything regarding that error.
$ loginctl list
SESSION UID USER SEAT TTY
c1 983 gdm seat0 tty7
1 sessions listed.
First I tried configuring %base-services plus elogind-service-type, but
it didn't work, so I tried %desktop-services, and it still doesn't work,
but I'm sure it should. My (approximate) configuration.scm is attached.
Martin
[-- Attachment #2: configuration.scm --]
[-- Type: text/x-scheme, Size: 1662 bytes --]
;; This is an operating system configuration generated
;; by the graphical installer and adapted manually.
(use-modules (gnu))
(use-package-modules ssh)
(use-service-modules desktop networking ssh xorg)
(operating-system
(locale "de_DE.utf8")
(timezone "Europe/Berlin")
; (keyboard-layout (keyboard-layout "de" "neo")) ; commented out for help-guix
(host-name "geex-unenc")
(users (cons* (user-account
(name "mcd")
(comment "Martin")
(group "users")
(home-directory "/home/mcd")
(supplementary-groups
'("wheel" "netdev" "audio" "video")))
%base-user-accounts))
(packages
(append
(list (specification->package "nss-certs"))
%base-packages))
(services
(append
(list
;(service xfce-desktop-service-type)
(service dropbear-service-type (dropbear-configuration
(root-login? #t)))
)
; (service dbus-root-service-type)
; (service polkit-service-type) ;need use-modules services dbus
; (service elogind-service-type)
; (service dhcp-client-service-type)
%desktop-services))
(bootloader
(bootloader-configuration
(bootloader grub-efi-bootloader)
(targets '("/efi"))
(keyboard-layout keyboard-layout)))
(file-systems
(cons* (file-system
(mount-point "/efi")
(device (file-system-label "EFI"))
(type "vfat"))
(file-system
(mount-point "/")
(device
(file-system-label "myroot"))
(type "ext4")
(needed-for-boot? #t))
%base-file-systems))
)
[-- Attachment #3: loginctl.str --]
[-- Type: application/vnd.pg.format, Size: 26307 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: getting loginctl to work
2023-03-22 21:20 getting loginctl to work Martin Castillo
@ 2023-03-23 19:09 ` Csepp
2023-03-24 16:04 ` Martin Castillo
2023-03-27 10:21 ` SeerLite
1 sibling, 1 reply; 5+ messages in thread
From: Csepp @ 2023-03-23 19:09 UTC (permalink / raw)
To: Martin Castillo; +Cc: help-guix
Martin Castillo <castilma@uni-bremen.de> writes:
> Hi,
>
> I have guix system installed and want `loginctl poweroff` to work. I'm
> logged in via ssh. The vm is started using
> qemu-system-x86_64 -drive media=disk,file=geex-unenc.img,format=raw
> -bios /usr/share/ovmf/x64/OVMF.fd -m 2G -smp 3 -nic
> user,model=virtio-net-pci,hostfwd=tcp::2223-:22 -enable-kvm
>
>
> Currently loginctl does not work:
> $ strace -o loginctl.str loginctl poweroff
> returns 1 and prints no errors.
> loginctl.str shows some partial error message. I don't know how to get
> loginctl or dbus to be more verbose and show me the error.
> /var/log/secure does not show anything regarding that error.
>
> $ loginctl list
> SESSION UID USER SEAT TTY
> c1 983 gdm seat0 tty7
>
> 1 sessions listed.
>
>
> First I tried configuring %base-services plus elogind-service-type,
> but it didn't work, so I tried %desktop-services, and it still doesn't
> work, but I'm sure it should. My (approximate) configuration.scm is
> attached.
>
>
> Martin
>
> [2. text/x-scheme; configuration.scm]...
>
> [3. application/vnd.pg.format; loginctl.str]...
Could it be that something is holding an inhibit lock on shutdown? I
think ssh can do that. It might even be automatic??
Try running elogind-inhibit with no arguments.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: getting loginctl to work
2023-03-23 19:09 ` Csepp
@ 2023-03-24 16:04 ` Martin Castillo
0 siblings, 0 replies; 5+ messages in thread
From: Martin Castillo @ 2023-03-24 16:04 UTC (permalink / raw)
To: Csepp; +Cc: help-guix
Hi,
>
> Could it be that something is holding an inhibit lock on shutdown? I
> think ssh can do that. It might even be automatic??
> Try running elogind-inhibit with no arguments.
$ elogind-inhibit
WHO UID USER PID COMM WHAT
WHY MODE
NetworkManager 0 root 162 NetworkManager sleep
NetworkManager needs to turn off networks delay
UPower 0 root 250 .upowerd-real sleep
Pause device polling delay
gdm 983 gdm 456 .gsd-media-keys
handle-power-key:handle-suspend-key:handle-hibernate-key GNOME handling
keypresses block
gdm 983 gdm 456 .gsd-media-keys sleep
GNOME handling keypresses delay
gdm 983 gdm 463 .gsd-power-real sleep
GNOME needs to lock the screen delay
5 inhibitors listed.
Doesn't look like it.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: getting loginctl to work
2023-03-22 21:20 getting loginctl to work Martin Castillo
2023-03-23 19:09 ` Csepp
@ 2023-03-27 10:21 ` SeerLite
2023-03-27 13:18 ` Martin Castillo
1 sibling, 1 reply; 5+ messages in thread
From: SeerLite @ 2023-03-27 10:21 UTC (permalink / raw)
To: Martin Castillo, help-guix
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.
SeerLite
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: getting loginctl to work
2023-03-27 10:21 ` SeerLite
@ 2023-03-27 13:18 ` Martin Castillo
0 siblings, 0 replies; 5+ messages in thread
From: Martin Castillo @ 2023-03-27 13:18 UTC (permalink / raw)
To: SeerLite, help-guix
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-03-27 13:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 21:20 getting loginctl to work Martin Castillo
2023-03-23 19:09 ` Csepp
2023-03-24 16:04 ` Martin Castillo
2023-03-27 10:21 ` SeerLite
2023-03-27 13:18 ` Martin Castillo
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.