#948346 xdm gets killed, but only on sunday, on the first startup (code=killed, signal=USR2)

Package:
xdm
Source:
xdm
Description:
X display manager
Submitter:
Johan Laenen
Date:
2024-08-25 06:21:02 UTC
Severity:
important
Tags:
#948346#5
Date:
2020-01-07 16:13:16 UTC
From:
To:
Dear Maintainer,

xdm gets killed on sundays at startup time. It only happens once on sunday. When I delete /var/lib/xdm.pid I can proceed with a xdm restart without any problem.

This is what systemd (systemctl status and journalctl -u xdm.service) reports:

● xdm.service - X-Window Display Manager
Loaded: loaded (/lib/systemd/system/xdm.service; indirect; vendor preset: enabled)
Active: failed (Result: signal) since Sun 2020-01-05 08:30:37 CET; 1min 45s ago
Process: 673 ExecStartPre=/bin/sh -c [ "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/bin/xdm" ] (code=exited, status=0/SUCCESS)
Process: 676 ExecStart=/usr/bin/xdm -nodaemon (code=killed, signal=USR2)
Main PID: 676 (code=killed, signal=USR2)

Jan 05 08:30:31 msi systemd[1]: Starting X-Window Display Manager...
Jan 05 08:30:31 msi systemd[1]: Started X-Window Display Manager.
Jan 05 08:30:34 msi systemd[1]: xdm.service: Main process exited, code=killed, status=12/USR2
Jan 05 08:30:37 msi systemd[1]: xdm.service: Failed with result 'signal'.
-- Logs begin at Sun 2020-01-05 08:30:25 CET, end at Sun 2020-01-05 08:31:56 CET. --
Jan 05 08:30:31 msi systemd[1]: Starting X-Window Display Manager...
Jan 05 08:30:31 msi systemd[1]: Started X-Window Display Manager.
Jan 05 08:30:34 msi systemd[1]: xdm.service: Main process exited, code=killed, status=12/USR2
Jan 05 08:30:37 msi systemd[1]: xdm.service: Failed with result 'signal'.

I have no idea what causes the kill :(

#948346#10
Date:
2020-01-08 00:15:37 UTC
From:
To:
Dear Maintainer,
I could reproduce the issue in a minimal bullseye VM.

From my observations I guess the USR2 signal is sent
by logrotate:

/etc/logrotate.d/xdm:
            kill -s USR2 $(cat /var/run/xdm.pid); \

If I read [1] right, then USR2 has a default action of
process termination. Therefore is my guess that log rotation
is started/finishes too fast and the USR2 signal is sent
before xdm replaced the default with its own signal handler.

With a package built with the following line moved near
the top of the main function I could no more
reproduce the issue:

    (void) Signal (SIGUSR2, ReopenLogFileNotify);

Kind regards,
Bernhard

[1] https://unix.stackexchange.com/questions/38589/why-does-sigusr1-cause-process-to-be-terminated

#948346#15
Date:
2020-08-04 08:49:17 UTC
From:
To:
The attached seems to work on buster.
--
Regards,
ASK

#948346#20
Date:
2021-01-10 11:10:16 UTC
From:
To:
Control: severity 948346 serious

Thanks for the patch, also thanks to Bernhard for investigation.

The patch could be used but it just working around symptoms. I see
multiple bugs involved here.

a) logrotate job using a plain kill. This is racy, even with SysV init.
We can do it better (systemctl kill function).

b) service file not cleaning up the pid file. That file should be gone
even when service terminates.

c) xdm refusing to start when the pid file exists, although the process
is no longer running. It could check whether it's still active, and/or
maybe just kill it and evaluate the errno.

I am setting this to RC severity because it's just NOT ok and obvious to
fix. Going to change mentioned things and NMU this in a couple of weeks
if there is no further reaction from maintainers.

Best regards,
Eduard.

#948346#27
Date:
2021-01-25 05:15:35 UTC
From:
To:
Could you make an upload to DELAYED instead of further waiting?

Thanks
Adrian

#948346#32
Date:
2021-01-25 18:34:34 UTC
From:
To:
Hallo,
* Adrian Bunk [Mon, Jan 25 2021, 07:15:35AM]:

I am no longer waiting, today is timeout day. Will use 7-DAY DELAYED
queue, should be appropriate.

Best regards,
Eduard.

#948346#37
Date:
2021-02-08 00:43:52 UTC
From:
To:
* Eduard Bloch <edi@gmx.de> [210208 00:43]:

That upload somehow did not make it into the archive?

Chris

#948346#42
Date:
2021-02-08 08:41:17 UTC
From:
To:
Hallo,
* Chris Hofstaedtler [Mon, Feb 08 2021, 01:43:52AM]:

Not yet. If you need a patch, please grab the repo from
https://salsa.debian.org/xorg-team/app/xdm/-/merge_requests/2 and/or
contribute to the MR review.

@Julien: okay to add myself as Uploader and upload? And/or do you
actually insist on the changes mentioned in the MR?

Best regards,
Eduard.

#948346#49
Date:
2021-02-08 08:50:29 UTC
From:
To:
No.

Cheers,
Julien

#948346#60
Date:
2021-08-05 00:01:56 UTC
From:
To:
Vielen Dank für die Informationen, die ich über Ihr Facebook-Profil
über Sie erhalten habe. Ich benötige jedoch Ihre Mithilfe, um
humanitäre Hilfe zu verteilen, um das Projekt entsprechend finanziell
zu arrangieren.
Grüße.

#948346#65
Date:
2021-11-20 15:49:19 UTC
From:
To:
Hi,

I had this problem too, and worked around it:

Configure logrotate /etc/logrotate.d/xdm remove weekly and put
size=1G
 

#948346#70
Date:
2024-08-25 06:17:27 UTC
From:
To:
Greetings,

Johan