How to Fix Unable to Start VNC Server Issue
In the previous blog, we saw steps required to install and configure VNC Server Click here to read more. In this article, we will see How we can fix VNC Server service startup issue. The below issue can occur if the Server was stopped suddenly and VNC Server was unable to stop gracefully.
Step 1. Start VNC Server Service: As you can see when we tried to start the VNC Server service, it failed to start.
[root@test-machine01 ~]#
[root@test-machine01 ~]#systemctl start vncserver@:1.service
[root@test-machine01 ~]#
[root@test-machine01 ~]# 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: failed (Result: exit-code) since Mon 2021-09-06 20:04:33 +03; 1min 7s ago
Process: 2026 ExecStop=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Process: 1807 ExecStart=/usr/bin/vncserver_wrapper ucas_build %i (code=exited, status=2)
Process: 1786 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Main PID: 1807 (code=exited, status=2)
Sep 06 20:04:33 test-machine01.local systemd[1]: Starting Remote desktop service (VNC)...
Sep 06 20:04:33 test-machine01.local systemd[1]: Started Remote desktop service (VNC).
Sep 06 20:04:33 test-machine01.local vncserver_wrapper[1807]: Warning: jedsupportal1.saudiacatering.local:1 is taken because of /tmp/.X11-unix/X1
Sep 06 20:04:33 test-machine01.local vncserver_wrapper[1807]: Remove this file if there is no X server test-machine01.local:1
Sep 06 20:04:33 test-machine01.local vncserver_wrapper[1807]: A VNC server is already running as :1
Sep 06 20:04:33 test-machine01.local vncserver_wrapper[1807]: FATAL: 'runuser -l ucas_build' failed!
Sep 06 20:04:33 test-machine01.local systemd[1]: vncserver@:1.service: main process exited, code=exited, status=2/INVALIDARGUMENT
Sep 06 20:04:33 test-machine01.local systemd[1]: Unit vncserver@:1.service entered failed state.
Sep 06 20:04:33 test-machine01.local systemd[1]: vncserver@:1.service failed.
[root@test-machine01 ~]#
Step 2. Fixing Issue: Go to /tmp directory and use OS Command ls -lart to list hidden files and directory. Remove folder .X11-unix.
[root@test-machine01 ~]#
[root@test-machine01 ~]# cd /tmp
[root@test-machine01 tmp]# ls -lart
total 384
-rw-------. 1 root root 0 Aug 30 17:12 yum.log
drwxrwxrwt. 2 root root 6 Aug 30 17:14 .XIM-unix
drwxrwxrwt. 2 root root 6 Aug 30 17:14 .Test-unix
drwxrwxrwt. 2 root root 6 Aug 30 17:14 .font-unix
-rwx------. 1 root root 836 Aug 30 17:28 ks-script-USxeD7
-rw-r--r--. 1 root root 0 Aug 30 17:29 storage.log
drwxr-xr-x. 3 root root 18 Sep 1 11:56 tomcat.3843266527360572887.443
drwx------. 3 root root 17 Sep 6 20:04 systemd-private-f762a1c4e88a40c7a41718af600e42dc-rtkit-daemon.service-QNeVrW
drwx------. 3 root root 17 Sep 6 20:04 systemd-private-f762a1c4e88a40c7a41718af600e42dc-cups.service-GbLXKc
-r--r--r--. 1 root root 11 Sep 6 20:04 .X0-lock
drwxrwxrwt. 2 root root 26 Sep 6 20:04 .X11-unix
drwxrwxrwt. 2 root root 79 Sep 6 20:04 .ICE-unix
drwx------. 3 root root 17 Sep 6 20:04 systemd-private-
[root@test-machine01 tmp]#
[root@test-machine01 tmp]# rm -rf .X11-unix
[root@test-machine01 tmp]#
Step 3. Start VNC Server again: Once the above steps are done. Try to start VNC Server again. And this time it started successfully.
[root@test-machine01 tmp]# systemctl start vncserver@:1.service
[root@test-machine01 tmp]#
[root@test-machine01 tmp]# 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: active (running) since Mon 2021-09-06 20:07:46 +03; 8s ago
Process: 2026 ExecStop=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Process: 2890 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Main PID: 2893 (vncserver_wrapp)
CGroup: /system.slice/system-vncserver.slice/vncserver@:1.service
ââ2893 /bin/sh /usr/bin/vncserver_wrapper app_user :1
ââ3748 sleep 0.1
Sep 06 20:07:46 test-machine01.local systemd[1]: Starting Remote desktop service (VNC)...
Sep 06 20:07:46 test-machine01.local systemd[1]: Started Remote desktop service (VNC).
Sep 06 20:07:49 test-machine01.local vncserver_wrapper[2893]: New 'test-machine01.local:1 (app_user)' desktop is test-machine01.local:1
Sep 06 20:07:49 test-machine01.local vncserver_wrapper[2893]: Starting applications specified in /home/app_user/.vnc/xstartup
Sep 06 20:07:49 test-machine01.local vncserver_wrapper[2893]: Log file is /home/app_user/.vnc/test-machine01.local:1.log
[root@test-machine01 tmp]#
This document is just for learning purpose and always validate in the LAB environment first before applying in the LIVE environment.
Hope so you like this article!
Please share your valuable feedback/comments/subscribe and follow us below and don’t forget to click on the bell icon to get the most recent update. Click here to understand more about our pursuit.
Related Articles
- How to Enable PasswordLess SSH login in Linux
- Steps to Install & Configure SNMP in Oracle Linux 7
- Steps to Add and Extend Swap Space in Linux
- Steps To Increase Mount Point Space In Oracle Linux
- Steps to Move ISCSI Target to Another Linux Server
Did you write the article yourself or you hired
someone to do it? I was wondering because
I am a site owner too and struggle with writing new content all the time.
Someone told me to use AI to do create articles which
I am kinda considering because the output is almost written by human.
Let me know if you think I should go ahead and use AI.
Thanks for the review, It’s team efforts and the author’s name is in each article and completely original content.
Thanks.
Team DBsGuru