[Bug 1824236] Re: supermin/liguestfs fails to configure network

Eric Desrochers eric.desrochers at canonical.com
Thu May 16 12:48:49 UTC 2019


[sts-sponsor]

I have some concern about the patch being more or less suggested by
upstream, but never merged upstream. I see they previously merge a
workaround for Ubuntu, can you discuss with them and see if that can be
merged again upstream ? I'm trying to avoid to have to carry a patch in
Ubuntu for libguestfs forever because upstream didn't merge it.

As I read the code so far, the workaround does (and only needed in ubuntu FWIU):
    touch /etc/fstab
    rm -f /etc/dhcp/dhclient-enter-hooks.d/resolved

but the workaround is applied to all, regardless of the Linux
distribution.

If we PR something upstream, would it be possible to suggest a separate
if statement which will detect if it's ubuntu and/or debian

What would you think of something like this (or something along those line, so that the workaround is only applied in a ubuntu context) it would look like cleaner IMHO:
-----
++ # Workarounds for ubuntu/debian
++ ubuntu = <SOMETHING>
++ if test "$guestfs_network" = 1 and ubuntu = <SOMETHING>; then
++ touch /etc/fstab
++ rm -f /etc/dhcp/dhclient-enter-hooks.d/resolved
fi

+ if test "$guestfs_network" = 1; then
+ iface=$(ls -I all -I default -I lo /proc/sys/net/ipv4/conf)
+- touch /etc/fstab # Workaround for Ubuntu.
-- # Two workarounds for Ubuntu:
-- touch /etc/fstab
-- rm -f /etc/dhcp/dhclient-enter-hooks.d/resolved
+ if dhclient --version >/dev/null 2>&1; then
+ dhclient $iface
+ else
-----

I don't feel comfortable to sponsor this in Eoan, before further
discussion with upstream to merged the change.

-- 
You received this bug notification because you are a member of Ubuntu
Sponsors Team, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1824236

Title:
  supermin/liguestfs fails to configure network

Status in libguestfs package in Ubuntu:
  In Progress
Status in supermin package in Ubuntu:
  In Progress
Status in libguestfs source package in Bionic:
  In Progress
Status in supermin source package in Bionic:
  New
Status in libguestfs source package in Cosmic:
  In Progress
Status in supermin source package in Cosmic:
  New
Status in libguestfs source package in Disco:
  In Progress
Status in supermin source package in Disco:
  New

Bug description:
  Description

  supermin cannot configure network on Bionic onward.

  This bug is a combination of supermin package and 
  /etc/dhcp/dhclient-enter-hooks.d/resolved script from systemd,
  present on Bionic onward.
  When supermin creates the appliance does chroot and executes its init script.
  If networking is enabled init will call dhclient sript to configure the network.

  On Bionic onward the make_resolv_conf function of dhclient_script is overwritten
  in /etc/dhcp/dhclient-eneter-hooks.d/resolved which before exiting restarts
  the systemd.resolved service. 
  However, this happening in chroot environment fails with 
  "System has not been booted with systemd as init system (PID 1). Can't operate."
  and network is left unconfigured.

  
  Test Case 

  $ sudo guestfish -a xenial-server-cloudimg-amd64-disk1.img --network -v << EOF 
  run 
  mount /dev/sda1 / 
  command 'apt update' 
  EOF 

  libguestfs: launch: program=guestfish
  libguestfs: launch: version=1.36.13
  libguestfs: launch: backend registered: unix
  libguestfs: launch: backend registered: uml
  libguestfs: launch: backend registered: libvirt
  ...
  supermin: deleting initramfs files
  supermin: chroot
  Starting /init script ...
  ...
  + dhclient --version
  + dhclient eth0
  System has not been booted with systemd as init system (PID 1). Can't operate.
  ...
  commandrvf: apt update

  WARNING: apt does not have a stable CLI interface. Use with caution in
  scripts.

  W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease  Temporary failure resolving 'archive.ubuntu.com'
  W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
  W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
  W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
  W: Some index files failed to download. They have been ignored, or old ones used instead.
  ...

  
  Workaround

  1) Assume that libguestfs is installed, if not : 
  $ sudo apt-get install libguestfs-tools 

  2) Move the base.tar.gz to a temp dir, extract and remove tarball 
  $ sudo mv /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/base.tar.gz ~/tempdir/ 
  $ cd ~/tempdir 
  $ sudo tar -xzvf base.tar.gz 
  $ sudo rm base.tar.gz 

  3) Remove the etc/dhcp/dhclient-enter-hooks.d/resolved file 
  $ sudo rm etc/dhcp/dhclient-enter-hooks.d/resolved 

  4) Create tarball again 
  $ sudo tar -czvf base.tar.gz etc 

  5) Move it back to installation dir 
  $ sudo mv base.tar.gz /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/ 

  6) Clean cache 
  $ sudo rm -rf /var/tmp/.guestfs*

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



More information about the Ubuntu-sponsors mailing list