Bug 242129 - x11/lightdm-gtk-greeter: Crashes when run with daemon login class
Summary: x11/lightdm-gtk-greeter: Crashes when run with daemon login class
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Ben Woods
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-21 04:32 UTC by Daniel O'Connor
Modified: 2020-02-22 05:57 UTC (History)
3 users (show)

See Also:
woodsb02: maintainer-feedback+


Attachments
Proposed patch (1.61 KB, patch)
2019-12-04 18:10 UTC, Guido Falsi
woodsb02: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel O'Connor 2019-11-21 04:32:49 UTC
I find lightdm-gtk-greeter segfaults when lightdm runs.
I did some digging and it gets run with a login class of daemon but if I change that to root it runs fine(!)

I did this by adding
lightdm_login_class="root"
to the rc.d script.

Unfortunately it appears to not dump core which makes debugging a challenge..

If I run lightdm manually I get..
[maarsy-acq3 4:22] /usr/src> sudo limits -C daemon /usr/local/sbin/lightdm -d
[+0.00s] DEBUG: Logging to /var/log/lightdm/lightdm.log
[+0.00s] DEBUG: Starting Light Display Manager 1.30.0, UID=0 PID=26501
[+0.00s] DEBUG: Loading configuration dirs from /usr/local/share/lightdm/lightdm.conf.d
[+0.00s] DEBUG: Loading configuration dirs from /etc/xdg/lightdm/lightdm.conf.d
[+0.00s] DEBUG: Loading configuration dirs from /usr/local/etc/xdg/lightdm/lightdm.conf.d
[+0.00s] DEBUG: Loading configuration from /usr/local/etc/lightdm/lightdm.conf
[+0.00s] DEBUG: Registered seat module local
[+0.00s] DEBUG: Registered seat module xremote
[+0.00s] DEBUG: Using D-Bus name org.freedesktop.DisplayManager
[+0.00s] WARNING: Failed to get list of logind seats: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.login1 was not provided by any .service files
[+0.00s] DEBUG: Adding default seat
[+0.00s] DEBUG: Seat seat0: Loading properties from config section Seat:*
[+0.00s] DEBUG: Seat seat0: Starting
[+0.00s] DEBUG: Seat seat0: Creating greeter session
[+0.00s] DEBUG: Seat seat0: Creating display server of type x
[+0.42s] DEBUG: Could not run plymouth --ping: Failed to execute child process ?plymouth? (No such file or directory)
[+0.42s] DEBUG: Using VT 9
[+0.42s] DEBUG: Seat seat0: Starting local X display on VT 9
[+0.42s] DEBUG: XServer 0: Logging to /var/log/lightdm/x-0.log
[+0.42s] DEBUG: XServer 0: Writing X server authority to /var/run/lightdm/root/:0
[+0.42s] DEBUG: XServer 0: Launching X Server
[+0.42s] DEBUG: Launching process 26503: /usr/local/bin/X :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt9 -novtswitch
[+0.42s] DEBUG: XServer 0: Waiting for ready signal from X server :0
[+0.42s] DEBUG: Acquired bus name org.freedesktop.DisplayManager
[+0.42s] DEBUG: Registering seat with bus path /org/freedesktop/DisplayManager/Seat0
[+0.42s] DEBUG: Loading users from org.freedesktop.Accounts
[+0.42s] DEBUG: User /org/freedesktop/Accounts/User19999 added
[+2.09s] DEBUG: Got signal 30 from process 26503
[+2.09s] DEBUG: XServer 0: Got signal from X server :0
[+2.09s] DEBUG: XServer 0: Connecting to XServer :0
[+2.51s] DEBUG: Seat seat0: Display server ready, starting session authentication
[+2.51s] DEBUG: Session pid=26514: Started with service 'lightdm-greeter', username 'lightdm'
[+2.51s] DEBUG: Session pid=26514: Authentication complete with return value 0: Success
[+2.51s] DEBUG: Seat seat0: Session authenticated, running command
[+2.51s] DEBUG: Session pid=26514: Running command /usr/local/sbin/lightdm-gtk-greeter
[+2.51s] DEBUG: Creating shared data directory /var/lib/lightdm-data/lightdm
[+2.51s] DEBUG: Session pid=26514: Logging to /var/log/lightdm/seat0-greeter.log
[+2.93s] DEBUG: Activating ConsoleKit session maarsy-acq3.gsoft.com.au-1574310147.624690-886096234
[+3.57s] DEBUG: Greeter closed communication channel
[+3.58s] DEBUG: Session pid=26514: Exited with return value 1
[+3.58s] DEBUG: Seat seat0: Session stopped
[+3.58s] DEBUG: Seat seat0: Stopping; failed to start a greeter
[+3.58s] DEBUG: Seat seat0: Stopping
[+3.58s] DEBUG: Seat seat0: Stopping display server
[+3.58s] DEBUG: Sending signal 15 to process 26503
[+3.72s] DEBUG: Process 26503 exited with return value 0
[+3.72s] DEBUG: XServer 0: X server stopped
[+3.72s] DEBUG: Releasing VT 9
[+3.72s] DEBUG: XServer 0: Removing X server authority /var/run/lightdm/root/:0
[+3.72s] DEBUG: Seat seat0: Display server stopped
[+3.72s] DEBUG: Seat seat0: Stopped
[+3.72s] DEBUG: Required seat has stopped
[+3.72s] DEBUG: Stopping display manager
[+3.72s] DEBUG: Display manager stopped
[+3.72s] DEBUG: Stopping daemon
[+3.72s] DEBUG: Exiting with return value 1

