vnc를 구성한 사용자 계정 "virendar"가 있습니다. 두 가지 프로세스도 있다는 것을 알았습니다. 두 프로세스를 모두 종료하려고 시도했는데 몇 초 안에 하나의 프로세스가 자동으로 시작되는 것을 보았습니다. 이것이 어떻게 자동으로 시작되는지 잘 모르겠습니다. vncservice 상태를 확인해 보니 중지된 상태입니다. 시작하면 두 번째 vnc 프로세스가 시작되는 것을 볼 수 있습니다.
[root@ip-172-32-8-143 ~]# ps -ef | grep vnc
root 1309 1 0 09:28 ? 00:00:00 /bin/sh /usr/bin/vncserver_wrapper virendar :1
virendar 1746 1540 0 09:28 ? 00:00:00 /usr/bin/Xvnc :2 -auth /home/virendar/.Xauthority -desktop ip-172-32-8-143.us-east-2.compute.internal:2 (virendar) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /home/virendar/.vnc/passwd -rfbport 5902 -rfbwait 30000
virendar 1829 1 0 09:28 ? 00:00:00 /usr/bin/Xvnc :1 -auth /home/virendar/.Xauthority -desktop ip-172-32-8-143.us-east-2.compute.internal:1 (virendar) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /home/virendar/.vnc/passwd -rfbport 5901 -rfbwait 30000
virendar 2370 1540 0 09:28 ? 00:00:00 vncconfig -iconic
virendar 2436 1 0 09:28 ? 00:00:00 vncconfig -iconic
root 5751 4191 0 09:39 pts/0 00:00:00 grep --color=auto vnc
[root@ip-172-32-8-143 ~]# su - virendar
Last login: Sat Jul 4 11:17:29 UTC 2020 on pts/2
[virendar@ip-172-32-8-143 ~]$ ls -al .vnc/
total 44
drwxrwxr-x. 2 virendar virendar 4096 Jul 5 09:28 .
drwx------. 19 virendar virendar 4096 Jul 5 09:28 ..
-rw-r--r--. 1 virendar virendar 332 Jun 16 04:10 config
-rw-rw-r-- 1 virendar virendar 1010 Jul 5 09:28 ip-172-32-8-143.us-east-2.compute.internal:1.log
-rw-rw-r-- 1 virendar virendar 5 Jul 5 09:28 ip-172-32-8-143.us-east-2.compute.internal:1.pid
-rw-r--r-- 1 virendar virendar 1010 Jul 5 09:28 ip-172-32-8-143.us-east-2.compute.internal:2.log
-rw-r--r-- 1 virendar virendar 5 Jul 5 09:28 ip-172-32-8-143.us-east-2.compute.internal:2.pid
-rw-rw-r-- 1 virendar virendar 1298 Jul 4 13:01 ip-172-32-8-143.us-east-2.compute.internal:4.log
-rw-rw-r-- 1 virendar virendar 6 Jul 4 11:11 ip-172-32-8-143.us-east-2.compute.internal:4.pid
-rw-------. 1 virendar virendar 8 Jun 28 18:57 passwd
-rwxr-xr-x 1 virendar virendar 185 Jun 28 19:11 xstartup
[virendar@ip-172-32-8-143 ~]$ cat .vnc/xstartup
#!/bin/sh
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
vncconfig -iconic &
dbus-launch --exit-with-session gnome-session &
[root@ip-172-32-8-143 ~]# cat /etc/systemd/system/vncserver@:1.service
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=simple
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver_wrapper virendar %i
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
[Install]
WantedBy=multi-user.target
중복 vnc 프로세스의 근본 원인을 어떻게 좁힐 수 있습니까? 반복 프로세스가 자동으로 시작되는 방법을 알고 싶습니다.
새로운 업데이트: #1
# 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 Sun 2020-07-05 18:00:00 UTC; 3s ago
Process: 4191 ExecStop=/bin/sh -c /usr/bin/vncserver -kill :1 > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Process: 4238 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill :1 > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Main PID: 4241 (vncserver_wrapp)
Tasks: 2 (limit: 200136)
Memory: 2.2M
CGroup: /system.slice/system-vncserver.slice/vncserver@:1.service
├─4241 /bin/sh /usr/bin/vncserver_wrapper virendar :1
└─4495 sleep 0.1
Jul 05 18:00:00 ip-172-32-8-143.us-east-2.compute.internal systemd[1]: Starting Remote desktop service (VNC)...
Jul 05 18:00:00 ip-172-32-8-143.us-east-2.compute.internal systemd[1]: Started Remote desktop service (VNC).
Jul 05 18:00:03 ip-172-32-8-143.us-east-2.compute.internal vncserver_wrapper[4241]: New 'ip-172-32-8-143.us-east-2.compute.internal:1 (virendar)' desktop is ip-172-32-8-143.us-east-2.compute.internal:1
Jul 05 18:00:03 ip-172-32-8-143.us-east-2.compute.internal vncserver_wrapper[4241]: Starting applications specified in /home/virendar/.vnc/xstartup
Jul 05 18:00:03 ip-172-32-8-143.us-east-2.compute.internal vncserver_wrapper[4241]: Log file is /home/virendar/.vnc/ip-172-32-8-143.us-east-2.compute.internal:1.log
# systemctl status vncserver@:2.service
● vncserver@:2.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver@:2.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2020-07-05 17:58:53 UTC; 1min 29s ago
Process: 1304 ExecStart=/usr/bin/vncserver_wrapper kiran :2 (code=exited, status=2)
Process: 1293 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill :2 > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Main PID: 1304 (code=exited, status=2)
Jul 05 17:58:53 ip-172-32-8-143.us-east-2.compute.internal vncserver_wrapper[1304]: and start again.
Jul 05 17:58:53 ip-172-32-8-143.us-east-2.compute.internal vncserver_wrapper[1304]: (EE)
Jul 05 17:58:53 ip-172-32-8-143.us-east-2.compute.internal vncserver_wrapper[1304]: Fatal server error:
Jul 05 17:58:53 ip-172-32-8-143.us-east-2.compute.internal vncserver_wrapper[1304]: (EE) Server is already active for display 1
Jul 05 17:58:53 ip-172-32-8-143.us-east-2.compute.internal vncserver_wrapper[1304]: If this server is no longer running, remove /tmp/.X1-lock
Jul 05 17:58:53 ip-172-32-8-143.us-east-2.compute.internal vncserver_wrapper[1304]: and start again.
Jul 05 17:58:53 ip-172-32-8-143.us-east-2.compute.internal vncserver_wrapper[1304]: (EE)
Jul 05 17:58:53 ip-172-32-8-143.us-east-2.compute.internal vncserver_wrapper[1304]: FATAL: 'runuser -l kiran' failed!
Jul 05 17:58:53 ip-172-32-8-143.us-east-2.compute.internal systemd[1]: vncserver@:2.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jul 05 17:58:53 ip-172-32-8-143.us-east-2.compute.internal systemd[1]: vncserver@:2.service: Failed with result 'exit-code'.
답변1
일반적으로 다음 사항을 확인해야 합니다.
/etc/cron.daily/
/etc/cron.hourly/
확인하다
crontab -e
표준 사용자, 루트 및 시스템 vnc 사용자.
또한 디렉토리에 파일이 포함되어 있는지 확인하십시오.
/etc/rc.d/
이 파일에 system으로 시작하는 항목이 포함되어 있는지 확인하세요.
/etc/rc.d/rc.local
여기에서 장치를 확인하세요.
/etc/systemd/system/
vnc 세션을 실행하는 경우 각 핵심 프로세스의 복사본 두 개가 반드시 실행된다는 점을 명심하세요.
답변2
모니터가 2개 있는 것 같죠?
하나를 위해DISPLAY=:1
DISPLAY=:2
rfbports 5901 및 5902에서 실행되는 다른 하나 입니다.
5901 대신 5902에 연결해 보고 어떤 일이 일어나는지 확인할 수 있습니다.
(조사하다 /etc/systemd/system/vncserver@:2.service
)
편집하다:
장치 상태 확인:
systemctl status vncserver@:1.service
systemctl status vncserver@:2.service