Add an [Install] section to the user unit and tell systemd to ignore the
.desktop file explicitly.
Also add missing ordering dependencies. Without this, the service fails if
it is started before e.g. $DISPLAY is set.
Commit 098268a33c (systemd: Update path
in unit file) was a really incomplete change. Let's change every
occurrence of /var/run to /run.
Signed-off-by: Christian Hesse <[email protected]>
Acked-by: Frediano Ziglio <[email protected]>
.socket systemd units already automatically get a
Before=sockets.service, and the udev rule we have will ensure that when
the appropriate virtio device is there, the socket unit will be started,
so this WantedBy dependency is not needed, and is in part responsible
for these warnings:
[ INFO ] dev-virtio\x2dports-com.redhat.spice.0.device is not active.
[DEPEND] Dependency failed for Activation socket for spice guest agent daemon.
https://bugzilla.redhat.com/show_bug.cgi?id=1545212
Signed-off-by: Christophe Fergeau <[email protected]>
The udev rule already adds SYSTEMD_WANTS=spice-vdagentd.socket
to the relevant virtio devices, which automatically adds Wants=${device}
to spice-vdagentd.socket (see 'systemctl show spice-vdagentd.socket').
Adding a Requisite/After for these ports is at best redundant, and most
likely wrong as this is causing boot time warnings:
[ INFO ] dev-virtio\x2dports-com.redhat.spice.0.device is not active.
[DEPEND] Dependency failed for Activation socket for spice guest agent daemon.
https://bugzilla.redhat.com/show_bug.cgi?id=1545212
Signed-off-by: Christophe Fergeau <[email protected]>
The "Requisite" directive is intended to require that the virtio port
device exists before starting the vdagent socket unit. If the device
does not exist, the socket should fail to start. However, without using
"After", the socket will still start even when the device is not
present.
The man page for systemd.unit (v239+) says the following about
'Requisite=':
"Similar to Requires=. However, if the units listed here are not
started already, they will not be started and the starting of this unit
will fail immediately. Requisite= does not imply an ordering
dependency, even if both units are started in the same transaction.
Hence this setting should usually be combined with After=, to ensure
this unit is not started before the other unit."
See also https://github.com/systemd/systemd/issues/4756 for further
details (particularly the following comment:
https://github.com/systemd/systemd/issues/4756#issuecomment-267005324)
Signed-off-by: Jonathon Jongsma <[email protected]>
Acked-by: Lukáš Hrázký <[email protected]>
It is possible that g_get_user_special_dir() return NULL for
G_USER_DIRECTORY_DESKTOP or G_USER_DIRECTORY_DOWNLOAD; This is a sure
thing to happen in case xdg-user-dirs hasn't been run yet.
Keeping spice-vdagent to run on Initialization stage of
X-GNOME-Autostart-Phase could trigger a race with xdg-user-dirs that
also runs on Initialization, which is the earliest stage possible.
Moving to spice-vdagent to run WindowManager stage avoids the race
with xdg-user-dirs and still runs before any graphical application.
Tested also moving to Desktop stage, which is 4th stage (out of 5) and
worked without apparent drawbacks.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1623947
Signed-off-by: Victor Toso <[email protected]>
Acked-by: Uri Lublin <[email protected]>
If we are configured to use the systemd init script, also add support
for systemd socket activation. systemd will listen on the socket that is
used to communicate between the session agent and the system daemon.
When the session agent connects, the system daemon will automatically be
started. The socket will be enabled only if the required virtio-port
device exists. The socket is disabled when the device is removed.
This has a couple minor advantages to the previous approach:
- For VMS that are not running a graphical desktop (and thus no
session agents are running), the system vdagent daemon won't get
started at all even if the spice virtio port is configured. Only the
socket will be enabled. In the previous approach, the system daemon
was started when the virtio device was added regardless of whether
it was needed or not.
- Solves issues related to switching between systemd targets. With the
previous approach, when a user switches to a different target
("systemctl isolate multi-user.target"), spice-vdagentd.target was
stopped by systemd (since "isolate" by definition stops all targets
except the one specified). This meant that if the user subsequently
switched back to graphical.target, the spice-vdagentd.target would
still be disabled and vdagent functionality would not work. With
this change, the socket will still be listening after switching to a
different target, so as soon as a session agent tries to connect to
the socket, the system daemon will get restarted.
Fixes: rhbz#1340160
Signed-off-by: Jonathon Jongsma <[email protected]>
Acked-by: Victor Toso <[email protected]>
Ubuntu's Unity still ships the Startup Applications app
(gnome-session-properties).
Setting NoDisplay=true means this autostart file won't show up in there
since this isn't something we really want users to unknowingly disable
that easily.
Resolves: https://bugs.freedesktop.org/show_bug.cgi?id=98465
Many systems don't use rsyslog, others don't need seperate syslog files
for vdagent.
With systemd journal, It's possible to filter
spice-vdagent/spice-vdagentd log messages out of /var/log/messages:
journalctl SYSLOG_IDENTIFIER=spice-vdagent SLOG_IDENTIFIER=spice-vdagentd
This simplify spice-vdagent packaging and updates, since there are no
config files to deal with.
Related:
https://bugzilla.redhat.com/show_bug.cgi?id=1136881
Now a days udev will create a /dev/uinput node without the module being loaded
based on devname:uinput from the modinfo, allowing the module to be correctly
auto-loaded when needed.
https://bugzilla.redhat.com/show_bug.cgi?id=963201
Signed-off-by: Hans de Goede <[email protected]>
When not running under a spice-vdagent vm we automatically exit, and we should
not be auto-restarted then -> Drop X-GNOME-AutoRestart from our .desktop file.
Signed-off-by: Hans de Goede <[email protected]>