ktrace -di on it produced a 1.7GB file though..
I found this nugget in it:
 26561 Xorg     RET   munmap 0
 26561 Xorg     CALL  openat(AT_FDCWD,0x80096d243,0x100002<O_RDWR|O_CLOEXEC>)
 26561 Xorg     NAMI  "/dev/mem"
 26561 Xorg     RET   openat 3
 26561 Xorg     CALL  ioctl(0x3,MEMRANGE_SET,0x7fffffffeab0)
 26561 Xorg     RET   ioctl -1 errno 2 No such file or directory
I have attached the result of..
kdump -s | bzip2 > kdump.txt.bz2
which is only 11MB.

as well as..
 26563 lightdm  CALL  fcntl(0xa5163,F_SETFD,FD_CLOEXEC)
 26563 lightdm  RET   fcntl -1 errno 9 Bad file descriptor
 26563 lightdm  CALL  fcntl(0xa5164,F_SETFD,FD_CLOEXEC)
 26563 lightdm  RET   fcntl -1 errno 9 Bad file descriptor
 26563 lightdm  CALL  fcntl(0xa5165,F_SETFD,FD_CLOEXEC)
 26563 lightdm  RET   fcntl -1 errno 9 Bad file descriptor
 26563 lightdm  CALL  fcntl(0xa5166,F_SETFD,FD_CLOEXEC)
 26563 lightdm  RET   fcntl -1 errno 9 Bad file descriptor
(Probably not related to this but still)
Comment 1 Daniel O'Connor 2019-11-21 04:33:32 UTC
Actually I couldn't attach it, I have hosted it at
http://www.gsoft.com.au/~doconnor/kdump.txt.bz2
Comment 2 Guido Falsi freebsd_committer freebsd_triage 2019-11-21 06:50:47 UTC
This looks like a bug I thought I fixed.


The problem could be lightDM requiring locked memory, and the daemon class limits that to 128MB by default, which is not enough.

Please check that you have this in /usr/local/etc/lightdm/lightdm.conf:

[LightDM]
lock-memory=false

If it still fails maybe the daemon is ignoring that config.

You can make it work anyway by modifying /etc/login.conf and setting the locked memory limit for daemon to 256 MB and restarting lightdm (don't forget to run cap_mkdb /etc/login.conf).

Hope this helps.
Comment 3 Daniel O'Connor 2019-11-21 06:53:52 UTC
Unfortunately lock-memory=false is already there so I guess it must be a different issue.
Comment 4 Guido Falsi freebsd_committer freebsd_triage 2019-11-21 07:01:42 UTC
(In reply to darius from comment #3)
> Unfortunately lock-memory=false is already there so I guess it must be a different issue.


Have you anyway tried to increment the locked memory limit in login.conf? It's worth a test anyway.
Comment 5 Daniel O'Connor 2019-11-21 07:10:11 UTC
Good idea, I should have done that!
It does work if I increase the locked memory limit for daemon (and remove my mod).

Perhaps the greeter is trying to lock memory too (and the config directive is for lightdm itself)?
Comment 6 Guido Falsi freebsd_committer freebsd_triage 2019-11-21 07:29:52 UTC
Darius suggested on IRC that maybe it's lightdm-gtk-greeter locking memory, and he's correct.


in light-gtk-greeter sources at src/lightdm-gtk-greeter.c line 2752:

    /* Prevent memory from being swapped out, as we are dealing with passwords */
    mlockall (MCL_CURRENT | MCL_FUTURE);


This is unconditional, we can simply comment it out or implement a configuration directive or something.


woodsb02 what do you think?
Comment 7 Guido Falsi freebsd_committer freebsd_triage 2019-12-04 18:10:41 UTC
Created attachment 209703 [details]
Proposed patch

I'm proposing this simple patch.

It comments out the mlockall(2) system call, stopping the greeter from locking all its memory.

This is the correct solution IMHO, there is no point in locking all the memory a GUI program uses.


Ben what you think about this?
Comment 8 Ben Woods freebsd_committer freebsd_triage 2020-01-20 23:22:50 UTC
Can you please check if the most recent updated to the x11/lightdm port (new package version is lightdm-1.30.0_2) has fixed the problem for you?

Essentially I was getting reports of a different issue, and the problem turned out to be the lightdm user needed access to the video group in order to use the graphics drivers.
https://svnweb.freebsd.org/changeset/ports/523696
Comment 9 Daniel O'Connor 2020-01-22 01:00:31 UTC
I don't need to add lightdm to the video group, but perhaps it is required for other video drivers (I am using nvidia)

For my case it only seems to be the locked memory issue.
Comment 10 Ben Woods freebsd_committer freebsd_triage 2020-02-22 05:57:03 UTC
Hi darius and madpilot,

As it turns out, the upstream lightdm-gtk-greeter developers have recently disabled mlockall, and this change is included in the 2.0.7 release.

This has been committed to the ports head branch in r526738:
http://svnweb.freebsd.org/changeset/ports/526738

Can you please test and confirm it is fixed? I will close this bug in the meantime.

Regards,
Ben
Comment 11 Ben Woods freebsd_committer freebsd_triage 2020-02-22 05:57:38 UTC
Comment on attachment 209703 [details]
Proposed patch

This patch is correct, but it is no longer needed since it has been incorporated upstream.