Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

systemd vnc service does not startup properly during VM startup when user home is mounted with NFS root squash #1895

Open
sroth80021 opened this issue Jan 14, 2025 · 2 comments

Comments

@sroth80021
Copy link

Describe the bug
systemd vnc service does not start properly during VM startup when user home is mounted with NFS root squash.

To Reproduce

  1. install systemd vnc service on Oracle Linux 9
  2. systemctl disable firewalld
  3. create user with NFS home directory, and ensure NFS root squash is enabled.
  4. add user to /etc/tigervnc/vncserver.users with :2 display
  5. sudo to user and run vncpasswd to set password
  6. systemctl enable vncserver@:2.service
  7. systemctl start vncserver@:2.service
  8. verify vnc session from client works properly
  9. reboot system
  10. systemctl status vncserver@:2.service (should be active)
  11. netstat -nltlp | grep 5902 (should be open)

Actual behavior for step 10 is:
[sroth@sroth-ol9 ~]$ systemctl status vncserver@:2.service
○ vncserver@:2.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver@:2.service; enabled; preset: disabled)
Active: inactive (dead) since Fri 2025-01-10 11:21:46 EST; 4min 8s ago
Duration: 4ms
Process: 2361 ExecStartPre=/usr/libexec/vncsession-restore :2 (code=exited, status=0/SUCCESS)
Process: 2370 ExecStart=/usr/libexec/vncsession-start :2 (code=exited, status=0/SUCCESS)
Main PID: 2377 (code=exited, status=0/SUCCESS)
CPU: 24ms

Expected behavior
vncserver@:2.service should be Active and port 5902 should be open.

Server (please complete the following information):

  • OS: Oracle Linux 9.5
  • VNC server: TigerVNC
  • VNC server version: 1.14.1-1
  • Server downloaded from: ol9_appstream yum repository
  • Server was started using: systemctl enable vncserver@:2.service

Additional context
With a local user, the vncserver service starts up properly during VM startup.

It appears that vncservice (as root) is trying to write to the user's home directory at path ~/.local/state/tigervnc. I see the following logged in journalctl:

[root@sroth-ol9 ~]# journalctl -fe|grep vnc
Jan 10 15:12:51 sroth-ol9.... vncsession[2406]: pam_unix(tigervnc:session): session opened for user sroth(uid=....) by sroth(uid=0)
Jan 10 15:12:51 sroth-ol9.... vncsession[3057]: Failure creating "/home/sroth/.local/state/tigervnc": Permission denied
Jan 10 15:12:51 sroth-ol9..... vncsession[2406]: vncsession: vncserver exited with status=71

It also seems to work properly for a user with a NFS root squash home directory if I change the systemd service file to delay startup until the end of the VM startup process, by changing

After=syslog.target network.target systemd-user-sessions.service
to
After=multi-user.target

I'm not sure why/how that changes the behavior, but it provided a workaround in my case.

@sroth80021
Copy link
Author

Also as an FYI, the syslog.target referenced in the systemd unit file does not appear to exist on Oracle Linux 9.5:

[root@sroth-ol9 ~]# systemctl status syslog.target
Unit syslog.target could not be found.

This does not appear to be the cause of this issue, and does not appear to cause issues during startup, just FYI.

@CendioOssman
Copy link
Member

root squash was actually considered during the design, so it should not be the problem. The fact that a delay resolves is supports that theory.

Perhaps the issue is that the service starts before the home directory is mounted?

Please restore the service file to original and reboot. Then check the output of the command systemd-analyze critical-chain vncserver@:2.service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants