libvirt-bin.service does not read /etc/default/libvirt-bin

Bug #1541810 reported by Radek Zajic
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
libvirt
New
Undecided
Unassigned
libvirt (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

When libvirt-bin initscript was converted to systemd, it was seriously broken.

While the old initscript reads the contents of /etc/default/libvirt-bin in which I can specify additional command line parameters of libvirtd (such as --listen), the new /etc/systemd/system/multi-user.target.wants/libvirt-bin.service contains only:
(...)
[Service]
Type=notify
Environment=LIBVIRTD_ARGS= KRB5_KTNAME=/etc/libvirt/libvirt.keytab
ExecStart=/usr/sbin/libvirtd $LIBVIRTD_ARGS
(...)
and is *overwritten after each update of the package*.

Please fix this issue by "sourcing" the contents of /etc/default/libvirt-bin so that the directives inside this config file affect at least command line parameters of libvirtd (btw, pre-systemd used libvirtd_opts, not LIBVIRTD_ARGS), or provide alternative way of configuring libvirtd command line parameters.

Thank you.

(Affected distribution: at least Ubuntu 15.10)

Revision history for this message
Radek Zajic (radek-zajic) wrote :

wrong project, sorry; fixed by this change

affects: apparmor → libvirt
Revision history for this message
Martin Pitt (pitti) wrote :

In the interest of backwards compatibility this needs to look something like

Environment=KRB5_KTNAME=/etc/libvirt/libvirt.keytab
EnvironmentFile=/etc/default/libvirt-bin
ExecStart=/usr/sbin/libvirtd $LIBVIRTD_ARGS

(Assuming that LIBVIRTD_ARGS is specified in the default/ file).

Indeed this style is obsolete as a lot of packages implement that in a totally different way.

The better approach is to use a configuration file that is actually read by libvirt itself, instead of passing configuration on the command line. This of course needs to be supported upstream, but at least then it will work the same way everywhere and doesn't need to be documented (differently) by distros working around the lack of a proper config file.

As a fallback, one can create a drop-in which overrides/adds particular keys to the .service file, with "systemctl edit libvirt-bin", which is a convenience shortcut for creating a /etc/systemd/system/libvirt-bin.service.d/mysettings.conf . It's also conceivable to do that in the postinst during package upgrade.

summary: - Systemd Libvirt-bin script broken
+ libvirt-bin.service does not read /etc/default/libvirt-bin
Revision history for this message
Martin Pitt (pitti) wrote :

> The better approach is to use a configuration file that is actually read by libvirt itself

For example, the "-l" option can already be set in /etc/libvirt/libvirtd.conf in listen_tcp. Rather confusing to have *two* places to configure it..

Revision history for this message
Radek Zajic (radek-zajic) wrote :

While there really is a "listen_tcp" directive in /etc/libvirt/libvirtd.conf, it is ignored by the daemon (don't ask me why). I do have this option set to "listen_tcp = 1", unfortunately libvirtd does not listen on TCP unless I start the daemon with "-l" command line parameter. :-(
(Maybe a bug in libvirtd?)

Revision history for this message
Serge Hallyn (serge-hallyn) wrote : Re: [Bug 1541810] Re: libvirt-bin.service does not read /etc/default/libvirt-bin

Thanks - Note that in xenial this will be fixed by the upcoming
merge from Debian, where we (it looks like) switch to the upstream
.service file which does include the defaults file.

Hoewver, listen_tcp being ignored is definately a bug. Would you
mind opening a new bug for that?

Revision history for this message
Stefan Bader (smb) wrote :

Latest merge to libvirt-1.3.1 has been uploaded to Xenial. This should now read the config file.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in libvirt (Ubuntu):
status: New → Confirmed
Changed in libvirt (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.