FS#63706 - [gdm] Gdm will not start due to gdm used created by systemd-sysusers
Attached to Project:
Arch Linux
Opened by Tobias Hunger (hunger) - Monday, 09 September 2019, 16:56 GMT
Last edited by Jan Alexander Steffens (heftig) - Friday, 13 September 2019, 22:07 GMT
Opened by Tobias Hunger (hunger) - Monday, 09 September 2019, 16:56 GMT
Last edited by Jan Alexander Steffens (heftig) - Friday, 13 September 2019, 22:07 GMT
|
Details
Description:
Since version 243 systemd-sysusers will produce system users with expired accounts. You can check this by running "chage -l gdm" in a pacstrap directory. This is an intentional change in systemd (see comments in Gdm will not start in such a setup: It detects that the account is expired and will not start. Additional info: * systemd 243.0-1 Steps to reproduce: |
This task depends upon
Closed by Jan Alexander Steffens (heftig)
Friday, 13 September 2019, 22:07 GMT
Reason for closing: Fixed
Additional comments about closing: gdm 3.32.0+2+g820f90f5-2
Friday, 13 September 2019, 22:07 GMT
Reason for closing: Fixed
Additional comments about closing: gdm 3.32.0+2+g820f90f5-2
But the journald output pretty clearly states that it will not start due to the gdm user being expired:
> Sep 08 23:58:58 foobar gdm-launch-environment][755]: pam_unix(gdm-launch-environment:account): account gdm has expired (account expired)
"chage -E -1 gdm" fixes the issue for me by the way, but that is probably not a good solution.
systemd-sysusers apparently also does not offer an option to actually not expire the users it creates, so that is not a solution either.
Changing PAM might help, but that is an area of obscure magic to me:-)
account required pam_permit.so
Does that work with the expired gdm user?
gdm supplies different pam files for different distributions e.g [1] [2]
https://gitlab.gnome.org/GNOME/gdm/blob/master/data/pam-arch/gdm-launch-environment.pam
https://gitlab.gnome.org/GNOME/gdm/blob/master/data/pam-redhat/gdm-launch-environment.pam
I would expect that to work, but let me make sure.
That does change something: The screen blanks now, but it stays in text mode (cursor in the upper right corner) and stays there. The UI is not started and there is no password prompt on the console.
Switching to a different console with Alt-Fx gets me to a getty and I can login there.
Looks like this needs some more tweaks:-/
The code would need to check here if the service is gdm-launch-environment and the return code is PAM_ACCT_EXPIRED then return TRUE.
Arch could add back creating the gdm user and group in the install file otherwise this should probably be reported upstream.
https://gitlab.gnome.org/GNOME/gdm/blob/master/daemon/gdm-session-worker.c#L1324
Unfortunately I can't find more relevant logs in the journal.
At least I can check the journal after a reboot:
Sep 10 22:03:52 XXX systemd[1]: Starting User Manager for UID 120...
Sep 10 22:03:52 XXX systemd[772]: pam_unix(systemd-user:account): account gdm has expired (account expired)
Sep 10 22:03:52 XXX systemd[772]: PAM failed: User account has expired
Sep 10 22:03:52 XXX systemd[772]: user@120.service: Failed to set up PAM session: Operation not permitted
Sep 10 22:03:52 XXX systemd[772]: user@120.service: Failed at step PAM spawning /usr/lib/systemd/systemd: Operation not permitted
Sep 10 22:03:52 XXX systemd[1]: user@120.service: Failed with result 'protocol'.
Sep 10 22:03:52 XXX systemd[1]: Failed to start User Manager for UID 120.
I do feel *very* uncomfortable to use pam_permit.so for account in systemd-user! That feels very wrong.
I think we need to make sure the gdm user is not expired. Best bet is probably to file an upstream bug with systemd to add an option for that?
(edit: It actually doesn't; I just got lucky that the user@120.service was kept running between my tests).
account required pam_permit.so
I do not like this solution at all though: pam_permit.so will return "yeap, go ahead" for every request. No idea which whole the change to systemd-user in particular will cause!
Systemd-sysusers was changed to create expired accounts to improve overall system security. Pam_permit.so does pretty much the opposite.
account sufficient pam_succeed_if.so quiet user = gdm
Still a hack, though.
It won't fix an existing setup, though. That still needs a `usermod --expiredate= gdm`.
systemd[559]: pam_unix(systemd-user:account): account lightdm has expired (account expired)
systemd[559]: PAM failed: User account has expired
systemd[559]: user@991.service: Failed to set up PAM session: Operation not permitted
systemd[559]: user@991.service: Failed at step PAM spawning /usr/lib/systemd/systemd: Operation not permitted
systemd[1]: user@991.service: Failed with result 'protocol'.
systemd[1]: Failed to start User Manager for UID 991.
systemd[1]: Started Session c1 of user lightdm.
On reboot after enabling the gdm service the boot process hangs after starting gdm and nothing happens, switching to another tty works so I know the system has come up ok.
Would an acceptable option be to set the GDM user account to never expire using `chage` (this works but not sure on security implications)?
I feel more uncomfortable changing systemd-user pam settings ..
I'll try to squeeze in a testing round tonight.