zoukankan      html  css  js  c++  java
  • Troubleshoot Refused VNC Connection in CentOS 7

    Troubleshoot Refused VNC Connection in CentOS 7

    The other day I connected to my CentOS 7 computer from Windows via RealVNC Viewer. Everything went fine, but after I left the machines unattended for a short time, the connection froze to the point that I had to shut CentOS down and boot it again. When I tried to connect again, I got an error message saying something like “The connection was refused by the host computer” or similar, I can’t remember exactly. I rebooted CentOS several times, but nothing changed. Now I had to connect a monitor and the necessary peripherals to the box and start troubleshooting.

    First, I checked the status of the VNC service:

    [root@localhost Desktop]# systemctl status vncserver@:2.service -l
    vncserver@:2.service - Remote desktop service (VNC)
       Loaded: loaded (/etc/systemd/system/vncserver@:2.service; enabled)
       Active: failed (Result: exit-code) since Sat 2015-02-28 14:37:00 CET; 10min ago
    
    Feb 28 14:37:00 localhost.localdomain systemd[1]: vncserver@:2.service: control process exited, code=exited status=2
    Feb 28 14:37:00 localhost.localdomain systemd[1]: Failed to start Remote desktop service (VNC).
    Feb 28 14:37:00 localhost.localdomain systemd[1]: Unit vncserver@:2.service entered failed state.
    

    The VNC service apparently failed to start. If you don’t know why I used vncserver@:2.service, please read my earlier post about configuring VNC. I tried to start the service, but it kept failing:

    [root@localhost Desktop]# systemctl start vncserver@:2.service
    Job for vncserver@:2.service failed. See 'systemctl status vncserver@:2.service' and 'journalctl -xn' for details.
    

    As I was digging through the internet, I found some clues about corrupted session files that had to be deleted to solve this problem. The files were supposed to be in the /tmp/.X11-unix directory (capital X11, Linux is case-sensitive!). When I checked the contents of /tmp, I found this:

    ls /tmp

    There was no /.X11-unix directory inside. The issue was, that this folder is hidden and such items can only be seen if you put -la after ls, like this:

    ls -la /tmp

    Now I saw the folder I was looking for at the end of the list. Inside /.X11-unix were the session files:

    X2

    The corrupted file belonging to “vncuser”, the user I configured for VNC access, was X2. I removed it with the rm /tmp/.X11-unix/X2 command. Then, I started the service, rebooted the computer and I was able to seamlessly connect to my CentOS machine through VNC.

  • 相关阅读:
    python学习之关于变量与内存的问题
    [题解]GDUT 2020年11月赛DE题
    【转】关于Oracle默认用户名system密码不正确登录不上解决方案
    [转载] Monitor Tools
    java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getAsyncContext()Ljavax/servlet/AsyncContext;
    【SSM】Result Maps collection already contains value for crud.dao.EmployeeMapper.BaseResultMap
    EL表达式失效,页面取不到数据
    处理回归BUG最佳实践
    固定QPS压测初试
    Java字符串到数组的转换--最后放大招
  • 原文地址:https://www.cnblogs.com/gaohong/p/4829206.html
Copyright © 2011-2022 走看看