# Centos7환경에서 VNC서비스 실행시킬때 vnc failed로 응답할때

<table border="1" id="bkmrk-perplexity%EC%97%90%EC%84%9C-%EC%83%9D%EC%84%B1%ED%95%9C-ai%EC%9D%B4" style="border-collapse: collapse; width: 100%; height: 59.757px;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr style="height: 29.8785px;"><td style="height: 29.8785px;">[![image.png](http://igoni.kr/uploads/images/gallery/2026-02/scaled-1680-/Nyvimage.png)](http://igoni.kr/uploads/images/gallery/2026-02/Nyvimage.png)

</td></tr><tr style="height: 29.8785px;"><td class="align-right" style="height: 29.8785px;">perplexity에서 생성한 AI이미지</td></tr></tbody></table>

1. VNC 구동시 Fail로그 확인 ```shell
    $> systemctl start vncserver@:2.service
    Job for vncserver@:2.service failed. See 'systemctl status vncserver@:2.service' and 'journalctl -xn' for details.
    ```
2. 프로세스 실행여부 확인 ```shell
    [root@localhost /]# ps -ef | grep vnc
    test 24303 1 0 20:08 ? 00:00:00 /usr/bin/Xvnc :2 -desktop
    192.168.0.100:2 (test) -httpd /usr/share/vnc/classes -auth
    /home/test/.Xauthority -geometry 600×800 -rfbwait 30000 -rfbauth
    /home/test/.vnc/passwd -rfbport 5902 -fp catalogue:/etc/X11/fontpath.d
    -pn -nolisten tcp
    test 24310 1 0 20:08 ? 00:00:00 /usr/bin/vncconfig -iconic
    root 25037 21274 0 20:09 pts/0 00:00:00 grep –color=auto vnc
    ```
3. 프로세스가 실행중이기 때문에, VNC viewer로 접속하거나, 프로세스가 이상할 경우에는 서비스 재시작.
4. 실행중인 포트 확인
    
    ```shell
    [root@localhost tmp]# netstat -antp | grep vnc
    tcp 0 0 0.0.0.0:5802 0.0.0.0:* LISTEN 24303/Xvnc
    tcp 0 0 0.0.0.0:5902 0.0.0.0:* LISTEN 24303/Xvnc
    ```
    
    <div><div><div class="box"><div class="code"><div class="linenoswrapper"><div>  
    </div></div></div></div></div>
    - 기본적으로 5900을 기본으로 뒤에 디스플레이번호에 따라서 1자리 포트가 바뀜.
    - 2번 디스플레이일경우에는 5902, 5번 디스플레이이면 5905번 포트가 LISTEN으로 됨.
    - 2. 1번 사항대로 확인했는데 아무것도 없을때….
    - VNC서비스를 실행시키면서 생성되는 파일이 정상적으로 삭제되지 않았기 때문인데,
    - VNC가 활성화 되어 있는 상태에서 재부팅이 이루어지면 이런 현상이 자주 발생하고 있네요.
    - /tmp/.ICE-unix /tmp/.X11-unix 폴더가 제거되지 않았을 경우에 이렇게 때문에 해당 파일을 삭제해주면 됨. ```shell
        $> ls -al /tmp
        total 48
        drwxrwxrwt. 11 root root 12288 Dec 29 20:15 .
        drwxr-xr-x. 20 root root 4096 Dec 29 12:58 ..
        drwxrwxrwt 2 test test 30 Dec 29 20:08 .ICE-unix
        drwxrwxrwt 2 test test 15 Dec 29 20:08 .X11-unix
        ```
        
        <div><div><div class="box"><div class="code"><div class="linenoswrapper"><div>  
        \#.ICE-unix, .X11-unix 이 두개 폴더 삭제  
        </div></div></div></div></div></div>```shell
        $> rm -rf /tmp/.ICE-unix /tmp/.X11-unix
        ```
        
        <div><div class="box"><div class="code"><div class="linenoswrapper"><div>  
        </div></div></div></div></div>
    - 서비스 재실행 ```shell
        $> systemctl start vncserver@:2.service
        ```
    
    </div>