Bug 1272261 - x server dies when systemd-logind dies (on resume from suspend) . why?
x server dies when systemd-logind dies (on resume from suspend) . why?
Status: CLOSED CANTFIX
Product: Fedora
Classification: Fedora
Component: xorg-x11-server (Show other bugs)
22
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: X/OpenGL Maintenance List
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-15 18:29 EDT by Hin-Tak Leung
Modified: 2015-10-16 08:22 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-10-16 03:17:37 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Hin-Tak Leung 2015-10-15 18:29:44 EDT
Description of problem:
x server dies when systemd-logind dies. why?

Thhis is a follow-on:

Bug 1272259 - logind self destructs in udev_device_read_db.constprop () on resuming from sleep - systemd-logind killed by SIGABRT 

I'd have liked to just clone it, but haven't found a clone bug button now. (it used to be there?)

Bottom part of $HOME/.local/share/xorg/Xorg.0.log
===========
[ 35599.403] (II) systemd-logind: got resume for 13:66
[ 51585.789] (II) AIGLX: Suspending AIGLX clients for VT switch
[ 51626.083] (II) systemd-logind: got pause for 226:0
[ 51626.387] (II) systemd-logind: got pause for 13:67
[ 51626.402] (II) systemd-logind: got pause for 13:74
[ 51626.402] (II) systemd-logind: got pause for 13:64
[ 51626.402] (II) systemd-logind: got pause for 13:70
[ 51626.402] (II) systemd-logind: got pause for 13:69
[ 51626.402] (II) systemd-logind: got pause for 13:68
[ 51626.402] (II) systemd-logind: got pause for 13:66
[ 51948.495] (EE) 
Fatal server error:
[ 51948.566] (EE) systemd-logind disappeared (stopped/restarted?)
[ 51948.566] (EE) 
[ 51948.566] (EE) 
Please consult the Fedora Project support 
	 at http://wiki.x.org
 for help. 
[ 51948.566] (EE) Please also check the log file at "/home/Hin-Tak/.local/share/xorg/Xorg.0.log" for additional information.
[ 51948.566] (EE) 
[ 51955.181] (EE) systemd-logind: ReleaseControl failed: Unit dbus-org.freedesktop.login1.service failed to load: File exists. See system logs and 'systemctl status dbus-org.freedesktop.login1.service' for details.
[ 51972.158] (EE) Server terminated with error (1). Closing log file.
=====================


Version-Release number of selected component (if applicable):

[   122.469] 
X.Org X Server 1.17.2
Release Date: 2015-06-16
[   122.470] X Protocol Version 11, Revision 0
[   122.470] Build Operating System:  4.1.6-100.fc21.x86_64 
[   122.470] Current Operating System: Linux localhost.localdomain 4.1.10-200.fc22.x86_64 #1 SMP Mon Oct 5 14:22:49 UTC 2015 x86_64
[   122.470] Kernel command line: BOOT_IMAGE=/vmlinuz-4.1.10-200.fc22.x86_64 root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/swap vco
nsole.font=latarcyrheb-sun16 rd.lvm.lv=fedora/root rhgb quiet LANG=en_GB.UTF-8
[   122.470] Build Date: 16 September 2015  06:13:30PM
[   122.470] Build ID: xorg-x11-server 1.17.2-2.fc22.2 

xorg-x11-drv-ati-7.5.0-3.fc22.x86_64
xorg-x11-drv-evdev-2.9.2-1.fc22.x86_64
xorg-x11-drv-fbdev-0.4.3-20.fc22.x86_64
xorg-x11-drv-synaptics-1.8.2-2.fc22.x86_64
xorg-x11-drv-vesa-2.3.2-20.fc22.x86_64
xorg-x11-server-Xorg-1.17.2-2.fc22.2.x86_64
mesa-libGL-10.6.9-1.20151008.fc22.x86_64


How reproducible:
Once, but rather annoying enough - and I am not sure what's the relevance of systemd-logind to the X server.

Steps to Reproduce:
1. suspend/resume
2. wait for systemd-logind to self destruct.
3. see X dies with it.

Actual results:
X dies.

Expected results:
X lives.

Additional info:
Comment 1 Hans de Goede 2015-10-16 03:17:37 EDT
The xserver now a days relies on logind to manage its hardware file-descriptors for it, so the fds for the gpu and input devices, this is done so that the xserver no longer needs to run as root, which is a big security win.

When logind dies the server still has a gpu/drm fd with the master bit set on it, but that ends as soon as one switches to another vt (e.g. ctrl + alt + f3), and then when you switch back to the vt with the xserver the server will not be able to become drm-master again and crash at that point.

Even assuming that logind has restarted at that point, and somehow recognizes the xserver as a valid user session even though it was not around when it started, we can get a new drm fd, but that is no good
since all our hardware state is tied to the old fd.

This has been discussed with both X and systemd people and the conclusion was that this is unfixable, logind simply should not crash. From the xserver side the decision was made to exit immediately when logind dies, rather then waiting for a vt-switch and die then. This was done so that users would properly correlate the xserver death with the logind death, and not file a bug that the xserver crashed on vt-switch. Your filing of this bug report shows that theory was correct :)

TL;DR: Yes this is annoying, but there is nothing we can do from the X side to fix this, logind simply should not crash.
Comment 2 Hin-Tak Leung 2015-10-16 07:14:36 EDT
(In reply to Hans de Goede from comment #1)
...
> When logind dies the server still has a gpu/drm fd with the master bit set
> on it, but that ends as soon as one switches to another vt (e.g. ctrl + alt
> + f3), and then when you switch back to the vt with the xserver the server
> will not be able to become drm-master again and crash at that point.
...

But that's the first thing one tries if the screen isn't responsive! I did not want to switch VT to crash the x server - I was switching VT because the xserver wasn't reponsive (the screen lights up after resume, but shows nothing), it is almost standard procedure to try switching VT to get a text console to break the system back, or reboot the system cleanly! (instead of hitting the power switch...)
Comment 3 Hans de Goede 2015-10-16 08:22:14 EDT
Hi,

(In reply to Hin-Tak Leung from comment #2)
> (In reply to Hans de Goede from comment #1)
> ...
> > When logind dies the server still has a gpu/drm fd with the master bit set
> > on it, but that ends as soon as one switches to another vt (e.g. ctrl + alt
> > + f3), and then when you switch back to the vt with the xserver the server
> > will not be able to become drm-master again and crash at that point.
> ...
> 
> But that's the first thing one tries if the screen isn't responsive! I did
> not want to switch VT to crash the x server - I was switching VT because the
> xserver wasn't reponsive (the screen lights up after resume, but shows
> nothing), it is almost standard procedure to try switching VT to get a text
> console to break the system back, or reboot the system cleanly! (instead of
> hitting the power switch...)

I think you've understood me wrong. The xserver would crash on vt-switch after logind died if we were to do nothing when logind dies. This is why we terminate the xserver as soon as logind dies, as your logs show. So you can safely vt-switch after this since the xserver has cleanly exited at this point.

Note You need to log in before you can comment on or make changes to this bug.