Public bug reported:

$ lxc launch ubuntu-daily:plucky pprc
$ lxc shell pprc
# apt update
# apt install libvirt-daemon-driver-qemu
[...]
Setting up libvirt-daemon-driver-qemu (11.0.0-2ubuntu6) ...
useradd warning: libvirt-qemu's uid 64055 is greater than SYS_UID_MAX 999
fatal: The group `libvirt' does not exist.
Enabling libvirt default network
ln: failed to create symbolic link '/etc/libvirt/qemu/networks/autostart/': No 
such file or directory
dpkg: error processing package libvirt-daemon-driver-qemu (--configure):
 installed libvirt-daemon-driver-qemu package post-installation script 
subprocess returned error exit status 1
dmesg: read kernel buffer failed: Operation not permitted
[...]
Errors were encountered while processing:
 libvirt-daemon-driver-qemu
needrestart is being skipped since dpkg has failed
Error: Sub-process /usr/bin/dpkg returned an error code (1)

=> The '/etc/libvirt/qemu/networks/autostart/' is assumed to exist by
libvirt-daemon-driver-qemu.postinst but it's not there. It's supposed to
be installed by d/libvirt-daemon-driver-network.dirs.

# ll /etc/libvirt/qemu/networks/autostart
ls: cannot access '/etc/libvirt/qemu/networks/autostart': No such file or 
directory
# apt install libvirt-daemon-driver-network
[...]
# ll /etc/libvirt/qemu/networks/autostart
total 8
drwxr-xr-x 2 root root 4096 Apr 16 08:12 ./
drwxr-xr-x 3 root root 4096 Apr 16 08:12 ../
lrwxrwxrwx 1 root root   38 Apr 16 08:12 default.xml -> 
/etc/libvirt/qemu/networks/default.xml  ## ATTENTION: This is a broken/dangling 
symlink

=> Alright, looking OK. But now there can be another issue when libvirt-
daemon-driver-qemu.postinst tries to assign an alternative IP address
range, because the default 192.168.122.1/24 is already taken, e.g. in
nested environments. We can easily simulate that by assigning the
192.168.122.1 IP to eth0:

# ip addr add 192.168.122.1 dev eth0  ## This would also happen if we're in a 
nested environment
# apt purge libvirt-daemon-driver-qemu
# apt install --reinstall libvirt-daemon-driver-qemu
[...]
Setting up libvirt-daemon-driver-qemu (11.0.0-2ubuntu6) ...
useradd warning: libvirt-qemu's uid 64055 is greater than SYS_UID_MAX 999
Default libvirt network on 192.168.122.1/24 already taken
Changing to free 192.168.123.1/24
sed: can't read /etc/libvirt/qemu/networks/default.xml: No such file or 
directory
dpkg: error processing package libvirt-daemon-driver-qemu (--configure):
 installed libvirt-daemon-driver-qemu package post-installation script 
subprocess returned error exit status 2
Processing triggers for man-db (2.13.0-1) ...
Errors were encountered while processing:
 libvirt-daemon-driver-qemu
needrestart is being skipped since dpkg has failed
Error: Sub-process /usr/bin/dpkg returned an error code (1)

=> libvirt-daemon-driver-qemu.postinst tries to manipulate
/etc/libvirt/qemu/networks/default.xml (using "sed") which is not there.
The file is created by "d/libvirt-daemon-config-network.postinst" from
the /usr/share/libvirt/networks/default.xml template:

$ apt-file find networks/default.xml
libvirt-daemon-config-network: /usr/share/libvirt/networks/default.xml

# apt install libvirt-daemon-config-network
[...]
Setting up libvirt-daemon-driver-qemu (11.0.0-2ubuntu6) ...
Default libvirt network on 192.168.122.1/24 already taken
Changing to free 192.168.123.1/24
Enabling libvirt default network
[...]

=> Hooray, libvirt-daemon-driver-qemu is now successfully configured!

==== Workaround ====

In the end, the workaround is to "apt install libvirt-daemon-config-
network".

==== Proposed Fix ====

We need to modify libvirt's d/control, adding a "Pre-Depends: libvirt-
daemon-config-network" to the libvirt-daemon-driver-qemu binary. This
will automatically pull in libvirt-daemon-driver-network, creating
"/etc/libvirt/qemu/networks/autostart". It needs to be a Pre-Depends, as
the file "/etc/libvirt/qemu/networks/default.xml" is only created from
the "/usr/share/libvirt/networks/default.xml" template in libvirt-
daemon-config-network.postinst, i.e. after package configuration.

** Affects: libvirt (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

  $ lxc launch ubuntu-daily:plucky pprc
  $ lxc shell pprc
  # apt update
  # apt install libvirt-daemon-driver-qemu
  [...]
  Setting up libvirt-daemon-driver-qemu (11.0.0-2ubuntu6) ...
  useradd warning: libvirt-qemu's uid 64055 is greater than SYS_UID_MAX 999
  fatal: The group `libvirt' does not exist.
  Enabling libvirt default network
  ln: failed to create symbolic link '/etc/libvirt/qemu/networks/autostart/': 
