1

I have a few years of experience with using Linux on the command line, but this is my first time trying to set it up with a GUI.

I'm on CentOS 7 (64 bit) and I've run the following commands:

yum groupinstall "X Window System" "Desktop"
yum install tigervnc-server xorg-x11-fonts-Type1
vncpasswd

After using those commands to install stuff (a VNC server and Gnome, I think), I created this file at /root/.vnc/xstartup:

#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
startx &
exec gnome-session &

Then I tried starting the vnc server with just this: vncserver. This printed out:

New '<VM-Name>:1 (root)' desktop is <VM-Name>:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/<VM-Name>:1.log

I launched VNC Viewer on my local machine (Windows 7, 64 bit) and connected to the VM, but all I saw was a dark gray background with 3 checkboxes in the top left corner regarding clipboards. I get an X for a cursor.

Nothing I press on the keyboard seems to do anything.

Everything VNC wise seems to be fine but I was expecting to have some sort of desktop from which I could browse my file system... or some other way of doing anything graphically with this VM.

It seems like it must not be finding my window or desktop manager or something (my terminology might be off - please correct me if it is) - but my script said to launch gnome, and the VNC logs didn't indicate any issue, so shouldn't I see something other than a gray rectangle?

Since I mentioned it, here's what's in my VNC logs (/root/.vnc/<VM-Name>:1.log):

Xvnc TigerVNC 1.2.80 - built Jun 10 2014 06:14:52
Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Underlying X server release 11500000, The X.Org Foundation

Initializing built-in extension Generic Event Extension
Initializing built-in extension SHAPE
Initializing built-in extension MIT-SHM
Initializing built-in extension XInputExtension
Initializing built-in extension XTEST
Initializing built-in extension BIG-REQUESTS
Initializing built-in extension SYNC
Initializing built-in extension XKEYBOARD
Initializing built-in extension XC-MISC
Initializing built-in extension XFIXES
Initializing built-in extension RENDER
Initializing built-in extension RANDR
Initializing built-in extension COMPOSITE
Initializing built-in extension DAMAGE
Initializing built-in extension MIT-SCREEN-SAVER
Initializing built-in extension DOUBLE-BUFFER
Initializing built-in extension RECORD
Initializing built-in extension DPMS
Initializing built-in extension X-Resource
Initializing built-in extension XVideo
Initializing built-in extension XVideo-MotionCompensation
Initializing built-in extension VNC-EXTENSION
Initializing built-in extension GLX

Wed Sep 30 13:10:31 2015
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on all interface(s), port 5901
 vncext:      created VNC server for screen 0

Wed Sep 30 13:10:47 2015
 Connections: accepted: <my ip>::47407
 SConnection: Client needs protocol version 3.8
 SConnection: Client requests security type VncAuth(2)

Wed Sep 30 13:11:02 2015
 VNCSConnST:  Server default pixel format depth 24 (32bpp) little-endian rgb888
 VNCSConnST:  Client pixel format depth 8 (8bpp) color-map

Wed Sep 30 14:27:49 2015
 Connections: closed: <my ip>::47407 (Clean disconnection)
 SMsgWriter:  framebuffer updates 3
 SMsgWriter:    raw rects 1, bytes 16396
 SMsgWriter:    ZRLE rects 1, bytes 802
 SMsgWriter:    raw bytes equivalent 802840, compression ratio 46.682172

Nothing in here indicates any sort of error to me. Is there another log file I should check somewhere else? Should I somehow enter a debug mode for something (what/how?) Is there something missing from my xstartup script (with is +x executable, by the way). Is everything working fine and there's just some key combination I need to send to get a screen other than the blank gray screen? Is there something I should look for in netstat or ps that would indicate to me if things were or weren't working?

Edit: After making changes suggested by roaima to my xstartup file and restarting VNC, this is the output I'm getting in the log file:

Xvnc TigerVNC 1.2.80 - built Jun 10 2014 06:14:52
Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Underlying X server release 11500000, The X.Org Foundation

