1

I'm trying to configure VNC server for remote logins on a fresh install of CentOS 7, but I just can't seem to get it working right.

I've followed the install steps here including the firewall-cmd steps, but when I run systemctl status vncserver@:1.service, I see:

Loaded: loaded (/etc/systemd/system/vncserver@:1.service; enabled; vendor preset: disabled)
Active: inactive (dead) since <~4 seconds after start time>
Main PID: 1462 (code=exited, status=0/SUCCESS)

<start time> localhost.localdomain systemd[1]: Starting Remote desktop service (VNC)...
<start time+3> localhost.localdomaind systemd[1]: Started Remote desktop service (VNC).

When I instead try to run vncserver manually (as su - remote-user), the log output (in /home/remote-user/.vnc/localhost.localdomain:1.log) is:

  vncext: VNC extension running!
  vncext: Listening for VNC connections on all interface(s), port 5901
  vncext: created VNC server for screen 0
Killing Xvnc process ID 17085

Other thing that may be causing or contributing to the issue:

In /etc/systemd/system/vncserver@:1.service, the line:

PIDFile=/home/remote-user/.vnc/%H%i.pid

Doesn't appear to generate any .pid files. /home/remote-user/.vnc contains no files ending in .pid; this may be because the vnc process doesn't live long enough to create them, but I'm not sure.

1

Just check your /home/username/.vnc/xstartup file and remove the last line

This is how it looked in my case:

#!/bin/sh

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
/etc/X11/xinit/xinitrc
vncserver -kill $DISPLAY

vncserver -kill $DISPLAY is definetely not something we want in xstartup, just remove it

  • While this might have solved your problem, please: Do not recommend to blindly erase the last line of the startup file. Be more specific of what should be searched. – Isaac Jan 11 at 13:51
  • 1
    I was quite specific, do you usually read only the first line of the message or the whole post? – ilya.s Jan 11 at 18:39
  • Commenting on a months-old post to thank @ilya.s for a sufficiently specific answer that pointed me in exactly the right direction. The last line of ~/.vnc/xstartup will always be vncserver -kill $DISPLAY for a fresh install, and besides, you provide the full contents of your file, and specifically mention that vncserver -kill $DISPLAY is the offending line. – Peter Leimbigler Apr 1 at 18:03

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.