No such file or directory
  dpkg: error processing package libvirt-daemon-driver-qemu (--configure):
-  installed libvirt-daemon-driver-qemu package post-installation script 
subprocess returned error exit status 1
+  installed libvirt-daemon-driver-qemu package post-installation script 
subprocess returned error exit status 1
  dmesg: read kernel buffer failed: Operation not permitted
  [...]
  Errors were encountered while processing:
-  libvirt-daemon-driver-qemu
+  libvirt-daemon-driver-qemu
  needrestart is being skipped since dpkg has failed
  Error: Sub-process /usr/bin/dpkg returned an error code (1)
  
- 
- => The '/etc/libvirt/qemu/networks/autostart/' is assumed to exist by 
libvirt-daemon-driver-qemu.postinst but it's not there. It's supposed to be 
installed by d/libvirt-daemon-driver-network.dirs.
- 
+ => The '/etc/libvirt/qemu/networks/autostart/' is assumed to exist by
+ libvirt-daemon-driver-qemu.postinst but it's not there. It's supposed to
+ be installed by d/libvirt-daemon-driver-network.dirs.
  
  # ll /etc/libvirt/qemu/networks/autostart
  ls: cannot access '/etc/libvirt/qemu/networks/autostart': No such file or 
directory
  # apt install libvirt-daemon-driver-network
  [...]
  # ll /etc/libvirt/qemu/networks/autostart
  total 8
  drwxr-xr-x 2 root root 4096 Mar 31 13:54 ./
  drwxr-xr-x 3 root root 4096 Apr 16 07:53 ../
  
- 
- => Alright, looking OK. But now there can be another issue when 
libvirt-daemon-driver-qemu.postinst tries to assign an alternative IP address 
range, because the default 192.168.122.1/24 is already taken, e.g. in nested 
environments. We can easily simulate that by assigning the 192.168.122.1 IP to 
eth0:
+ => Alright, looking OK. But now there can be another issue when libvirt-
+ daemon-driver-qemu.postinst tries to assign an alternative IP address
+ range, because the default 192.168.122.1/24 is already taken, e.g. in
+ nested environments. We can easily simulate that by assigning the
+ 192.168.122.1 IP to eth0:
  
  # ip addr add 192.168.122.1 dev eth0  ## This would also happen if we're in a 
nested environment
  # apt purge libvirt-daemon-driver-qemu
  # apt install --reinstall libvirt-daemon-driver-qemu
  [...]
  Setting up libvirt-daemon-driver-qemu (11.0.0-2ubuntu6) ...
  useradd warning: libvirt-qemu's uid 64055 is greater than SYS_UID_MAX 999
  Default libvirt network on 192.168.122.1/24 already taken
  Changing to free 192.168.123.1/24
  sed: can't read /etc/libvirt/qemu/networks/default.xml: No such file or 
directory
  dpkg: error processing package libvirt-daemon-driver-qemu (--configure):
-  installed libvirt-daemon-driver-qemu package post-installation script 
subprocess returned error exit status 2
+  installed libvirt-daemon-driver-qemu package post-installation script 
subprocess returned error exit status 2
  Processing triggers for man-db (2.13.0-1) ...
  Errors were encountered while processing:
-  libvirt-daemon-driver-qemu
+  libvirt-daemon-driver-qemu
  needrestart is being skipped since dpkg has failed
  Error: Sub-process /usr/bin/dpkg returned an error code (1)
  
  => libvirt-daemon-driver-qemu.postinst tries to manipulate
  /etc/libvirt/qemu/networks/default.xml (using "sed") which is not there.
  The file is created by "d/libvirt-daemon-config-network.postinst" from
  the /usr/share/libvirt/networks/default.xml template:
  
  $ apt-file find networks/default.xml
  libvirt-daemon-config-network: /usr/share/libvirt/networks/default.xml
  
- 
  # apt install libvirt-daemon-config-network
  [...]
  Setting up libvirt-daemon-driver-qemu (11.0.0-2ubuntu6) ...
  Default libvirt network on 192.168.122.1/24 already taken
  Changing to free 192.168.123.1/24
  Enabling libvirt default network
  [...]
  
  => Hooray, libvirt-daemon-driver-qemu is now successfully configured!
  
- 
  ==== Workaround ====
  
- In the end, the workaround is to "apt install ilbvirt-daemon-driver-
- qemu".
- 
+ In the end, the workaround is to "apt install libvirt-daemon-config-
+ network".
  
  ==== Proposed Fix ====
  
  We need to modify libvirt's d/control, adding a "Pre-Depends: libvirt-
  daemon-config-network" to the libvirt-daemon-driver-qemu binary. This
  will automatically pull in libvirt-daemon-driver-network, creating
  "/etc/libvirt/qemu/networks/autostart". It needs to be a Pre-Depends, as
  the file "/etc/libvirt/qemu/networks/default.xml" is only created from
  the "/usr/share/libvirt/networks/default.xml" template in libvirt-
  daemon-config-network.postinst, i.e. after package configuration.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2107448

Title:
  libvirt-daemon-driver-qemu fails to install (--configure) due to
  .postinst issue

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/2107448/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to