Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 692268 - app-emulation/libvirt - wrong dependency at service-unit libvirtd.service
Summary: app-emulation/libvirt - wrong dependency at service-unit libvirtd.service
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Matthias Maier
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-16 06:11 UTC by Stefan Schmid
Modified: 2019-08-18 07:18 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Schmid 2019-08-16 06:11:17 UTC
It doesn't help if the network management tool has been started but the network itself is not set up yet.

In my case the NetworkManager creates a network bridge which is needed for the VM of libvirt. But without correct dependency the VM starts before the NetworkManager can do its job.

In the service-unit "libvirtd.service" should "After=network.target" replaced by "After=network-online.target"

My Setup:
app-emulation/libvirt-5.5.0-r1
net-misc/networkmanager-1.16.0
sys-apps/systemd-242-r6
Comment 1 Matthias Maier gentoo-dev 2019-08-16 15:09:36 UTC
-(In reply to Stefan Schmid from comment #0)
> It doesn't help if the network management tool has been started but the
> network itself is not set up yet.
> 
> In my case the NetworkManager creates a network bridge which is needed for
> the VM of libvirt. But without correct dependency the VM starts before the
> NetworkManager can do its job.
> 
> In the service-unit "libvirtd.service" should "After=network.target"
> replaced by "After=network-online.target"

We install the systemd service exactly as shipped by upstream. The "After=network.target" dependency seems to be correct - strictly speaking libvirt (and guests) do not need immediate internet access.

May I suggest two solutions for your special configuration case:

 - You can override the service unit by creating, say,

   /etc/systemd/system/libvirtd.service.d/99not-too-early.conf

   with something like (untested)

   [Unit]
   After=network-online.target

Alternatively:

 - I personally use systemd-networkd for the static bits of my network configuration which happens to be precisely a bridge for libvirt:

   /etc/systemd/network/br0.netdev:

   [NetDev]
   Name=br0
   Kind=bridge
   MACAddress=<something>


   /etc/systemd/network/br0.netdev:

   [Match]
   Name=br0

   [Link]
   RequiredForOnline=yes

   [Network]
   Address=<something>
   ConfigureWithoutCarrier=yes
   IPForward=yes

   Never encountered any issues or race conditions with that.


I hope that helped you with your configuration :-)
Comment 2 Stefan Schmid 2019-08-16 17:46:54 UTC
I'm already using the override as a workaround.
I just thought that for others this would avoid a similar problem.
Comment 3 Matthias Maier gentoo-dev 2019-08-16 18:49:26 UTC
(In reply to Stefan Schmid from comment #2)
> I'm already using the override as a workaround.
> I just thought that for others this would avoid a similar problem.

No worries, thanks a lot for the bug report.

It is just that we have to be a bit conservative with configuration changes of that kind. (Switching the default configuration in such a way has the potential to break a fair number of installations.)
Comment 4 Stefan Schmid 2019-08-18 07:18:35 UTC
If libvirt should ever get its own entry in the Gentoo-Wiki, would that be something that should be mentioned there?

PS: Thanks for responding to this bug report and explanation.