CentOS7 Cant Start VNCserver

Home » CentOS » CentOS7 Cant Start VNCserver
CentOS 2 Comments

OK, first time configuring VNCserver on CentOS7. I have read through a bunch of old messages here on VNCserver and thought I had it. Obviously not.

1) cp /usr/lib/systemd/system/vncserver@.service
2) vi /etc/systemd/system/vncserver@.service

I changed in both places to root

3) systemctl daemon-reload
4) systemctl enable VNCserver@:3.service
5) VNCpasswd
To create /root/.vnc/passwd
6) systemctl start VNCserver@:3.service

# systemctl -l status VNCserver@:3
‚óŹ VNCserver@:3.service – Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver@.service; enabled;
vendor preset: disabled)
Active: failed (Result: resources) since Thu 2017-05-25 12:31:13
EDT; 13s ago
Process: 5173 ExecStart=/usr/sbin/runuser -l root -c
/usr/bin/vncserver %i (code=exited, status=0/SUCCESS)
Process: 5170 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i >
/dev/null 2>&1 || : (code=exited, status=0/SUCCESS)

May 25 12:31:10 homebase.home.htt systemd[1]: Starting Remote desktop service (VNC)… May 25 12:31:13 homebase.home.htt systemd[1]: PID file
/home/root/.vnc/homebase.home.htt:3.pid not readable (yet?) after start. May 25 12:31:13 homebase.home.htt systemd[1]: Failed to start Remote desktop service (VNC). May 25 12:31:13 homebase.home.htt systemd[1]: Unit VNCserver@:3.service entered failed state. May 25 12:31:13 homebase.home.htt systemd[1]: VNCserver@:3.service failed.

Thanks for all help.

2 thoughts on - CentOS7 Cant Start VNCserver

  • Actually it is running:

    netstat -tuln | grep 590
    tcp 0 0* LISTEN
    tcp 0 0* LISTEN
    tcp 0 0* LISTEN
    tcp6 0 0 :::5901 :::* LISTEN
    tcp6 0 0 :::5902 :::* LISTEN
    tcp6 0 0 :::5903 :::* LISTEN

    Why 5901 and 2 are listening, I don’t know…

    when I VNC to my server I get that basic nasty blank X11 screen. I
    modified /root/.vnc/xstartup with:

    exec /bin/sh /etc/xdg/xfce4/xinitrc

    But restarting VNCserver@:3 does not seem to get the VNC client to get my xfce desktop, only the blank x11 desktop.

    Oh and restart gives the same errors as start does, but the pids are there:

    # ls .vnc/
    homebase.home.htt:1.log homebase.home.htt:2.pid passwd homebase.home.htt:1.pid homebase.home.htt:3.log xstartup homebase.home.htt:2.log homebase.home.htt:3.pid

    I see:

    cat .vnc/homebase.home.htt\:1.log

    Xvnc TigerVNC 1.3.1 – built Nov 16 2016 13:38:44
    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 11702000, The X.Org Foundation

    Thu May 25 12:45:56 2017
    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 5: /etc/xdg/xfce4/xinitrc: Permission denied
    /root/.vnc/xstartup: line 5: exec: /etc/xdg/xfce4/xinitrc: cannot execute: Permission denied

    2.log has different errors.

    3.log actually has connection information (as I am connecting to 5903?)


  • Hi Robert apparently VNCserver writes its PID file somewhere else than into
    /home/root/.vnc/homebase.home.htt:3.pid, where systemd expects it to be. Go into /lib/systemd/system/vncserver.service and correct the PID file location there, so that it matches the location where VNCserver writes its PID file. And then do a systemctl deamon-reload systemctl start VNCserver

    and then after the SECOND start of VNCserver (not the first) it will work.