virt-builder stucks in endless loop due to /sbin/dhclient-script failure
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
isc-dhcp (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
virt-builder cannot build VM image as it uses locally installed /sbin/dhclient-
...
/sbin/dhclient-
RTNETLINK answers: File exists
/sbin/dhclient-
RTNETLINK answers: File exists
/sbin/dhclient-
RTNETLINK answers: File exists
/sbin/dhclient-
RTNETLINK answers: File exists
/sbin/dhclient-
^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-
+++ /sbin/dhclient-
@@ -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