VNC hangs due to an increased number of VNC sessions initiated by sshd, being under the closing state.
# loginctl list-sessions --no-pager | wc -l
49290
A session would be in a closing state if a process within the session stayed alive after the session was closed.
# loginctl session-status 45098
45098 - root (0)
Since: Fri 2021-09-04 13:20:15 CET; 1 months 0 days ago
Leader: 1278
Remote: vnc.seimaxim.com
Service: sshd; type tty; class user
State: closing
Unit: session-45098.scope
The root cause is that two sshd daemons are running on the server. This causes logind to not terminate the session gracefully. To resolve this issue, reboot the server.
- You should run only one sshd daemon on the server.
# ps axu | grep -i "sbin/sshd"
- Run the following command and check the output. This will disable the sshd-quest.service.
# systemctl stop sshd-quest.service
# systemctl disable sshd-quest.service
- Keep running the sshd.service as provisioned in the Linux OS.
# systemctl start sshd.service
# systemctl enable sshd.service