Automatic unity 2D fallback does not work with remote login

Bug #889996 reported by Tristan Schmelcher
98
This bug affects 21 people
Affects Status Importance Assigned to Milestone
Nux
Invalid
Undecided
Unassigned
Unity
Invalid
Undecided
Unassigned
nux (Ubuntu)
Invalid
Undecided
Unassigned
unity (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

In Oneiric, when logging in remotely with XDMCP + VNC and selecting the "Ubuntu" session, Unity fails to properly fall back to Unity 2D. Instead the user is presented with just their desktop background, with no widgets of any kind. Sometimes a Nautilus-like menu bar briefly appears at the top and then disappears (i.e., File, Edit, View, Go, Bookmarks, Help). Occasionally the menu bar remains visible and/or the user's desktop icons can be seen. In no case does the user ever get a functional Unity 2D session with the launcher.

Manually selecting the "Ubuntu 2D" session results in a functional Unity 2D session as expected.

Replacing /usr/lib/nux/unity_support_test with a symlink to /bin/false causes the "Ubuntu" session to fall back to a functional Unity 2D session as expected. So probably the problem occurs in /usr/lib/nux/unity_support_test.

I have attached the .xsession-errors from an "Ubuntu" session login attempt.

Repro steps:

1) Enable XDMCP login in /etc/lightdm/lightdm.conf by adding:

[XDMCPServer]
enabled=true

2) Install xinetd and vnc4server and set up a VNC port to use XDMCP login by creating a file like this in /etc/xinetd.d:

service Xvnc
{
type = UNLISTED
disable = no
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/bin/Xvnc
server_args = -inetd -query 127.0.0.1 -once -geometry 1920x1200 -depth 24 -securitytypes=none -DisconnectClients=0 -NeverShared
port = 5901
}

3) Restart xinetd & lightdm services.
4) Connect to the chosen VNC port (5901 above) with Vinagre.
5) Login with the "Ubuntu" session selected.

Actual Behaviour:

6) The user is presented with a nonfunctional session.

Expected Behaviour:

6) /usr/lib/nux/unity_support_test should detect that the X11 display does not support COMPOSITE and GLX and should exit with error code 1 so that Unity 2D is used.

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: nux-tools 1.14.0-0ubuntu1
ProcVersionSignature: Ubuntu 3.0.0-12.20-generic 3.0.4
Uname: Linux 3.0.0-12-generic x86_64
NonfreeKernelModules: nvidia
.proc.driver.nvidia.gpus.0: Error: [Errno 21] Is a directory: '/proc/driver/nvidia/gpus/0'
.proc.driver.nvidia.registry: Binary: ""
.proc.driver.nvidia.version:
 NVRM version: NVIDIA UNIX x86_64 Kernel Module 280.13 Wed Jul 27 16:53:56 PDT 2011
 GCC version: gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
.tmp.unity.support.test.0:

.tmp.unity.support.test.1:

ApportVersion: 1.23-0ubuntu4
Architecture: amd64
CompizPlugins: [core,bailer,detection,composite,opengl,decor,grid,imgpng,gnomecompat,move,place,regex,resize,snap,animation,vpswitch,session,mousepoll,unitymtgrabhandles,compiztoolbox,wall,expo,workarounds,ezoom,fade,scale,unityshell]
CompositorRunning: None
Date: Sun Nov 13 14:28:21 2011
DistUpgraded: Log time: 2011-11-12 18:25:20.734107
DistroCodename: oneiric
DistroVariant: ubuntu
DkmsStatus:
 nvidia-current, 280.13, 2.6.38-11-generic, x86_64: installed
 nvidia-current, 280.13, 3.0.0-12-generic, x86_64: installed
GraphicsCard:
 nVidia Corporation GT200b [GeForce GTX 275] [10de:05e6] (rev a1) (prog-if 00 [VGA controller])
   Subsystem: Giga-byte Technology Device [1458:34ce]
JockeyStatus:
 xorg:nvidia_current - NVIDIA accelerated graphics driver (Proprietary, Enabled, In use)
 xorg:nvidia_current_updates - NVIDIA accelerated graphics driver (post-release updates) (Proprietary, Disabled, Not in use)
