GNU bug report logs - #73859
lightdm-service-type is almost unusable

Previous Next

Package: guix;

Reported by: Dariqq <dariqq <at> posteo.net>

Date: Fri, 18 Oct 2024 09:25:01 UTC

Severity: normal

Tags: patch

Merged with 68055

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 73859 in the body.
You can then email your comments to 73859 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#73859; Package guix. (Fri, 18 Oct 2024 09:25:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dariqq <dariqq <at> posteo.net>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Fri, 18 Oct 2024 09:25:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: bug-guix <at> gnu.org
Subject: lightdm-service-type is almost unusable
Date: Fri, 18 Oct 2024 09:23:32 +0000
Hi Guix,

This is to report some of the issues and workarounds when trying to 
setup lightdm-service-type.


1. Unable to choose a session (https://issues.guix.gnu.org/68055)

This appearently never worked: https://issues.guix.gnu.org/57168#0

This means one currently has to specify the default session with 
something like

(service lightdm-service-type
	 (lightdm-configuration
	  (seats
	   (list
	    (lightdm-seat-configuration
	     (name "*")
	     (user-session "xfce"))))))

2. gtkgreeter chooses the wrong default session

This is related to 1. If one already had set the default user session 
(i.e. from using default configuration => default.xsession) or one wants 
to use a different session, lightdm gtkgreeter still requests the old one.

After a lot of searching I found this 
https://github.com/Xubuntu/lightdm-gtk-greeter/issues/163 .

I.e. lightdm asks the accountsservice for the default-session rather 
than lightm which still has cashed the old/wrong one. Thus with no 
option to select a different session one is unable to login.

The workaorund here is to delete/modify /var/lib/AccountService/users to 
make sure accountsservice recreates/updates the configurration.


3. After the lightdms users .Xauthority file is created it has wrong 
permissions on subsequent boots.

this can be "fixed" by manually setting less restrictive permissions on 
/var/lib/lightdm/.Xauthority

This might be fixed by making the lightdm-activiation snippet actually 
useful: It currently searches for a file named "directory" to fix 
permissions rather than the content of the variable 'directory'.

(find-files "directory"  #:directories? #t) vs
(find-files directory  #:directories? #t)

here 
https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/services/lightdm.scm#n527

4. tigervnnc

default tigervnc is (file-append tigervnc-server "bin/Xvnc") rather than 
(file-append tigervnc-server "/bin/Xvnc")






Information forwarded to bug-guix <at> gnu.org:
bug#73859; Package guix. (Wed, 23 Oct 2024 14:51:02 GMT) Full text and rfc822 format available.

Message #8 received at 73859 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Dariqq <dariqq <at> posteo.net>
Cc: 73859 <at> debbugs.gnu.org
Subject: Re: bug#73859: lightdm-service-type is almost unusable
Date: Wed, 23 Oct 2024 23:48:57 +0900
Hi Dariqq,

Dariqq <dariqq <at> posteo.net> writes:

> Hi Guix,
>
> This is to report some of the issues and workarounds when trying to
> setup lightdm-service-type.

Thank you for taking the time to report these detailed findings!

>
> 1. Unable to choose a session (https://issues.guix.gnu.org/68055)
>
> This appearently never worked: https://issues.guix.gnu.org/57168#0

Indeed.  This definitely makes the session manager much less useful.
I'd really like to find a solution to that; I think the issue is
reported upstream here:
https://github.com/Xubuntu/lightdm-gtk-greeter/issues/105.

Just a hunch: perhaps something in the  environment the greeter
runs is missing to have d-bus communication properly working?

> This means one currently has to specify the default session with
> something like
>
> (service lightdm-service-type
> 	 (lightdm-configuration
> 	  (seats
> 	   (list
> 	    (lightdm-seat-configuration
> 	     (name "*")
> 	     (user-session "xfce"))))))
>

[...]

> This might be fixed by making the lightdm-activiation snippet actually
> useful: It currently searches for a file named "directory" to fix
> permissions rather than the content of the variable 'directory'.
>
> (find-files "directory"  #:directories? #t) vs
> (find-files directory  #:directories? #t)
>
> here
> https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/services/lightdm.scm#n527

Fixed.

> 4. tigervnnc
>
> default tigervnc is (file-append tigervnc-server "bin/Xvnc") rather
> than (file-append tigervnc-server "/bin/Xvnc")

Also fixed (see commit e4e1e16bc1).

-- 
Thanks,
Maxim




Information forwarded to bug-guix <at> gnu.org:
bug#73859; Package guix. (Wed, 23 Oct 2024 18:17:01 GMT) Full text and rfc822 format available.

Message #11 received at 73859 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 73859 <at> debbugs.gnu.org
Subject: Re: bug#73859: lightdm-service-type is almost unusable
Date: Wed, 23 Oct 2024 18:15:19 +0000
[Message part 1 (text/plain, inline)]
Hi Maxim

On 23.10.24 16:48, Maxim Cournoyer wrote:
> Hi Dariqq,
> 
> Dariqq <dariqq <at> posteo.net> writes:
> 
>> Hi Guix,
>>
>> This is to report some of the issues and workarounds when trying to
>> setup lightdm-service-type.
> 
> Thank you for taking the time to report these detailed findings!
> 
>>
>> 1. Unable to choose a session (https://issues.guix.gnu.org/68055)
>>
>> This appearently never worked: https://issues.guix.gnu.org/57168#0
> 
> Indeed.  This definitely makes the session manager much less useful.
> I'd really like to find a solution to that; I think the issue is
> reported upstream here:
> https://github.com/Xubuntu/lightdm-gtk-greeter/issues/105.
> 
> Just a hunch: perhaps something in the  environment the greeter
> runs is missing to have d-bus communication properly working?
> 
Found all these while trying to switch from xfce to mate on a 32 bit 
machine (plus skipping some tests in mates dependency tree to get it to 
build) and spent way to much time trying to understand how to change the 
default session.

Remotivated by your response I looked into how the greeter actually 
finds the session:

1. The menu just calls out to lightdm_get_sessions
https://github.com/Xubuntu/lightdm-gtk-greeter/blob/master/src/lightdm-gtk-greeter.c#L3186

2. This eventually reaches update_sessions
https://github.com/canonical/lightdm/blob/main/liblightdm-gobject/session.c#L181

Could it just be that it is using the "wrong" values for the session dir 
and not the ones we specified in the lightdm config?
From what config files (if any) are we reading here?


If this is indeed the issue can we set sysconfdir to /etc and let it 
read the lightdm config file from /etc/lightdm/lightdm.conf (via 
config_load_from_standard_locations)?

I tried something like this (diff attached) and seems to work. I was 
able to choose between xfce and mate and log into either of them.
(only slightly awkward thing is that wed need to overwrite sysconfdir 
for 'make install' and should probably rename the 
lightdm-configuration->greeters-config-dir function).



>> This means one currently has to specify the default session with
>> something like
>>
>> (service lightdm-service-type
>> 	 (lightdm-configuration
>> 	  (seats
>> 	   (list
>> 	    (lightdm-seat-configuration
>> 	     (name "*")
>> 	     (user-session "xfce"))))))
>>
> 
> [...]
> 
>> This might be fixed by making the lightdm-activiation snippet actually
>> useful: It currently searches for a file named "directory" to fix
>> permissions rather than the content of the variable 'directory'.
>>
>> (find-files "directory"  #:directories? #t) vs
>> (find-files directory  #:directories? #t)
>>
>> here
>> https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/services/lightdm.scm#n527
> 
> Fixed.
> 
>> 4. tigervnnc
>>
>> default tigervnc is (file-append tigervnc-server "bin/Xvnc") rather
>> than (file-append tigervnc-server "/bin/Xvnc")
> 
> Also fixed (see commit e4e1e16bc1).
> 

Thanks :)
[lightdm.diff (text/x-patch, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#73859; Package guix. (Thu, 24 Oct 2024 00:53:02 GMT) Full text and rfc822 format available.

Message #14 received at 73859 <at> debbugs.gnu.org (full text, mbox):

From: Feng Shu <tumashu <at> 163.com>
To: 73859 <at> debbugs.gnu.org
Subject: lightdm
Date: Thu, 24 Oct 2024 08:51:44 +0800
Wow, good news.

Some month ago, I have spend many times to find why session can not be
found, but not success


-- 





Information forwarded to bug-guix <at> gnu.org:
bug#73859; Package guix. (Fri, 25 Oct 2024 08:43:02 GMT) Full text and rfc822 format available.

Message #17 received at 73859 <at> debbugs.gnu.org (full text, mbox):

From: Feng Shu <tumashu <at> 163.com>
To: 73859 <at> debbugs.gnu.org
Subject: lightdm
Date: Fri, 25 Oct 2024 16:41:55 +0800
I have tested and found that:


In lightdm-gtk-greeter, the following line run success and return no session.

   items = lightdm_get_sessions ();


But, in lightdm, the following function in liblightdm-gobject/session.c is not called:

/**
 * lightdm_get_sessions:
 *
 * Get the available sessions.
 *
 * Return value: (element-type LightDMSession) (transfer none): A list of #LightDMSession
 **/
GList *
lightdm_get_sessions (void)
{
    g_debug ("Run lightdm_get_sessions");
    update_sessions ();
    return local_sessions;
}


I do not know why, seem to very confuse.


-- 





Information forwarded to bug-guix <at> gnu.org:
bug#73859; Package guix. (Sat, 02 Nov 2024 10:20:02 GMT) Full text and rfc822 format available.

Message #20 received at 73859 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: 73859 <at> debbugs.gnu.org
Cc: Dariqq <dariqq <at> posteo.net>, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH 1/2] gnu: lightdm: Use global sysconfdir.
Date: Sat,  2 Nov 2024 10:18:32 +0000
* gnu/packages/display-managers.scm (lightm)
[#:configure-flags]: Set sysconfdir to /etc.
[#:phases]: Overwrite sysconfdir in 'installE. for installing sample config files

Change-Id: If9c6ce810c726551bd3bf568d50cad8680829262
---
 gnu/packages/display-managers.scm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/display-managers.scm b/gnu/packages/display-managers.scm
index 5152eb6479..b210b11bc6 100644
--- a/gnu/packages/display-managers.scm
+++ b/gnu/packages/display-managers.scm
@@ -385,6 +385,7 @@ (define-public lightdm
       #:parallel-tests? #f             ; fails when run in parallel
       #:configure-flags
       #~(list "--localstatedir=/var"
+              "--sysconfdir=/etc"
               "--enable-gtk-doc"
               ;; Otherwise the test suite fails on such a warning.
               "CFLAGS=-Wno-error=missing-prototypes")
@@ -412,7 +413,11 @@ (define-public lightdm
                 `("GI_TYPELIB_PATH" ":" prefix (,(getenv "GI_TYPELIB_PATH"))))
               ;; Avoid printing locale warnings, which trip up the text
               ;; matching tests.
-              (unsetenv "LC_ALL"))))))
+              (unsetenv "LC_ALL")))
+          (replace 'install
+           (lambda* (#:key make-flags #:allow-other-keys)
+             (apply invoke "make" "install" (string-append "sysconfdir=" #$output "/etc")
+                    make-flags))))))
     (inputs
      (list audit
            bash-minimal                 ;for cross-compilation
-- 
2.46.0





Information forwarded to bug-guix <at> gnu.org:
bug#73859; Package guix. (Sat, 02 Nov 2024 10:20:02 GMT) Full text and rfc822 format available.

Message #23 received at 73859 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: 73859 <at> debbugs.gnu.org
Cc: Dariqq <dariqq <at> posteo.net>, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH 0/2] lightdm: Fix empty session list.
Date: Sat,  2 Nov 2024 10:18:31 +0000
This changes lightdm and the service to use the config file from a well-known location in /etc/lightdm/lightdm.conf s.t. the gtk-greeter knows about our custom "sessions-directory".

I then removed the custom config file from the lightdm servcice and removed passing XDG_CONFIG_DIRS which are no longer neccesary.

Renamed lightdm-configuration->greeters-config-dir to just lightdm-configuration-directory (inspired by how the dbus-service names its directory) and also moved the etc-extension into a seperate procedure for consistency with other services.


I tested this on my i686 pc and ran 'make check-system TESTS=lightdm' successfully


This is also the approach done on NixOS, see

* https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/applications/display-managers/lightdm/default.nix#L93
*https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/services/x11/display-managers/lightdm.nix#L259

Fixes https://issues.guix.gnu.org/68055


Dariqq (2):
  gnu: lightdm: Use global sysconfdir.
  gnu: lightdm-service-type: Add lightdm.conf to /etc/lightdm.

 gnu/packages/display-managers.scm |  7 ++++-
 gnu/services/lightdm.scm          | 48 ++++++++++++++-----------------
 2 files changed, 27 insertions(+), 28 deletions(-)


base-commit: ea11d3608566174c4bae70faa4f9d0c67748d2db
-- 
2.46.0





Information forwarded to bug-guix <at> gnu.org:
bug#73859; Package guix. (Sat, 02 Nov 2024 10:20:03 GMT) Full text and rfc822 format available.

Message #26 received at 73859 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: 73859 <at> debbugs.gnu.org
Cc: Dariqq <dariqq <at> posteo.net>, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH 2/2] gnu: lightdm-service-type: Add lightdm.conf to
 /etc/lightdm.
Date: Sat,  2 Nov 2024 10:18:33 +0000
* gnu/services/lightdm.scm
(lightdm-configuration->greeters-config-dir): Rename to
lightdm-configuration-directory and add the lightdm-configuration-file.
(lightdm-shepherd-service): Don't pass the configuration file, don't set
XDG_CONFIG_DIRS
(lightdm-etc-service): New procedure.
(lightdm-service-type): Use lightdm-etc-service as the etc-extension.

Change-Id: I982ec1f7bdfd085621f45a8a1e4b175ab481202f
---
 gnu/services/lightdm.scm | 48 ++++++++++++++++++----------------------
 1 file changed, 21 insertions(+), 27 deletions(-)

diff --git a/gnu/services/lightdm.scm b/gnu/services/lightdm.scm
index 798c106563..191cb5635b 100644
--- a/gnu/services/lightdm.scm
+++ b/gnu/services/lightdm.scm
@@ -397,15 +397,6 @@ (define-configuration/no-serialization lightdm-configuration
    (list-of-strings '())
    "Extra configuration values to append to the LightDM configuration file."))
 
-(define (lightdm-configuration->greeters-config-dir config)
-  "Return a directory containing all the serialized greeter configurations
-from CONFIG, a <lightdm-configuration> object."
-  (file-union "etc-lightdm"
-              (append-map (lambda (g)
-                            `((,(greeter-configuration->conf-name g)
-                               ,(greeter-configuration->file g))))
-                          (lightdm-configuration-greeters config))))
-
 (define (lightdm-configuration->packages config)
   "Return all the greeter packages and their assets defined in CONFIG, a
 <lightdm-configuration> object, as well as the lightdm package itself."
@@ -496,6 +487,16 @@ (define (lightdm-configuration-file config)
                                        lightdm-seat-configuration-fields)))
           seats))))
 
+(define (lightdm-configuration-directory config)
+  "Return a directory containing the serialized lightdm configuration
+and all the serialized greeter configurations from CONFIG."
+  (file-union "etc-lightdm"
+              (cons `("lightdm.conf" ,(lightdm-configuration-file config))
+                    (map (lambda (g)
+                           `(,(greeter-configuration->conf-name g)
+                             ,(greeter-configuration->file g)))
+                         (lightdm-configuration-greeters config)))))
+
 (define %lightdm-accounts
   (list (user-group (name "lightdm") (system? #t))
         (user-account
@@ -589,9 +590,7 @@ (define (lightdm-shepherd-service config)
                            "/sbin/lightdm")
             #$@(if (lightdm-configuration-debug? config)
                    #~("--debug")
-                   #~())
-            "--config"
-            #$(lightdm-configuration-file config)))
+                   #~())))
 
   (define lightdm-paths
     (let ((lightdm (lightdm-configuration-lightdm config)))
@@ -601,9 +600,6 @@ (define (lightdm-shepherd-service config)
                  '("/bin" "/sbin" "/libexec"))
          ":")))
 
-  (define greeters-config-dir
-    (lightdm-configuration->greeters-config-dir config))
-
   (define data-dirs
     ;; LightDM itself needs to be in XDG_DATA_DIRS for the accountsservice
     ;; interface it provides to be picked up.  The greeters must also be in
@@ -626,11 +622,7 @@ (define (lightdm-shepherd-service config)
                                   ;; Lightdm needs itself in its PATH.
                                   #:environment-variables
                                   (list
-                                   ;; It knows to look for greeter
-                                   ;; configurations in XDG_CONFIG_DIRS...
-                                   (string-append "XDG_CONFIG_DIRS="
-                                                  #$greeters-config-dir)
-                                   ;; ... and for greeter .desktop files as
+                                   ;; It looks for greeter .desktop files as
                                    ;; well as lightdm accountsservice
                                    ;; interface in XDG_DATA_DIRS.
                                    (string-append "XDG_DATA_DIRS="
@@ -638,6 +630,11 @@ (define (lightdm-shepherd-service config)
                                    (string-append "PATH=" #$lightdm-paths))))
     (stop #~(make-kill-destructor)))))
 
+(define (lightdm-etc-service config)
+  "Return a list of FILES for @var{etc-service-type} to build the
+/etc/lightdm directory using CONFIG"
+  (list `("lightdm" ,(lightdm-configuration-directory config))))
+
 (define lightdm-service-type
   (handle-xorg-configuration
    lightdm-configuration
@@ -666,13 +663,10 @@ (define lightdm-service-type
            ;; https://github.com/NixOS/nixpkgs/issues/45059.
            (service-extension profile-service-type
                               lightdm-configuration->packages)
-           ;; This is needed for the greeter itself to find its configuration,
-           ;; because XDG_CONF_DIRS gets overridden by /etc/profile.
-           (service-extension
-            etc-service-type
-            (lambda (config)
-              `(("lightdm"
-                 ,(lightdm-configuration->greeters-config-dir config)))))))
+           ;; This is needed for lightdm and greeter
+           ;; to find their configuration
+           (service-extension etc-service-type
+                              lightdm-etc-service)))
     (description "Run @code{lightdm}, the LightDM graphical login manager."))))
 
 
-- 
2.46.0





Added tag(s) patch. Request was from Dariqq <dariqq <at> posteo.net> to control <at> debbugs.gnu.org. (Sat, 02 Nov 2024 10:25:01 GMT) Full text and rfc822 format available.

Merged 68055 73859. Request was from Maxim Cournoyer <maxim.cournoyer <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 15 Dec 2024 14:34:02 GMT) Full text and rfc822 format available.

Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Mon, 16 Dec 2024 02:38:02 GMT) Full text and rfc822 format available.

Notification sent to Dariqq <dariqq <at> posteo.net>:
bug acknowledged by developer. (Mon, 16 Dec 2024 02:38:02 GMT) Full text and rfc822 format available.

Message #35 received at 73859-done <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Dariqq <dariqq <at> posteo.net>
Cc: 73859-done <at> debbugs.gnu.org
Subject: Re: [PATCH 0/2] lightdm: Fix empty session list.
Date: Mon, 16 Dec 2024 11:35:57 +0900
Hi Dariqq,

Dariqq <dariqq <at> posteo.net> writes:

[...]

> Dariqq (2):
>   gnu: lightdm: Use global sysconfdir.
>   gnu: lightdm-service-type: Add lightdm.conf to /etc/lightdm.

Finally pushed to master (see commits b9d7e15f9f and 3a8e19a61d), after
I had some time to properly review and test it.  I've adjusted the
commit messages a bit, and used this Scheme trick to reuse more of the
install phase arguments:

--8<---------------cut here---------------start------------->8---
               ;; matching tests.
-              (unsetenv "LC_ALL"))))))
+              (unsetenv "LC_ALL")))
+          (replace 'install
+            (lambda* (#:key make-flags #:allow-other-keys #:rest args)
+              ;; Override the sysconfdir flag only for the installation phase,
+              ;; as it attempts to write the sample config files to /etc and
+              ;; fail otherwise.
+              (define make-flags*
+                (append make-flags (list (string-append "sysconfdir="
+                                                        #$output "/etc"))))
+              (apply (assoc-ref %standard-phases 'install)
+                     (append args (list #:make-flags make-flags*))))))))
     (inputs
--8<---------------cut here---------------end--------------->8---

Closing.

-- 
Thanks,
Maxim




Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Mon, 16 Dec 2024 02:38:02 GMT) Full text and rfc822 format available.

Notification sent to Feng Shu <tumashu <at> 163.com>:
bug acknowledged by developer. (Mon, 16 Dec 2024 02:38:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 13 Jan 2025 12:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 249 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.