[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]