MachineType: System76, Inc. The Leopard Extreme
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: root=UUID=e7728359-15b1-4eb6-a7c9-db1b40e7c807 ro quiet splash
SourcePackage: nux
UnitySupportTest: Error: command ['/usr/lib/nux/unity_support_test', '-p', '-f'] failed with exit code 1: Error: no composite extension
UpgradeStatus: Upgraded to oneiric on 2011-11-13 (0 days ago)
dmi.bios.date: 12/14/2010
dmi.bios.vendor: Intel Corp.
dmi.bios.version: SOX5810J.86A.5529.2010.1214.2317
dmi.board.asset.tag: Base Board Asset Tag
dmi.board.name: DX58SO
dmi.board.vendor: Intel Corporation
dmi.board.version: AAE29331-503
dmi.chassis.type: 2
dmi.modalias: dmi:bvnIntelCorp.:bvrSOX5810J.86A.5529.2010.1214.2317:bd12/14/2010:svnSystem76,Inc.:pnTheLeopardExtreme:pvrleo1:rvnIntelCorporation:rnDX58SO:rvrAAE29331-503:cvn:ct2:cvr:
dmi.product.name: The Leopard Extreme
dmi.product.version: leo1
dmi.sys.vendor: System76, Inc.
version.compiz: compiz 1:0.9.6+bzr20110929-0ubuntu5
version.ia32-libs: ia32-libs 20090808ubuntu26
version.libdrm2: libdrm2 2.4.26-1ubuntu1
version.libgl1-mesa-dri: libgl1-mesa-dri 7.11-0ubuntu3
version.libgl1-mesa-dri-experimental: libgl1-mesa-dri-experimental N/A
version.libgl1-mesa-glx: libgl1-mesa-glx 7.11-0ubuntu3
version.nvidia-graphics-drivers: nvidia-graphics-drivers N/A
version.xserver-xorg: xserver-xorg 1:7.6+7ubuntu7
version.xserver-xorg-input-evdev: xserver-xorg-input-evdev 1:2.6.0-1ubuntu13
version.xserver-xorg-video-ati: xserver-xorg-video-ati 1:6.14.99~git20110811.g93fc084-0ubuntu1
version.xserver-xorg-video-intel: xserver-xorg-video-intel 2:2.15.901-1ubuntu2
version.xserver-xorg-video-nouveau: xserver-xorg-video-nouveau 1:0.0.16+git20110411+8378443-1

Revision history for this message
Tristan Schmelcher (tschmelcher) wrote :
Revision history for this message
Tristan Schmelcher (tschmelcher) wrote :

Additional note: If I manually select "Ubuntu 2D" and run /usr/lib/nux/unity_support_test in the Unity 2D session with -p, it correctly fails:

$ /usr/lib/nux/unity_support_test -p
Error: no composite extension
$ echo $?
1
$

But if I run it with no arguments, it succeeds:

$ /usr/lib/nux/unity_support_test
$ echo $?
0
$

Revision history for this message
Tristan Schmelcher (tschmelcher) wrote :

Looking in the unity_support_test source code, I can see the problem. unity_support_test caches the result of the test by creating an empty file at /tmp/unity_support_test.<exit code>. When run with no arguments, if /tmp/unity_support_test.0 exists, it immediately exits with success without checking for support. This scheme is fundamentally incompatible with running multiple X11 servers. In my case, the system has both a physical X11 display with COMPOSITE and GLX run by xserver-xorg and also virtual X11 displays for remote logins run by vnc4server. Once anyone logs in on the physical server and unity_support_test creates the /tmp/unity_support_test.0 file, all following remote logins are guaranteed to incorrectly pass the test.

To fix the bug, unity_support_test either should not cache the results of the test or should cache the results separately for each X11 server. For example, the value of the DISPLAY environment variable could be embedded into the filename. Though there is no guarantee that the configuration of a given X11 server remains constant over time, so it would be more robust to simply not cache at all.

Changed in nux (Ubuntu):
importance: Undecided → High
status: New → Confirmed
Changed in nux (Ubuntu Precise):
assignee: nobody → Didier Roche (didrocks)
Changed in unity:
status: New → Confirmed
Changed in nux:
status: New → Confirmed
Revision history for this message
Tristan Schmelcher (tschmelcher) wrote :

Also worth noting that creating a file in /tmp without O_EXCL is a security risk. See e.g. http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/avoid-race.html

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

The cache per display doesn't seem to be robust enough. However, the caching is still needed as it saved quite a bunch of boot time. If someone is wanting to work on that, he's more than welcome to do so, I'm afraid I have unfortunatly no time to work on it.

Changed in nux (Ubuntu Precise):
assignee: Didier Roche (didrocks) → nobody
Revision history for this message
Tristan Schmelcher (tschmelcher) wrote :

Could you expand on why caching per display was not robust?

Revision history for this message
Aaron Sowry (fq-airin-x0) wrote :

>Could you expand on why caching per display was not robust?

I agree with Didier that caching per display is not robust, since differently configured X servers can potentially occupy the same display over time. However, the current implementation is simply broken - this really needs to be fixed.

