# problems with autostarting vnc server

## Adel Ahmed

I have installed tigervnc and created a script to autostart the vnc servers:

/etc/systemd/system/tigervnc@.service:

[Unit]

Description=Remote desktop service (VNC)

After=network.target

[Service]

Type=forking

User=adel

# Clean any existing files in /tmp/.X11-unix environment

ExecStartPre=-/usr/bin/vncserver -kill %i

ExecStart=/usr/bin/vncserver %i

ExecStop=/usr/bin/vncserver -kill %i

[Install]

WantedBy=multi-user.target

if I start the vnc serve by running vncserver :3 as the user adel, everything is fine

If i start via systemctl start tigervnc@3 I get the following in the journal

Apr 12 04:30:53 pc vncserver[6916]: Can't tell if 3 is on pc

Apr 12 04:30:53 pc vncserver[6916]: Use -kill :<number> instead

Apr 12 04:30:53 pc vncserver[6921]: usage: vncserver [:<number>] [-name <desktop-name>] [-depth <depth>]

Apr 12 04:30:53 pc vncserver[6921]: [-geometry <width>x<height>]

Apr 12 04:30:53 pc vncserver[6921]: [-pixelformat rgbNNN|bgrNNN]

Apr 12 04:30:53 pc vncserver[6921]: [-fp <font-path>]

Apr 12 04:30:53 pc vncserver[6921]: [-cc <visual>]

Apr 12 04:30:53 pc vncserver[6921]: [-fg]

Apr 12 04:30:53 pc vncserver[6921]: [-autokill]

Apr 12 04:30:53 pc vncserver[6921]: <Xvnc-options>...

Apr 12 04:30:53 pc vncserver[6921]: vncserver -kill <X-display>

Apr 12 04:30:53 pc vncserver[6921]: vncserver -list

Apr 12 04:30:53 pc systemd[1]: tigervnc@3.service: control process exited, code=exited status=2

Apr 12 04:30:53 pc systemd[1]: Failed to start Remote desktop service (VNC).

Apr 12 04:30:53 pc systemd[1]: Unit tigervnc@3.service entered failed state.

thanks

----------

## Adel Ahmed

bump

----------

## Logicien

I start the X11VNC server as a normal user after I have open an X session with this user. If you start the VNC server with Systemd, it will be start by the super user root. The super user root do not open any X session by default. The VNC server may not be able to start because it do not have any X session to serve.

And if there is an X session open, if it's not open by root himself, root do not have access to it by default.

It may be possible to start the VNC server using Systemd, but I prefer to start it during a normal user X session. X11VNC do not need root permissions to serve. It can be automate using the desktop environment method.

----------

