[Bug 1649280] [NEW] virt-builder stucks in endless loop due to /sbin/dhclient-script failure

Kamil Madac 1649280 at bugs.launchpad.net
Mon Dec 12 14:02:49 UTC 2016


Public bug reported:

virt-builder cannot build VM image as it uses locally installed /sbin
/dhclient-script. dhclient-script tries to find out whether / is RW and
reads /etc/fstab. Issue is that it does not exists in supermin machine
which virt-builder uses and it end up in an endless loop of messages:

...
/sbin/dhclient-script: 31: /sbin/dhclient-script: cannot open /etc/fstab: No such file
RTNETLINK answers: File exists
/sbin/dhclient-script: 31: /sbin/dhclient-script: cannot open /etc/fstab: No such file
RTNETLINK answers: File exists
/sbin/dhclient-script: 31: /sbin/dhclient-script: cannot open /etc/fstab: No such file
RTNETLINK answers: File exists
/sbin/dhclient-script: 31: /sbin/dhclient-script: cannot open /etc/fstab: No such file
RTNETLINK answers: File exists
/sbin/dhclient-script: 31: /sbin/dhclient-script: cannot open /etc/fstab: No such file
^C
WARNING: CTRL+C pressed!!!

How to reproduce the bug (on 16.04):
~# apt install libguestfs-tools
~# virt-builder debian-8 --root-password password:xxx --hostname testvm --format qcow2  -v

Proposed solution:
Do not use /etc/fstab for finding out the state of / in dhclient-script, but use /proc/mounts instead of it. It makes more sense as it shows real state of filesystems and it exists on supermin machines, so virt-builder runs flawlessly.

Patch:
--- /sbin/dhclient-script.orig  2016-12-12 14:48:18.062438451 +0100
+++ /sbin/dhclient-script       2016-12-12 14:53:24.897500263 +0100
@@ -28,7 +28,7 @@
 wait_for_rw() {
     local file=$1
     # Find out whether we are going to mount / rw
-    exec 9>&0 </etc/fstab
+    exec 9>&0 </proc/mounts
     rootmode=rw
     while read dev mnt type opts dump pass junk; do
         [ "$mnt" != / ] && continue

After you apply the patch delete virt-builder cache by deleting of
/var/tmp/.guestfs-* directories and run virt-builder again.


Description:    Ubuntu 16.04.1 LTS
Release:        16.04
libguestfs-tools  1:1.32.2-4ubuntu2
isc-dhcp-client   4.3.3-5ubuntu12.3

** Affects: isc-dhcp (Ubuntu)
     Importance: Undecided
         Status: New

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

Title:
  virt-builder stucks in endless loop due to /sbin/dhclient-script
  failure

Status in isc-dhcp package in Ubuntu:
  New

Bug description:
  virt-builder cannot build VM image as it uses locally installed /sbin
  /dhclient-script. dhclient-script tries to find out whether / is RW
  and reads /etc/fstab. Issue is that it does not exists in supermin
  machine which virt-builder uses and it end up in an endless loop of
  messages:

  ...
  /sbin/dhclient-script: 31: /sbin/dhclient-script: cannot open /etc/fstab: No such file
  RTNETLINK answers: File exists
  /sbin/dhclient-script: 31: /sbin/dhclient-script: cannot open /etc/fstab: No such file
  RTNETLINK answers: File exists
  /sbin/dhclient-script: 31: /sbin/dhclient-script: cannot open /etc/fstab: No such file
  RTNETLINK answers: File exists
  /sbin/dhclient-script: 31: /sbin/dhclient-script: cannot open /etc/fstab: No such file
  RTNETLINK answers: File exists
  /sbin/dhclient-script: 31: /sbin/dhclient-script: cannot open /etc/fstab: No such file
  ^C
  WARNING: CTRL+C pressed!!!

  How to reproduce the bug (on 16.04):
  ~# apt install libguestfs-tools
  ~# virt-builder debian-8 --root-password password:xxx --hostname testvm --format qcow2  -v

  Proposed solution:
  Do not use /etc/fstab for finding out the state of / in dhclient-script, but use /proc/mounts instead of it. It makes more sense as it shows real state of filesystems and it exists on supermin machines, so virt-builder runs flawlessly.

  Patch:
  --- /sbin/dhclient-script.orig  2016-12-12 14:48:18.062438451 +0100
  +++ /sbin/dhclient-script       2016-12-12 14:53:24.897500263 +0100
  @@ -28,7 +28,7 @@
   wait_for_rw() {
       local file=$1
       # Find out whether we are going to mount / rw
  -    exec 9>&0 </etc/fstab
  +    exec 9>&0 </proc/mounts
       rootmode=rw
       while read dev mnt type opts dump pass junk; do
           [ "$mnt" != / ] && continue

  After you apply the patch delete virt-builder cache by deleting of
  /var/tmp/.guestfs-* directories and run virt-builder again.

  
  Description:    Ubuntu 16.04.1 LTS
  Release:        16.04
  libguestfs-tools  1:1.32.2-4ubuntu2
  isc-dhcp-client   4.3.3-5ubuntu12.3

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/isc-dhcp/+bug/1649280/+subscriptions



More information about the foundations-bugs mailing list