Pino Toscano
2016-Jul-14 13:13 UTC
[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
Richard W.M. Jones
2016-Jul-14 13:25 UTC
Re: [Libguestfs] [PATCH] appliance: touch /etc/fstab when enabling the network (RHBZ#1224795)
On Thu, Jul 14, 2016 at 03:13:16PM +0200, Pino Toscano wrote:> 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 > elseACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
Possibly Parallel Threads
- [PATCH] appliance: Remove /etc/dhcp/dhclient-enter-hooks.d/resolved.
- [PATCH v2] appliance init: find NIC name for dhcpcd
- Re: [PATCH v2 1/4] appliance: Use dhclient instead of hard-coding IP address of appliance.
- Re: [PATCH] appliance: Remove /etc/dhcp/dhclient-enter-hooks.d/resolved.
- [PATCH v2 0/4] launch: libvirt: Use qemu-bridge-helper to implement a full network (RHBZ#1148012).