You are not logged in.
Pages: 1
I start VNC server on boot with systemd unit
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=simple
User=user1
PAMName=login
PIDFile=/home/%u/.vnc/%H%i.pid
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStartPre=/bin/dbus-launch
ExecStart=/usr/bin/vncserver %i -alwaysshared -fg
ExecStop=/usr/bin/vncserver -kill %i
[Install]
WantedBy=multi-user.targetIf I try to add Requires=dbus.service in [Unit] section instead of ExecStartPre=/bin/dbus-launch in [Service] section I get Xfce socket error when connect to VNC server. Result is the same if I create separate service for dbus-launch like
[Unit]
Description=D-Bus startup for VNC server
[Service]
Type=simple
User=user1
ExecStart=/bin/dbus-launchand add this service in Requires filed of VNC server unit.
Get the same result if start dbus-launch not from systemd service unit but from .xstartup file of VNC srever.
Question is why D-Bus starts one way when it is launched in ExecStartPre field of VNC server unit and another way when is launched from separate service unit or .xstartup file?
Last edited by Kirill Bugaev (2018-10-02 11:11:26)
Offline
ExecStart= commands are only run after all ExecStartPre= commands that were not prefixed with a "-" exit successfully.
Adding a Requires entry is not equivalent. Including Requires and After likely will be sufficient, but the proper way is listed in the man page as well:
Services with Type=dbus set automatically acquire dependencies of type Requires= and After= on dbus.socket
Last edited by Trilby (2018-10-02 13:49:54)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Adding a Requires entry is not equivalent. Including Requires and After likely will be sufficient,
I had tried add After entry with Requires, but result is the same.
but the proper way is listed in the man page as well:
man systemd.service wrote:Services with Type=dbus set automatically acquire dependencies of type Requires= and After= on dbus.socket
When I change type of VNC server unit to Type=dbus "systemctl status vncserver@:1" show
...
Loaded: bad-setting (Reason: Unit vncserver@:1.service has a bad unit file setting.)
...May be I need to specify BusName, but I don't know how.
Offline
Pages: 1