You’ll have to kill the Xvnc process manually

Error: You’ll have to kill the Xvnc process manually

This tutorial guides you on how to kill VNC Process Manually on Linux. Sometimes when you are trying to kill vncserver session you will get error You’ll have to kill the Xvnc process manually error. Let’s see how to resolve the same in this tutorial with example.

Error You’ll have to kill the Xvnc process manually

You’ll have to kill the Xvnc process manually

I was trying to reset the display counter for the VNC to :1 when I start the VNC server using command vncserver. By default my VNC server has been started at :2.

Hence I tried killing using the following command.

$ vncserver -kill :2

Can't find file /root/.vnc/localhost:2.pid
You'll have to kill the Xvnc process manually

But, it resulted with error saying I need to kill the Xvnc process manually.

Solution : Kill VNC Process Manually

I had followed the following solution to kill the VNC process manually.

First, you need to find the PID of the process. So that you will know which process/program is running on specific port. Then you need to kill VNC process manually.

For instance, first the foremost thing that you need to do is check which VNC services are running using grep command.

$ ps -ef | grep vnc

You would see output like the following.

ubuntuuser   12092 11906  0 05:51 pts/2    00:00:00 grep vnc
root     15790     1  0 Aug06 ?        00:00:00 Xvnc :2 -desktop X -httpd /usr/share/vnc/classes -auth /root/.xauthzIQyDA -geometry 2556x1000 -depth 24 -pixelformat rgb888 -rfbwait 120000 -rfbauth /root/.vnc/passwd -rfbport 5902 -fp /usr/share/fonts/misc:unscaled,/usr/share/fonts/local,/usr/share/fonts/75dpi:unscaled,/usr/share/fonts/100dpi:unscaled,/usr/share/fonts/Type1,/usr/share/fonts/URW,/usr/share/fonts/Speedo,/usr/share/fonts/truetype,/usr/share/fonts/uni,/usr/share/fonts/CID -noreset

From the above response it is evident that only Xvnc is running on rfbport 5902. And whose PID is 15790.

Alternatively, you can netstat command  along with grep as shown below.

# netstat -tulpn | grep :59

You would see the following output.

tcp        0      0 0.0.0.0:5901            0.0.0.0:*               LISTEN      5264/xinetd
tcp        0      0 0.0.0.0:5902            0.0.0.0:*               LISTEN      15790/Xvnc
tcp        0      0 0.0.0.0:59061

The above response also shows similar output for PID. Therefore, you need to use the PID 15790 to kill VNC session started at :2.

Command to Kill VNC process

Run the following  command to kill the VNC process ie., kill -9 <PID of Xvnc Process>.

# kill -9 15790

Output

Killing Xvnc process ID 15790

That’s it. You had learnt how to find PID process that is using specific port. Also, learnt how to kill the VNC processes manually.

Hope this article is helpful 🙂

Also See:

References

guest
0 Comments
Inline Feedbacks
View all comments