Any X experts know why my display doesn’t seem to be available in su shells when using NX? This problem does not happen using tightVNC (but it has its own problems).
**Symptom: **When running on NX (either NX Free or FreeNX), starting YaST from the application menu brings up a window that is entirely gray.
(Another thing that happens under NX but not tightVNC: In Chrome, much of the system text – bookmark names, system menu items, tab titles, etc. – is missing, but web page display is fine. Don’t know if it’s related.)
**Testing: **As I worked through the problem, I discovered that the issue is applications running in shells. The menu item for YaST uses a login program to bring up YaST in a shell with user root, similar to sudo. For testing, I tried
/sbin/yast2
in a terminal under my name, and the window came up properly (although most of the functionality was missing because it was not running as root). Then I tried
sudo /sbin/yast2
and YaST came up on the terminal in character mode (presumably it does this when it doesn’t find a display). If I try
su
<password>
/sbin/yast2
the window appears without any contents (all gray) and the terminal shows errors:
X Error: BadAccess (attempt to access private resource denied) 10
Extension: 129 (MIT-SHM)
Minor opcode: 1 (X_ShmAttach)
Resource id: 0x57
X Error: BadShmSeg (invalid shared segment parameter) 128
Extension: 129 (MIT-SHM)
Minor opcode: 5 (X_ShmCreatePixmap)
Resource id: 0x1a00010
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
Major opcode: 62 (X_CopyArea)
Resource id: 0x1a00011
… lots more BadDrawable …
X Error: BadPixmap (invalid Pixmap parameter) 4
Major opcode: 54 (X_FreePixmap)
Resource id: 0x1a00011
X Error: BadShmSeg (invalid shared segment parameter) 128
Extension: 129 (MIT-SHM)
Minor opcode: 2 (X_ShmDetach)
Resource id: 0x1a00010
It isn’t related to root; if I su to a different user, the same thing happens.
Behavior is similar with xclock.
sudo xclock
Error: Can’t open display:
The variable DISPLAY seems to be available when using su, but not sudo:
cat >dtest
echo $DISPLAY
^D
chmod +x dtest
./dtest
:1003
sudo ./dtest
<nothing>
su
./dtest
:1003
Can anyone make sense of this, or tell me what to try?
Details:
Server: Linux OpenSUSE 12.2, with NX Free 3.5.0-11 server, running on Dell custom rack server
Client: Windows 7, with NX Free 3.5.0-9 client, running on Sony VAIO Z