Welcome to the Linux Foundation Forum!

LFS211: LAB 5.8 - VNC Server Autostart - Timeout with provided [email protected]


I have been trying to create a [email protected] and ran into issues that I managed to fix. However, since I fixed it by modifying the service content proposed in the Solutions of the lab 5.8, I propose here the content that made it work:

Static hostname: UbuntuLTS
Chassis: vm
Virtualization: kvm
Operating System: Ubuntu 20.04.2 LTS
Kernel: Linux 5.8.0-44-generic
Architecture: x86-64

[email protected] proposed by lab solutions:

/etc/systemd/system$ cat [email protected] 
Description=Remote desktop service (VNC) on port :%I
After=syslog.target network.target


ExecStartPre=-/usr/bin/vncserver -kill :%i
ExecStart=/usr/bin/vncserver  :%i  -localhost
ExecStop=-/usr/bin/vncserver -kill :%i


Performing the systemctl daemon-reload and starting it with systemctl start [email protected] resulted in a timeout:

Job for [email protected] failed because a timeout was exceeded.
See "systemctl status [email protected]" and "journalctl -xe" for details.

Commenting out the both lines:

 # ExecStartPre=-/usr/bin/vncserver -kill :%i
 # PIDFile=/home/username/.vnc/%H:%i.pid

Made the service to start and run properly.

It seems that the first comment is needed as the ExecStartPre fails to kill the (in)-existing vncserver process, while the second comment I am not sure why it was timing out as I do have in my ~/.vnc folder a UbuntuLTS:41.pid, corresponding to the %H:%i.pid

How relevant is that PIDFile line in the service, and why doesnt it work?



  • luisviveropena
    luisviveropena Posts: 1,086

    Hi @LioC ,

    Did you change "User=username" by your username in the configuration file?


  • LioC
    LioC Posts: 7

    Hi Luis (Lionel here),

    yes, I did, and we were yesterday troubleshooting the same service on the same VM. But then, the username filds were not properly set in the both "username" locations, and the error messages we had then related to it.

    Now, the username fields have been updated correctly, the service runs but not without commenting out the ExecStartPre and PIDFile lines.



  • luisviveropena
    luisviveropena Posts: 1,086

    Hi Lionel, I'm glad it's working now! Have you tried stopping, starting, and seeing the status of the service?


  • LioC
    LioC Posts: 7

    Yes, it works now perfectly, thanks! : )

  • luisviveropena
    luisviveropena Posts: 1,086

    You're welcome, Lionel! :)



Upcoming Training