FS#46655 - [systemd/dbus] multiple sessions on X with same user breaks gnome-terminal

Attached to Project: Arch Linux
Opened by Tom Yan (tom.ty89) - Sunday, 11 October 2015, 08:03 GMT
Last edited by Doug Newgard (Scimmia) - Sunday, 18 October 2015, 03:02 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
When I log in on tty1 and startx then logged in on tty2 and startx with the same user, gnome-terminal will break on tty1 if I kill X in tty2, but it won't break on tty2 if I kill X on tty1.

That is, killing an X started earlier first will not break it (1to2):

[running gnome-terminal in later X after eariler X is killed]
Oct 11 14:28:29 localhost dbus-daemon[398]: Activating service name='org.gtk.vfs.Daemon'
Oct 11 14:28:29 localhost dbus-daemon[398]: Successfully activated service 'org.gtk.vfs.Daemon'
Oct 11 14:28:29 localhost kernel: fuse init (API version 7.23)
Oct 11 14:28:29 localhost systemd[1]: Mounting FUSE Control File System...
Oct 11 14:28:29 localhost systemd[1]: Mounted FUSE Control File System.
Oct 11 14:28:29 localhost dbus-daemon[398]: Activating service name='org.a11y.Bus'
Oct 11 14:28:29 localhost dbus-daemon[398]: Successfully activated service 'org.a11y.Bus'
Oct 11 14:28:29 localhost org.a11y.Bus[398]: Activating service name='org.a11y.atspi.Registry'
Oct 11 14:28:29 localhost dbus-daemon[398]: Activating service name='org.gnome.Terminal'
Oct 11 14:28:29 localhost org.a11y.Bus[398]: Successfully activated service 'org.a11y.atspi.Registry'
Oct 11 14:28:29 localhost org.a11y.atspi.Registry[506]: SpiRegistry daemon is running with well-known name - org.a11y.atspi.Registry
Oct 11 14:28:29 localhost dbus-daemon[398]: Successfully activated service 'org.gnome.Terminal'
[killing later X]
Oct 11 14:28:54 localhost org.a11y.atspi.Registry[506]: XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":1"
Oct 11 14:28:54 localhost org.a11y.atspi.Registry[506]: after 90 requests (90 known processed) with 0 events remaining.

but killing an X started later first will do (2to1):

[running gnome-terminal on earlier X after later X is killed]
Oct 11 14:32:00 localhost dbus-daemon[400]: Activating service name='org.gtk.vfs.Daemon'
Oct 11 14:32:00 localhost dbus-daemon[400]: Successfully activated service 'org.gtk.vfs.Daemon'
Oct 11 14:32:00 localhost kernel: fuse init (API version 7.23)
Oct 11 14:32:00 localhost systemd[1]: Mounting FUSE Control File System...
Oct 11 14:32:00 localhost systemd[1]: Mounted FUSE Control File System.
Oct 11 14:32:00 localhost dbus-daemon[400]: Activating service name='org.a11y.Bus'
Oct 11 14:32:00 localhost dbus-daemon[400]: Successfully activated service 'org.a11y.Bus'
Oct 11 14:32:00 localhost org.a11y.Bus[400]: Activating service name='org.a11y.atspi.Registry'
Oct 11 14:32:00 localhost dbus-daemon[400]: Activating service name='org.gnome.Terminal'
Oct 11 14:32:00 localhost org.a11y.atspi.Registry[509]: ** (at-spi2-registryd:511): WARNING **: Could not open X display
Oct 11 14:32:00 localhost org.a11y.Bus[400]: Successfully activated service 'org.a11y.atspi.Registry'
Oct 11 14:32:00 localhost org.a11y.atspi.Registry[509]: SpiRegistry daemon is running with well-known name - org.a11y.atspi.Registry
Oct 11 14:32:00 localhost org.a11y.atspi.Registry[509]: ** (at-spi2-registryd:511): WARNING **: AT-SPI: Cannot open default display
Oct 11 14:32:00 localhost org.gnome.Terminal[400]: Unable to init server: Could not connect: Connection refused
Oct 11 14:32:00 localhost org.gnome.Terminal[400]: Failed to parse arguments: Cannot open display:
Oct 11 14:32:00 localhost dbus-daemon[400]: Activated service 'org.gnome.Terminal' failed: Process org.gnome.Terminal exited with status 1
[killing earlier X, no further log on journal for that but the following message is shown on the tty]
Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0:
Error calling StartServiceByName for org.gnome.Terminal:
GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited:
Process org.gnome.Terminal exited with status 1

