2

The unit file works when manually started. systemctl --user enable does not auto-start the service after user login.

Unit File

[Unit]
Description = VNC Duplicate Display RDP
After = default.target

[Service]
Type = simple
ExecStart = /opt/tigervnc/usr/bin/x0vncserver -passwordfile /etc/.vncpasswd -display :0
TimeoutSec = 30
RestartSec = 10
Restart = always

[Install]
WantedBy = default.target

I have reloaded and reenabled this unit

$ systemctl --user daemon-reload
$ systemctl --user reenable x0vncserver

Status

Status after user login

● x0vncserver.service - VNC Duplicate Display RDP
   Loaded: loaded (/usr/lib/systemd/user/x0vncserver.service; enabled; vendor preset: enabled)
   Active: inactive (dead)

Target Status

$ systemctl --user --type target
UNIT           LOAD   ACTIVE SUB    DESCRIPTION
basic.target   loaded active active Basic System
default.target loaded active active Default
paths.target   loaded active active Paths
sockets.target loaded active active Sockets
timers.target  loaded active active Timers

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

5 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

Manual Start

$ systemctl --user start x0vncserver
$ systemctl --user status x0vncserver
● x0vncserver.service - VNC Duplicate Display RDP
   Loaded: loaded (/usr/lib/systemd/user/x0vncserver.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2017-08-07 18:27:00 IST; 5s ago
 Main PID: 2999 (x0vncserver)
   CGroup: /user.slice/user-1004.slice/user@1004.service/x0vncserver.service
           └─2999 /opt/tigervnc/usr/bin/x0vncserver -passwordfile /etc/.vncpasswd -display :0

Aug 07 18:27:00 Machine systemd[930]: Started VNC Duplicate Display RDP.
Aug 07 18:27:00 Machine x0vncserver[2999]: Mon Aug  7 18:27:00 2017
Aug 07 18:27:00 Machine x0vncserver[2999]:  Geometry:    Desktop geometry is set to 1920x1080+0+0
Aug 07 18:27:00 Machine x0vncserver[2999]:  Main:        XTest extension present - version 2.2
Aug 07 18:27:00 Machine x0vncserver[2999]:  Main:        Listening on port 5900

References

I've looked around and found users with similar issues but none of the proposed solutions fixed my issue

Update

This happens to a particular user. systemctl --user enable works for at least one other user on the same device.

  • What does journalctl tell you? – Raman Sailopal Aug 7 '17 at 13:06
  • Good question, it tells nothing. Cannot find the text x0vncserver – Lordbalmon Aug 7 '17 at 13:07
  • "works for at least one other user", what is the user that it works for and what are the permissions on /etc/.vncpasswd? Also, it might only work for one user at a time if all instances attempt to listen on the same port (5900 is the default) – smokes2345 Jul 10 '18 at 20:00
0

I had the same problem, what fixed it for me was using it as follows:

#!/bin/bash
/usr/bin/x0vncserver -PasswordFile=/home/luserid/.vnc/passwd -display=:0

it seems it won't start right without the -display=:0.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.