Initializing built-in extension Generic Event Extension
Initializing built-in extension SHAPE
Initializing built-in extension MIT-SHM
Initializing built-in extension XInputExtension
Initializing built-in extension XTEST
Initializing built-in extension BIG-REQUESTS
Initializing built-in extension SYNC
Initializing built-in extension XKEYBOARD
Initializing built-in extension XC-MISC
Initializing built-in extension XFIXES
Initializing built-in extension RENDER
Initializing built-in extension RANDR
Initializing built-in extension COMPOSITE
Initializing built-in extension DAMAGE
Initializing built-in extension MIT-SCREEN-SAVER
Initializing built-in extension DOUBLE-BUFFER
Initializing built-in extension RECORD
Initializing built-in extension DPMS
Initializing built-in extension X-Resource
Initializing built-in extension XVideo
Initializing built-in extension XVideo-MotionCompensation
Initializing built-in extension VNC-EXTENSION
Initializing built-in extension GLX

Thu Oct  1 12:01:36 2015
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on all interface(s), port 5901
 vncext:      created VNC server for screen 0
/root/.vnc/xstartup: line 8: gnome-session: command not found
/root/.vnc/xstartup: line 6: xterm: command not found
xauth:  file /root/.serverauth.2286 does not exist


X.Org X Server 1.15.0
Release Date: 2013-12-27
X Protocol Version 11, Revision 0
Build Operating System:  2.6.32-220.17.1.el6.x86_64
Current Operating System: Linux InteractSL-TaylorCognosTest 3.10.0-229.7.2.el7.x86_64 #1 SMP Tue Jun 23 22:06:11 UTC 2015 x86_64
Kernel command line: BOOT_IMAGE=/vmlinuz-3.10.0-229.7.2.el7.x86_64 root=UUID=9bdbb9b7-a256-4676-8449-34b054b2950a ro vconsole.keymap=us crashkernel=auto vconsole.font=latarcyrheb-sun16 LANG=en_US.UTF-8
Build Date: 10 April 2015  11:44:42AM
Build ID: xorg-x11-server 1.15.0-33.el7_1
Current version of pixman: 0.32.4
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Thu Oct  1 12:01:39 2015
(==) Using config directory: "/etc/X11/xorg.conf.d"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
Initializing built-in extension Generic Event Extension
Initializing built-in extension SHAPE
Initializing built-in extension MIT-SHM
Initializing built-in extension XInputExtension
Initializing built-in extension XTEST
Initializing built-in extension BIG-REQUESTS
Initializing built-in extension SYNC
Initializing built-in extension XKEYBOARD
Initializing built-in extension XC-MISC
Initializing built-in extension XINERAMA
Initializing built-in extension XFIXES
Initializing built-in extension RENDER
Initializing built-in extension RANDR
Initializing built-in extension COMPOSITE
Initializing built-in extension DAMAGE
Initializing built-in extension MIT-SCREEN-SAVER
Initializing built-in extension DOUBLE-BUFFER
Initializing built-in extension RECORD
Initializing built-in extension DPMS
Initializing built-in extension Present
Initializing built-in extension X-Resource
Initializing built-in extension XVideo
Initializing built-in extension XVideo-MotionCompensation
Initializing built-in extension SELinux
Initializing built-in extension XFree86-VidModeExtension
Initializing built-in extension XFree86-DGA
Initializing built-in extension XFree86-DRI
Initializing built-in extension DRI2
Loading extension GLX
xinit: connection to X server lost
^M
waiting for X server to shut down
Thu Oct  1 12:01:39 2015
 Connections: accepted: 129.42.208.178::30139

Thu Oct  1 12:01:40 2015
 SConnection: Client needs protocol version 3.8
 SConnection: Client requests security type VncAuth(2)
error setting MTRR (base = 0xf0000000, size = 0x00400000, type = 1) Invalid argument (22)
(EE) Server terminated successfully (0). Closing log file.


Thu Oct  1 12:01:41 2015
 VNCSConnST:  Server default pixel format depth 24 (32bpp) little-endian rgb888
 VNCSConnST:  Client pixel format depth 8 (8bpp) color-map