In the attached full journals you can see that I am logged in on tty3 and tty4 as well, but I didn't startx there, tty3 is for `journalctl -f` and tty4 is for `pgrep -a X` and `kill $X_PID`. The two cases are done in seperated fresh boot.

The problem does not occur if I log in and startx with different user.


Additional info:
systemd 226-3
dbus 1.10.0-3
gnome-terminal 3.18.0-1

   1to2 (79.8 KiB)
   2to1 (80 KiB)
This task depends upon

Closed by  Doug Newgard (Scimmia)
Sunday, 18 October 2015, 03:02 GMT
Reason for closing:  None
Additional comments about closing:  Requested by user, related to  FS#46374 
Comment by Tom Yan (tom.ty89) - Sunday, 11 October 2015, 08:26 GMT
Seems at least some "DE"s cannot even be started in the same way at all as well. In the above case I was on i3. Now I attach here the full journals after startx failed for gnome-session and startkde in the second login. Again there's no apparent problem if I log in with different user.

P.S. I have xorg-xinit 1.3.4-3 and my .xinitrc sources /etc/X11/xinit/xinitrc.d/* on all test cases. I am using the nvidia 355.11-3 driver, not sure if it would matter.

EDIT: Just confirmed that all problems happen the same way with rootless X on i915 + modesetting_drv. Btw I do think that this is probably something upstream, it's just I am not sure which part of system is responsible for it (systemd/dbus/xorg{,-xinit}/gnome{,-terminal}...), so I figure I could file here and see if the Arch devs and others can give me some hint.
Comment by Doug Newgard (Scimmia) - Monday, 12 October 2015, 20:43 GMT
I'm guessing this is related to  FS#46374 
Comment by Tom Yan (tom.ty89) - Tuesday, 13 October 2015, 06:56 GMT
You definitely gave me a hint. The issue basically lies on "/etc/X11/xinit/xinitrc.d/50-systemd-user.sh", well, or at least it reveals a limitation of the current way we deal with the user dbus thing. In the past it does not rely on this "one-time DISPLAY update/import" thing, but only looks at the env var directly instead (if it matters back then) so it is "dynamic". But now once we startx again the DISPLAY in systemd/dbus is overwritten. While things like gnome-terminal will still work if the "X of the DISPLAY" is alive, they break once it is gone (this also explains that why things will work again if I start it again).

But the thing is we can't (or currently don't) use the same DISPLAY for multiple X and there's no way to have "multiple" DISPLAY in systemd/dbus either. So it seems that multiple X login with same user is simply no longer effectively practical. (Well, one of the workaround is to source the script MANUALLY with the a "usable" DISPLAY set whenever it breaks...)

I guess I'll just leave it. This just seems to be a whole big design defect...

P.S. FWIW, this doesn't seems to be quite relevant with the gnome-session and startkde issue I mentioned above, but there seems to be no point to bother about that when even simpler things can't be done nicely...
Comment by Doug Newgard (Scimmia) - Saturday, 17 October 2015, 14:16 GMT
So is this essentially the same complaint as  FS#46374 ? I need to do something with this ticket, should I close it as a duplicate or assign it to the dbus maintainer?
Comment by Tom Yan (tom.ty89) - Saturday, 17 October 2015, 20:37 GMT
I guess you should just close it. Maybe I'll bring it up on upstream someday.

Loading...