This solution applies to CentOS/AlmaLinux, Rocky Linux 7, 8, 9.
Getting below error output while seeing the VNC service status of the command.
systemd[1]: Starting Remote desktop service (VNC)...
systemd[15253]: vncserver@:3.service: Failed to change SELinux context to system_u:system_r:vnc_session_t:s0: Operation not permitted
[15253]: vncserver@:3.service: Failed at step SELINUX_CONTEXT spawning /usr/libexec/vncsession-start: Operation not permitted
[1]: vncserver@:3.service: Control process exited, code=exited, status=229/SELINUX_CONTEXT
[1]: vncserver@:3.service: Failed with result 'exit-code'.
[1]: Failed to start Remote desktop service (VNC).
Above error shows that SELinux label for the file /usr/libexec/vncsession-start is incorrect, which is prevent service from being started.
Now execute the below command to restore the SELinux context of the file.
# restorecon -vF /usr/libexec/vncsession-start
If somehow it is not restored to its default permission then execute the below command.
# chcon -v system_u:object_r:vnc_session_exec_t:s0 /usr/libexec/vncsession-start
Restart and check the status as follows.
# systemctl daemon-reload
# systemctl start vncserver@\:3.service
# systemctl status vncserver@\:3.service
The default selinux context of the file is as follows;
[root@server/]# ls -lZd /usr/libexec/vncse*
-rwxr-xr-x. 1 root root system_u:object_r:bin_t:s0 12088 Apr 16 14:07 /usr/libexec/vncserver
-rwxr-xr-x. 1 root root system_u:object_r:bin_t:s0 1678 Apr 16 14:07 /usr/libexec/vncsession-restore
-rwxr-xr-x. 1 root root system_u:object_r:vnc_session_exec_t:s0 1248 Apr 16 14:07 /usr/libexec/vncsession-start
The SELinux label for the file /usr/libexec/vncsession-start is incorrect, which prevents the service form being started.
[root@server/]# ls -lZd /usr/libexec/vncse*
-rwxr-xr-x. 1 root root system_u:object_r:bin_t:s0 12088 Mar 19 14:07 /usr/libexec/vncserver
-rwxr-xr-x. 1 root root system_u:object_r:bin_t:s0 1678 Mar 19 14:07 /usr/libexec/vncsession-restore
-rwxr-xr-x. 1 root root system_u:object_r:vnc_session_exec_t:s0 1248 Mar 19 14:07 /usr/libexec/vncsession-start