Thu Oct  1 12:05:11 2015
 Connections: closed: 129.42.208.178::30139 (Clean disconnection)
 SMsgWriter:  framebuffer updates 3
 SMsgWriter:    raw rects 1, bytes 16396
 SMsgWriter:    ZRLE rects 1, bytes 773
 SMsgWriter:    raw bytes equivalent 802840, compression ratio 46.761023
  • Why don't you use X to connect to your system? Do you really need to access the active session or just connect remotely to the X server? You have XMing to open X programs from a windows machine (that includes a gnome session) – YoMismo Oct 1 '15 at 13:21
  • @YoMismo - I don't know what X is and haven't used it before. I'm using VNC because I know what it is and have used it before. I figure given VNC seems more common, it's probably easier to find help with it. – ArtOfWarfare Oct 1 '15 at 13:24
  • X runs on every graphical Linux/Unix, VNC on the other hand doesn't. Looks to me it is easier to get help on X than on VNC, in my case I can't help with VNC, sorry :( – YoMismo Oct 1 '15 at 13:29
  • What is the output of 'type xterm; type gnome-session' on the linux machine? Sorry I can't format code, sent from mobile app – Dani_l Jun 11 '16 at 6:00
  • @Dani_l - Sorry, I've moved on from that job and no longer have access to the machines with that problem. At my new job, the VMs already had gnome and X installed - all I had to do was install TigerVNC and everything worked perfectly. Not really sure what the fate of this question should be now... – ArtOfWarfare Jun 11 '16 at 14:27
0

I had similar problem. VNC started, can connect, but empty desktop. Oracle Linux 7.2 (which is almost 1:1 from RHEL7.2)

no errors, etc.

I have checked commands executed in /etc/X11/xinit/xinitrc and has found that default (!!!!) window manager /usr/bin/twm file is not present in system (despite "Server with GUI" was selected as installation option).

Easy fix: backup first

cp -p /etc/X11/xinit/xinitrc /etc/X11/xinit/xinitrc.orig

then

# Change in /etc/X11/xinit/xinitrc:
from:
# [ -x /usr/bin/twm ] && /usr/bin/twm
to:
# [ -x /usr/bin/mwm ] && /usr/bin/mwm

Hope mwm file is present in your system as in my case.

  • As I have no real way to know if anything is the right answer (I mentioned in another comment that I no longer work at the company that had a VM with a problem), I'll accept this until someone else says it's wrong and offers a better solution. – ArtOfWarfare Jul 8 '16 at 11:33
  • So... the "fix" is to change one commented out line for another? – roaima Aug 31 '16 at 19:05
1

(This is going to have to be an incremental answer as there's too much for a comment just now.)

The grey (possibly stippled) background for VNC is typical of an X Display Server that is running nothing.

Your /root/.vnc/xstartup looks very strange.

  1. The exec line passes control permanently to the file specified as its parameter, so only the first two non-comment lines of your script get executed. It would be worth looking in the references xinitrc to see what it wants to do. (If the file's not too long please add it to the question.)

  2. It's not usual to have exec followed by & as it negates the meaning of the exec.

Based on information in the comments we also need to fix up the PATH. The resulting xstartup code therefore looks like this:

#!/bin/sh
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

You have remembered to make the file executable? chmod u+x /root/.vnc/xstartup

If this still doesn't work, comment the first two lines again, or update the file to look like this:

#!/bin/sh
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
startx &
gnome-session &
  • I got my xstartup file from here: linuxquestions.org/questions/linux-newbie-8/… - I don't really know what a lot of the lines do. I mostly script in Python, not sh. – ArtOfWarfare Oct 1 '15 at 14:30
  • xstartup is executable. I removed the first two lines from the file like you suggested. Now in my log files it says xterm: command not found and exec: gnome-session: not found. Is there something more that I need to install than I already have? (At the start of my question, I listed everything that I've installed so far.) – ArtOfWarfare Oct 1 '15 at 14:43
  • I found a file /usr/share/terminfo/x/xterm, but it's not marked as an executable... and I don't think it's on my path. echo $PATH outputs: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin – ArtOfWarfare Oct 1 '15 at 14:45
  • @ArtOfWarfare I've amended the scripts. Note there is one line added and one line removed from the last script in my answer. – roaima Oct 1 '15 at 15:13
  • roaima, I don't understand - why are we exporting a PATH which is identical to what my current PATH variable already is? I don't feel like that line should do anything, but I put it in my script anyways since you told me to. Restarted VNC after changing xstartup to match what you have, and now my log is different (mentions stuff about starting X.) I put the entire new log into the end of my question, as an edit. – ArtOfWarfare Oct 1 '15 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.