설치, 사용자 생성, 편집 등을 한 후 서비스를 시작하려고 하면 다음과 같은 메시지가 나타납니다(@SivaPrasath가 제안한 대로 tmp에서 .Xfiles를 제거한 후).
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.
systemctl
설명하다:
[root@localhost ~]# systemctl status vncserver@:1.service
● vncserver@:1.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver@:1.service; disabled; vendor preset: disabled)
Active: failed (Result: protocol) since Tue 2018-05-15 19:26:13 -03; 1min 36s ago
Process: 4284 ExecStart=/usr/sbin/runuser -l r_vnc -c /usr/bin/vncserver :1 -geometry 1280x1024 (code=exited, status=0/SUCCESS)
Process: 4282 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill :1 > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
May 15 19:26:10 localhost.localdomain systemd[1]: Starting Remote desktop service (VNC)...
May 15 19:26:13 localhost.localdomain systemd[1]: vncserver@:1.service: PID file /home/r_vnc/.vnc/localhost.localdomain:1.pid not readable (yet?) after start: Permission denied
May 15 19:26:13 localhost.localdomain systemd[1]: Failed to start Remote desktop service (VNC).
May 15 19:26:13 localhost.localdomain systemd[1]: vncserver@:1.service: Unit entered failed state.
May 15 19:26:13 localhost.localdomain systemd[1]: vncserver@:1.service: Failed with result 'protocol'.
journalctl
설명하다:
- Unit UNIT has begun starting up.
May 15 16:42:15 localhost.localdomain systemd[13394]: Received SIGRTMIN+24 from PID 13453 (kill).
May 15 16:42:15 localhost.localdomain systemd[1]: Stopped User Manager for UID 1002.
-- Subject: Unit [email protected] has finished shutting down
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit [email protected] has finished shutting down.
May 15 16:42:15 localhost.localdomain audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=user@1002 comm="systemd" exe="/usr/lib/systemd/systemd" hostname
May 15 16:42:15 localhost.localdomain systemd[1]: Removed slice User Slice of r_vnc.
-- Subject: Unit user-1002.slice has finished shutting down
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-1002.slice has finished shutting down.
이 오류를 어떻게 해결할 수 있나요?
답변1
vncserver를 종료하거나 예기치 않게 종료되는 경우 /var/log/messages를 읽어 보십시오. 다음 오류가 포함된 .X 시작 파일을 찾을 수 있습니다. 먼저 Xvnc 프로세스가 실행되고 있지 않은지 확인합니다.
Aug 13 12:11:11 www runuser: Warning: www.example.com:2 is taken because of /tmp/.X2-lock
...
Aug 13 12:12:52 www runuser: Warning: www.example.com:2 is taken because of /tmp/.X22-unix/X2
그럼 넌 삭제해
# rm -f /tmp/.X2-lock
# rm -f /tmp/.X22-unix/X2
설정하지 않은 경우 사용자의 VNC 비밀번호를 설정합니다. 비밀번호를 설정한 후 예상대로 VNC 서버를 시작할 수 있습니다.
# su - <user name>
$ vncpasswd
vnc 서버를 다시 시작하십시오.
# systemctl restart vncserver@:2.sevice