I'm running CentOS 7.4 with Gnome and having problems getting the VNC server to serve a Desktop environment for the client. I either get a blank black screen or text with checkboxes. It is running for VNC:
Xvnc TigerVNC 1.8.0 - built Aug 7 2017 01:32:32
If I use the .vnc/xstartup as supplied in my home directory:
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec /etc/X11/xinit/xinitrc
It gets prompted for the password, but it just provides a blank black screen. It doesn't inter at all. When I log into this same account from the console, it works perfectly fine.
I had the VNC server working on a now retired CentOS 6 system, so I decided to try the xstart from that one:
#!/bin/sh
vncconfig -iconic &
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
OS=`uname -s`
if [ $OS = 'Linux' ]; then
case "$WINDOWMANAGER" in
*gnome*)
if [ -e /etc/SuSE-release ]; then
PATH=$PATH:/opt/gnome/bin
export PATH
fi
;;
esac
fi
if [ -x /etc/X11/xinit/xinitrc ]; then
exec /etc/X11/xinit/xinitrc
fi
if [ -f /etc/X11/xinit/xinitrc ]; then
exec sh /etc/X11/xinit/xinitrc
fi
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
exec gnome-session &
But this produces gray screen for the client with the following check boxes and text:
Accept clipboard from viewers
Also set primary selection
Send clipboard to viewers
Send primary selection to viewers
I can check and uncheck those boxes, but that's it. Don't get a desktop environment that I've edited according to CentOS 7 articles and documentation I've seen:
Here is the /etc/systemd/system/vncserver@:1.service file:
# The vncserver service unit file
#
# Quick HowTo:
# 1. Copy this file to /etc/systemd/system/[email protected]
# 2. Replace <USER> with the actual user name and edit vncserver
# parameters appropriately
# ("User=<USER>" and "/home/<USER>/.vnc/%H%i.pid")
# 3. Run `systemctl daemon-reload`
# 4. Run `systemctl enable vncserver@:<display>.service`
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, you should
# limit connections to the local host and then tunnel from
# the machine you want to view VNC on (host A) to the machine
# whose VNC output you want to view (host B)
#
# [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB
#
# this will open a connection on port 590N of your hostA to hostB's port 590M
# (in fact, it ssh-connects to hostB and then connects to localhost (on hostB).
# See the ssh man page for details on port forwarding)
#
# You can then point a VNC client on hostA at vncdisplay N of localhost and with
# the help of ssh, you end up seeing what hostB makes available on port 590M
#
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
#
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the "-via" option in the
# `man vncviewer' manual page.
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
User=justme
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=-/usr/bin/vncserver -kill %i
ExecStart=/usr/bin/vncserver %i
PIDFile=/home/justme/.vnc/%H%i.pid
ExecStop=-/usr/bin/vncserver -kill %i
[Install]
WantedBy=multi-user.target
I've looked in the log file and the only errors/warnings I've seen are:
[root@myserver ~]# systemctl status vncserver@:1.service
● vncserver@:1.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver@:1.service; enabled; **vendor preset: disabled**)
Active: inactive (dead) since Wed 2017-10-11 05:04:32 EDT; 21min ago
Process: 2456 ExecStop=/usr/bin/vncserver -kill %i (code=exited, status=0/SUCCESS)
Process: 1410 ExecStart=/usr/bin/vncserver %i (code=exited, status=0/SUCCESS)
Process: 1358 ExecStartPre=/usr/bin/vncserver -kill %i (code=exited, status=2)
Main PID: 1570 (code=exited, status=0/SUCCESS)
Oct 11 05:01:31 myserver vncserver[1358]: Can't find file /home/justme/.vnc/myserver:1.pid
Oct 11 05:01:31 myserver vncserver[1358]: You'll have to kill the Xvnc process manually
Oct 11 05:01:34 myserver vncserver[1410]: New 'myserver:1 (justme)' desktop is myserver:1
Oct 11 05:01:34 myserver vncserver[1410]: Starting applications specified in /home/justme/.vnc/xstartup
Oct 11 05:01:34 myserver vncserver[1410]: Log file is /home/justme/.vnc/myserver:1.log
Oct 11 05:01:34 myserver systemd[1]: Started Remote desktop service (VNC).
Oct 11 05:01:34 myserver gnome-session[1952]: gnome-session-binary[1952]: **WARNING: software acceleration check failed: Child process exited with code 1**
Oct 11 05:01:34 myserver gnome-session-binary[1952]: WARNING: software acceleration check failed: Child process exited with code 1
Oct 11 05:04:32 myserver vncserver[2456]: Killing Xvnc process ID 1570
Oct 11 05:04:32 myserver vncserver[2456]: Xvnc process ID 1570 already killed
I've made some attempts at changing the xstartup and the etc/systemd/system/vncserver@:1.service files, but none of them have produced a result other than the blank blank screen or the one with check boxes.
If anyone with experience in this has suggestions for more trouble-shooting or you are able to see what the problem is, please contribute your thoughts.
After following instructions such as https://www.linuxtechi.com/install-configure-vnc-server-centos-7-rhel-7/ it still didn't work. I'm documenting the solution here in case others run into this.
Solution: Removed the Nvidia driver and replaced it with xorg-x11-drv-nouveau. This fixed the problem. This is how I removed it: https://ask.fedoraproject.org/en/question/78969/how-to-remove-the-nvidia-proprietary-driver/
I have since did some searches and saw mention that the Nvidia driver breaks VNC, even though it works fine for wired monitors.
try to start two process:
systemctl start vncserver-x11-serviced systemctl enable vncserver-x11-serviced systemctl start vncserver-vrituald systemctl enable vncserver-vrituald
launch vncserver