I also did some (very) quick tests on cached vs uncached runs of unity_support_test, and the difference was extremely negligable. Unless I'm missing something, removing the cache completely should be very little work, and also fix the fallback behaviour.

Revision history for this message
Tristan Schmelcher (tschmelcher) wrote :

FYI, Didier explained to me off-bug that the problem with caching per display is that sometimes the _same_ X server occupies a _different_ display over time, meaning it doesn't benefit from caching with that change:

"We only want to test once the acceleration per display per boot. It seems that under some circumstances, lightdm switch the VT (and anyway, it's the plan for next cycle, only play with VT switch), so caching per display won't fix in the long term the issue you are encountering. I think we need to think is in a deeper way to find a solution even working in your use case."

Ideally I would like to just drop the cache too, but apparently that's not an option. :/

summary: - Automatic unity 2D fallback does not work with XDMCP logins over VNC
+ Automatic unity 2D fallback does not work with remote login
Revision history for this message
Tristan Schmelcher (tschmelcher) wrote :

This bug should also be marked as a security issue on account of the O_EXCL problem (see comment #4), but I couldn't figure out how to add the security flag to the bug.

Revision history for this message
Aaron Sowry (fq-airin-x0) wrote :

Agree about the security issue. I would also like to see some evidence that the caching saves "quite a bunch of boot time". Didier - do you have any references?

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

@Aaron: we did some in the oneiric cycle, but it seems the pages were removed. We won 0.8s on desktop login time, which is exactly 20% of the budget we have theorically to log into the desktop.

Revision history for this message
Aaron Sowry (fq-airin-x0) wrote :

Out of curiosity, how is this 4s budget defined? I assume it's from the time you enter your password in lightdm to the time you have a usable desktop? If this is the case, then it's arguable that lightdm shouldn't even be displaying "unity" as an option on displays which don't support it, let alone have it as the default option. If the unity_support_test was done as part of lightdm startup instead, and the 4s budget is defined as I assume it is, then at least the 0.8s unity_support_test delay could be moved outside of the desktop login process.

In this scenario, calling gnome-session with the '--session' parameter (as lightdm currently does) would invariably launch whatever session was specified using this parameter, and unity_support_test would never need to run or cache anything. The only time unity_support_test would be called during gnome-session startup is when it is called without the --session parameter; in this scenario, the session defaults to the value of the gsettings key "session-name" in org.gnome.desktop.session, as per current behaviour.

Of course, the next question is what this key should be by default. One option would be to have a new .session file, e.g. "unity-test.session" or similar. This session file would essentially look like the current ubuntu.session file, which performs the unity_support_test and falls back to unity-2d if it fails. (Admitedly I'm not sure what else this key is used for, so feel free to correct me if doing this would have any adverse effects).

I'm just brainstorming here - I'm happy to submit a patch if you feel that something like this would be an acceptable solution. Something needs to be done, however; the current implementation makes wild and unreasonable assumptions, is a potential security risk, and basically prevents Ubuntu from being a viable terminal server platform.

tags: added: precise rls-mgr-p-tracking
Revision history for this message
Scott Wright (swright198) wrote :

My friend uses Fallback mode and auto log-in. after installing updates yesterday, it did error as described. I tried reinstalling from a newer daily update and still, the problem remained. The desktop would be there but there would be no upper control menu-bar. Also, if you hit CTRL-ALT-DEL expecting to see "Restart, Cancel, and Shutdown" you were actually presented with "Cancel, and Log-out" . I reinstalled from Beta 2 and did not install fallback . I have her computer up and running but am afraid to update again.

Revision history for this message
Oti Humbel (ohumbel) wrote :

It also affects remote NX (NoMachine) sessions.
My configuration: precise 12.04, 3.2.0-30-generic, GNOME 3.4.2, nxserver 3.5.0-11.
Client: Any NX 3.5.x client, and NoMachine Player 4.0.181-5

The current workaround is to delete (better: symlink) the file /tmp/unity_support_test.0,
according to bug #833729 and the bug description above.

Revision history for this message
Oti Humbel (ohumbel) wrote :

Problem persists, even with the newest Unity update from today.

The workaround still is (precision of comment #14):
  cd /usr/lib/nux
  sudo mv unity_support_test unity_support_test.original
  sudo ln -s /bin/false unity_support_test

Changed in unity (Ubuntu):
status: New → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in unity (Ubuntu Precise):
status: New → Confirmed
Changed in unity:
status: Confirmed → Invalid
Changed in nux:
status: Confirmed → Invalid
Changed in unity (Ubuntu):
status: Confirmed → Invalid
Changed in nux (Ubuntu):
status: Confirmed → Invalid
importance: High → Undecided
no longer affects: nux (Ubuntu Precise)
no longer affects: unity (Ubuntu Precise)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.