How To Fix Error Job For Vncserver@:1.service Failed Because The Control Process Exited With Error Code. See “systemctl Status Vncserver@:1.service” And “journalctl -xe” For Details When Start VNC Server.

After install VNC server on CentOS, when i run command # systemctl start vncserver@:1.service to start it, i meet bellow error message.

# systemctl start vncserver@:1.service
Job for vncserver@:1.service failed because the control process exited with error code. See "systemctl status vncserver@:1.service" and "journalctl -xe" for details.

I search google for the resolution, finally i find below steps.

  1. First login to linux OS with the user which you use in /etc/systemd/system/vncserver@:1.service file.
  2. Verify file /usr/bin/vncserver exist and execute it in the terminal.
    [happyzhaosong@MiWiFi-R4A-srv ~]$ /usr/bin/vncserver 
    
    You will require a password to access your desktops.
    
    Password:
    Verify:
    Would you like to enter a view-only password (y/n)? y
    Password:
    Verify:
    xauth:  file /home/happyzhaosong/.Xauthority does not exist
    
    New 'MiWiFi-R4A-srv:3 (happyzhaosong)' desktop is MiWiFi-R4A-srv:3
    
    Creating default startup script /home/happyzhaosong/.vnc/xstartup
    
    Creating default config /home/happyzhaosong/.vnc/config
    
    Starting applications specified in /home/happyzhaosong/.vnc/xstartup
    
    Log file is /home/happyzhaosong/.vnc/MiWiFi-R4A-srv:3.log
    
    
    
  3. Then it will create /home/happyzhaosong/.vnc/xstartup file.
  4. Edit file /home/happyzhaosong/.vnc/xstartup, add # at the beginning of line vncserver -kill $DISPLAY to remove it.
    if [ -e /usr/bin/gnome-session -o -e /usr/bin/startkde ]; then
       # vncserver -kill $DISPLAY
    fi
  5. If above method do not take effect, you can run command # rm -rf /tmp/.X11-unix/ with root user, and then reboot system.
    # rm -rf /tmp/.X11-unix/
  6. If above method do not take effect, you can edit file /etc/systemd/system/vncserver@:1.service and change Service —> Type from forking to simple.
    # vim /etc/systemd/system/vncserver@:1.service
    
    
    # Edit Service section, change Type=forking to Type=simple. 
    
    [Service]
    
    Type=forking
    
    #Type=simple
    
    
  7. Then run command # systemctl daemon-reload to update systemctl.

    # systemctl daemon-reload

2 thoughts on “How To Fix Error Job For Vncserver@:1.service Failed Because The Control Process Exited With Error Code. See “systemctl Status Vncserver@:1.service” And “journalctl -xe” For Details When Start VNC Server.”

  1. Angry frustrated user

    Oh, for crying out loud. Is there a single linux tutorial anywhere on the internet that actually works?

    “Can’t exec ‘/root/.vnc/xstartup’: Permission denied”

    But of course you don’t mention this at all, because like every single Linux tutorial in the entire world, you just assume it works and leave us hanging high end dry when it doesn’t actually work and spits out errors instead (which is ALWAYS). What a damn waste of time. Take this broken tutorial off the internet before you waste anybody else’s time.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.