RHEL 8.2 中的 VNC 服务有两个进程正在运行

RHEL 8.2 中的 VNC 服务有两个进程正在运行

我有一个用户帐户“virendar”,我在其中配置了 vnc。我注意到,甚至有两个过程。我尝试终止两个进程,几秒钟内,我看到一个进程自动启动。我不确定这是如何自动启动的。当我检查 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 

作为标准用户、root 和系统 vnc 用户。

另外检查目录是否包含任何文件

/etc/rc.d/

检查此文件是否包含以系统开头的任何条目:

/etc/rc.d/rc.local

在这里检查单位:

/etc/systemd/system/

请记住,如果您正在运行 vnc 会话,那么每个核心进程的两个副本肯定也会运行。

答案2

看起来您有两个显示器?
一个用于DISPLAY=:1另一个用于DISPLAY=:2,在 rfbports 5901 和 5902 上运行。

您可以尝试连接到 5902 而不是 5901,看看有什么。

(检查/etc/systemd/system/vncserver@:2.service

编辑:

检查单位状态:
systemctl status vncserver@:1.service

systemctl status vncserver@:2.service

相关内容