[Libguestfs] [PATCH] appliance: touch /etc/fstab when enabling the network (RHBZ#1224795)

Pino Toscano ptoscano at redhat.com
Thu Jul 14 13:13:16 UTC 2016


Sadly, the dhclient-script shipped as part of isc-dhcp-client in Ubuntu
unconditionally reads from /etc/fstab without checking for its
existence.  Since no package holds /etc/fstab, this file will not exist
in the appliance, cause dhclient to fail (actually keep looping calling
the failing dhclient-script) when the network is requested.

As a workaround, touch /etc/fstab just before enabling the network: if
that file exists nothing changes, while an empty file will be available
in the other case, making at least dhclient-script in Ubuntu working.
---
 appliance/init | 1 +
 1 file changed, 1 insertion(+)

diff --git a/appliance/init b/appliance/init
index 3fdf4d0..3816dfd 100755
--- a/appliance/init
+++ b/appliance/init
@@ -118,6 +118,7 @@ ip link set dev lo up
 
 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.
     if dhclient --version >/dev/null 2>&1; then
         dhclient $iface
     else
-- 
2.7.4




More information about the Libguestfs mailing list