Description of problem: When following the documented iimplementation procedures for the tiger VNC server, I am unable to start the server due to a timeout issue with the users PID file with selinux setenforce enabled. Version-Release number of selected component (if applicable): Fedora 25 How reproducible: Created a VM from the downloaded fedora server iso. Followed the process described in the draft system administrators handbook: https://docs.fedoraproject.org/en-US/Fedora/25/html/System_Administrators_Guide/ch-TigerVNC.html Started the VNC server Server errored with timeout Set enforcing to 0 Stated VNC server Server starts Steps to Reproduce: 1. With a base Fedora 25 server build, follow the draft system administrators guide to install the tiger vnc server 2. #dnf install tigervnc-server 3. # cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@.service 4. edited the /etc/systemd/system/vncserver@.service file to read # The vncserver service unit file # # Quick HowTo: # 1. Copy this file to /etc/systemd/system/vncserver@.service # 2. Replace <USER> with the actual user name and edit vncserver # parameters appropriately # ("User=<USER>" and "/home/<USER>/.vnc/%H%i.pid") # 3. Run `systemctl daemon-reload` # 4. Run `systemctl enable vncserver@:<display>.service` # # DO NOT RUN THIS SERVICE if your local area network is # untrusted! For a secure way of using VNC, you should # limit connections to the local host and then tunnel from # the machine you want to view VNC on (host A) to the machine # whose VNC output you want to view (host B) # # [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB # # this will open a connection on port 590N of your hostA to hostB's port 590M # (in fact, it ssh-connects to hostB and then connects to localhost (on hostB). # See the ssh man page for details on port forwarding) # # You can then point a VNC client on hostA at vncdisplay N of localhost and with # the help of ssh, you end up seeing what hostB makes available on port 590M # # Use "-nolisten tcp" to prevent X connections to your VNC server via TCP. # # Use "-localhost" to prevent remote VNC clients connecting except when # doing so through a secure tunnel. See the "-via" option in the # `man vncviewer' manual page. [Unit] Description=Remote desktop service (VNC) After=syslog.target network.target [Service] Type=forking User=nfsquires # Clean any existing files in /tmp/.X11-unix environment ExecStartPre=-/usr/bin/vncserver -kill %i ExecStart=/usr/bin/vncserver -localhost -nolisten tcp %i PIDFile=/home/nfsquires/.vnc/%H%i.pid ExecStop=-/usr/bin/vncserver -kill %i [Install] WantedBy=multi-user.target 5. # systemctl daemon-reload 6. # systemctl start vncserver@:1.service 7. System errors after a timeout Job for vncserver@:1.service failed because a timeout was exceeded. See "systemctl status vncserver@:1.service" and "journalctl -xe" for details. 8. #setenforce 0 9. systemctl start vncserver@:1.service Actual results: With setenforce 1 # systemctl status vncserver@:1.service ● vncserver@:1.service - Remote desktop service (VNC) Loaded: loaded (/etc/systemd/system/vncserver@.service; enabled; vendor preset: disabled) Active: failed (Result: timeout) since Thu 2017-01-12 15:36:33 AEST; 35s ago Process: 1103 ExecStart=/usr/bin/vncserver -localhost -nolisten tcp %i (code=exited, status=0/SUCCESS) Process: 1098 ExecStartPre=/usr/bin/vncserver -kill %i (code=exited, status=0/SUCCESS) Jan 12 15:35:03 vpn.squires.id.au vncserver[1098]: Killing Xvnc process ID 798 Jan 12 15:35:03 vpn.squires.id.au vncserver[1098]: Xvnc process ID 798 already killed Jan 12 15:35:06 vpn.squires.id.au vncserver[1103]: New 'vpn.squires.id.au:1 (nfsquires)' desktop is vpn.squires.id.au:1 Jan 12 15:35:06 vpn.squires.id.au vncserver[1103]: Starting applications specified in /home/nfsquires/.vnc/xstartup Jan 12 15:35:06 vpn.squires.id.au vncserver[1103]: Log file is /home/nfsquires/.vnc/vpn.squires.id.au:1.log Jan 12 15:35:06 vpn.squires.id.au systemd[1]: vncserver@:1.service: PID file /home/nfsquires/.vnc/vpn.squires.id.au:1.pid not readable (yet?) after start: Permission denied Jan 12 15:36:33 vpn.squires.id.au systemd[1]: vncserver@:1.service: Start operation timed out. Terminating. Jan 12 15:36:33 vpn.squires.id.au systemd[1]: Failed to start Remote desktop service (VNC). Jan 12 15:36:33 vpn.squires.id.au systemd[1]: vncserver@:1.service: Unit entered failed state. Jan 12 15:36:33 vpn.squires.id.au systemd[1]: vncserver@:1.service: Failed with result 'timeout'. -- The start-up result is done. Jan 12 15:35:38 vpn.squires.id.au audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=dnf-makecache comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res= Jan 12 15:35:38 vpn.squires.id.au audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=dnf-makecache comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=s Jan 12 15:36:33 vpn.squires.id.au systemd[1]: vncserver@:1.service: Start operation timed out. Terminating. Jan 12 15:36:33 vpn.squires.id.au audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=vncserver@:1 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=f Jan 12 15:36:33 vpn.squires.id.au audit[1]: AVC avc: denied { unlink } for pid=1 comm="systemd" name="vpn.squires.id.au:1.pid" dev="dm-0" ino=25247160 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:user_home_t:s0 tcla Jan 12 15:36:33 vpn.squires.id.au systemd[1]: Failed to start Remote desktop service (VNC). -- Subject: Unit vncserver@:1.service has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit vncserver@:1.service has failed. -- -- The result is failed. Jan 12 15:36:33 vpn.squires.id.au systemd[1]: vncserver@:1.service: Unit entered failed state. Jan 12 15:36:33 vpn.squires.id.au systemd[1]: vncserver@:1.service: Failed with result 'timeout'. With Setenforce 0 ]# systemctl start vncserver@:1.service [root@vpn ~]# systemctl status vncserver@:1.service ● vncserver@:1.service - Remote desktop service (VNC) Loaded: loaded (/etc/systemd/system/vncserver@.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2017-01-12 15:40:10 AEST; 1min 6s ago Process: 1160 ExecStart=/usr/bin/vncserver -localhost -nolisten tcp %i (code=exited, status=0/SUCCESS) Process: 1154 ExecStartPre=/usr/bin/vncserver -kill %i (code=exited, status=0/SUCCESS) Main PID: 1168 (Xvnc) Tasks: 2 (limit: 4915) CGroup: /system.slice/system-vncserver.slice/vncserver@:1.service ├─1168 /usr/bin/Xvnc :1 -auth /home/nfsquires/.Xauthority -desktop vpn.squires.id.au:1 (nfsquires) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /home/nfsquires/.vnc/passwd -rfbport 5901 -rfbwait 30000 -loc └─1173 /usr/bin/vncconfig -nowin Jan 12 15:40:07 vpn.squires.id.au systemd[1]: Starting Remote desktop service (VNC)... Jan 12 15:40:07 vpn.squires.id.au vncserver[1154]: Killing Xvnc process ID 1113 Jan 12 15:40:10 vpn.squires.id.au vncserver[1160]: New 'vpn.squires.id.au:1 (nfsquires)' desktop is vpn.squires.id.au:1 Jan 12 15:40:10 vpn.squires.id.au vncserver[1160]: Starting applications specified in /home/nfsquires/.vnc/xstartup Jan 12 15:40:10 vpn.squires.id.au vncserver[1160]: Log file is /home/nfsquires/.vnc/vpn.squires.id.au:1.log Jan 12 15:40:10 vpn.squires.id.au systemd[1]: Started Remote desktop service (VNC). Expected results: with setenforce 1 ]# systemctl start vncserver@:1.service [root@vpn ~]# systemctl status vncserver@:1.service ● vncserver@:1.service - Remote desktop service (VNC) Loaded: loaded (/etc/systemd/system/vncserver@.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2017-01-12 15:40:10 AEST; 1min 6s ago Process: 1160 ExecStart=/usr/bin/vncserver -localhost -nolisten tcp %i (code=exited, status=0/SUCCESS) Process: 1154 ExecStartPre=/usr/bin/vncserver -kill %i (code=exited, status=0/SUCCESS) Main PID: 1168 (Xvnc) Tasks: 2 (limit: 4915) CGroup: /system.slice/system-vncserver.slice/vncserver@:1.service ├─1168 /usr/bin/Xvnc :1 -auth /home/nfsquires/.Xauthority -desktop vpn.squires.id.au:1 (nfsquires) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /home/nfsquires/.vnc/passwd -rfbport 5901 -rfbwait 30000 -loc └─1173 /usr/bin/vncconfig -nowin Jan 12 15:40:07 vpn.squires.id.au systemd[1]: Starting Remote desktop service (VNC)... Jan 12 15:40:07 vpn.squires.id.au vncserver[1154]: Killing Xvnc process ID 1113 Jan 12 15:40:10 vpn.squires.id.au vncserver[1160]: New 'vpn.squires.id.au:1 (nfsquires)' desktop is vpn.squires.id.au:1 Jan 12 15:40:10 vpn.squires.id.au vncserver[1160]: Starting applications specified in /home/nfsquires/.vnc/xstartup Jan 12 15:40:10 vpn.squires.id.au vncserver[1160]: Log file is /home/nfsquires/.vnc/vpn.squires.id.au:1.log Jan 12 15:40:10 vpn.squires.id.au systemd[1]: Started Remote desktop service (VNC). Additional info:
A copy of the selinux permissions from the users home directory # ls -laZ /home/nfsquires/.vnc* total 20 drwxrwxr-x. 2 nfsquires nfsquires unconfined_u:object_r:user_home_t:s0 112 Jan 12 15:40 . drwx------. 3 nfsquires nfsquires unconfined_u:object_r:user_home_dir_t:s0 114 Jan 12 15:40 .. -rw-r--r--. 1 nfsquires nfsquires system_u:object_r:user_home_t:s0 332 Jan 12 13:17 config -rw-------. 1 nfsquires nfsquires unconfined_u:object_r:user_home_t:s0 8 Jan 12 13:16 passwd -rw-r--r--. 1 nfsquires nfsquires system_u:object_r:user_home_t:s0 616 Jan 12 15:40 vpn.squires.id.au:1.log -rw-r--r--. 1 nfsquires nfsquires system_u:object_r:user_home_t:s0 5 Jan 12 15:40 vpn.squires.id.au:1.pid -rwxr-xr-x. 1 nfsquires nfsquires system_u:object_r:user_home_t:s0 92 Jan 12 13:17 xstartup
With setenforce 1 and restarting the service Jan 12 17:53:42 vpn.squires.id.au systemd[1]: Stopping Remote desktop service (VNC)... -- Subject: Unit vncserver@:1.service has begun shutting down -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit vncserver@:1.service has begun shutting down. Jan 12 17:53:42 vpn.squires.id.au vncserver[4436]: Killing Xvnc process ID 4378 Jan 12 17:53:42 vpn.squires.id.au audit[1]: AVC avc: denied { read } for pid=1 comm="systemd" name="vpn.squires.id.au:1.pid" dev="dm-0" ino=25247161 scontext=system_u:system_r:init_t:s0 tcontext=system_u: Jan 12 17:53:43 vpn.squires.id.au systemd[1]: Stopped Remote desktop service (VNC). -- Subject: Unit vncserver@:1.service has finished shutting down -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit vncserver@:1.service has finished shutting down. Jan 12 17:53:43 vpn.squires.id.au audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=vncserver@:1 comm="systemd" exe="/usr/lib/systemd/systemd" hostn Jan 12 17:53:43 vpn.squires.id.au systemd[1]: Starting Remote desktop service (VNC)... -- Subject: Unit vncserver@:1.service has begun start-up -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit vncserver@:1.service has begun starting up. Jan 12 17:53:43 vpn.squires.id.au vncserver[4447]: Can't find file /home/nfsquires/.vnc/vpn.squires.id.au:1.pid Jan 12 17:53:43 vpn.squires.id.au vncserver[4447]: You'll have to kill the Xvnc process manually Jan 12 17:53:46 vpn.squires.id.au vncserver[4451]: New 'vpn.squires.id.au:1 (nfsquires)' desktop is vpn.squires.id.au:1 Jan 12 17:53:46 vpn.squires.id.au vncserver[4451]: Starting applications specified in /home/nfsquires/.vnc/xstartup Jan 12 17:53:46 vpn.squires.id.au vncserver[4451]: Log file is /home/nfsquires/.vnc/vpn.squires.id.au:1.log Jan 12 17:53:46 vpn.squires.id.au audit[1]: AVC avc: denied { read } for pid=1 comm="systemd" name="vpn.squires.id.au:1.pid" dev="dm-0" ino=25247160 scontext=system_u:system_r:init_t:s0 tcontext=system_u: Jan 12 17:53:46 vpn.squires.id.au audit[1]: AVC avc: denied { read } for pid=1 comm="systemd" name="vpn.squires.id.au:1.pid" dev="dm-0" ino=25247160 scontext=system_u:system_r:init_t:s0 tcontext=system_u: Jan 12 17:53:46 vpn.squires.id.au audit[1]: AVC avc: denied { read } for pid=1 comm="systemd" name="vpn.squires.id.au:1.pid" dev="dm-0" ino=25247160 scontext=system_u:system_r:init_t:s0 tcontext=system_u: Jan 12 17:53:46 vpn.squires.id.au systemd[1]: vncserver@:1.service: PID file /home/nfsquires/.vnc/vpn.squires.id.au:1.pid not readable (yet?) after start: Permission denied Jan 12 17:53:47 vpn.squires.id.au dbus-daemon[4475]: [session uid=1000 pid=4473] Activating service name='org.freedesktop.systemd1' requested by ':1.0' (uid=1000 pid=4477 comm="systemctl --user import-enviro Jan 12 17:53:47 vpn.squires.id.au dbus-daemon[4475]: [session uid=1000 pid=4473] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1 Jan 12 17:55:14 vpn.squires.id.au systemd[1]: vncserver@:1.service: Start operation timed out. Terminating. Jan 12 17:55:17 vpn.squires.id.au audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=vncserver@:1 comm="systemd" exe="/usr/lib/systemd/systemd" host Jan 12 17:55:17 vpn.squires.id.au audit[1]: AVC avc: denied { unlink } for pid=1 comm="systemd" name="vpn.squires.id.au:1.pid" dev="dm-0" ino=25247160 scontext=system_u:system_r:init_t:s0 tcontext=system_ Jan 12 17:55:17 vpn.squires.id.au systemd[1]: Failed to start Remote desktop service (VNC). -- Subject: Unit vncserver@:1.service has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit vncserver@:1.service has failed. -- -- The result is failed. Jan 12 17:55:17 vpn.squires.id.au systemd[1]: vncserver@:1.service: Unit entered failed state. Jan 12 17:55:17 vpn.squires.id.au systemd[1]: vncserver@:1.service: Failed with result 'timeout'. After installing the selinux tools, I ran # ausearch -c 'systemd' --raw | audit2allow -M my-systemd The result .te was module my-systemd 1.0; require { type init_t; type unconfined_service_t; type user_home_t; type admin_home_t; class unix_stream_socket create; class file { open read unlink }; } #============= init_t ============== allow init_t admin_home_t:file { read unlink }; allow init_t unconfined_service_t:unix_stream_socket create; allow init_t user_home_t:file { open read unlink }; I installed the resultant my-systemd.pp # semodule -i my-systemd.pp dropped back to the user and started the vncserver $ sudo systemctl restart vncserver@:1.service The service started.
I was able to get vncserver properly start vi systemd after applying Neil's semodule. However, I also had to add "Environment=XDG_SESSION_TYPE=x11" to the [Service]. If I didn't add the environment variable, all I got was a black screen.
Fedora 26 here (coming from successful upgrades since F22 IIRC), vncserver worked fine until I moved from nouveau to NVidia drivers to avoid overheating of my Aspire Revo R3600 GPU. XFCE4 desktop. Black screen for vncserver upon reboot, as in Kent's comment. Originally files in ~/.vnc for my user mislabeled as root_home_t - restorecon -R of ~/.vnc brings them back to user_home_t. Still black screen. Mini-semodule solution, as in Neil's example, to address missing read permissions on vncserver .pid file: module my-systemd 1.0; require { type user_home_t; type init_t; class file { read unlink }; } #============= init_t ============== allow init_t user_home_t:file { read unlink }; And that fixed it for me - no need to add XDG_SESSION_TYPE=x11 (I would have had to look up where to add that entry, as I don't know where it should go).
This message is a reminder that Fedora 25 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 25. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '25'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 25 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed.