grml-debootstrap
grml-debootstrap copied to clipboard
Host’s `/etc/network/interfaces` installed into VM image
Using --vm or --vmfile implies --nointerfaces, but in my test, the host /etc/network/interfaces was installed into the virtual machine image. I am going to debug this, but wanted to document the issue.
When installing a VM, then the "$DEFAULT_INTERFACES" is supposed to be set up, defined as:
DEFAULT_INTERFACES="# /etc/network/interfaces - generated by grml-debootstrap
# Include files from /etc/network/interfaces.d when using
# ifupdown v0.7.44 or newer:
#source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp
"
$ sudo kpartx -av test.iso
$ sudo mount /dev/mapper/loop0p1 /mnt
$ more /mnt/etc/network/interfaces
# /etc/network/interfaces - generated by grml-debootstrap
# Include files from /etc/network/interfaces.d when using
# ifupdown v0.7.44 or newer:
#source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp
allow-hotplug enp3s0
iface enp3s0 inet dhcp
With set -x:
+ cp /home/joey/src/grml-debootstrap-config-vm/locale.gen /mnt/debootstrap.13526/etc/locale.gen
cp: cannot stat '/home/joey/src/grml-debootstrap-config-vm/locale.gen': No such file or directory
+ '[' -d /home/joey/src/grml-debootstrap-config-vm/bin ']'
+ '[' -d /home/joey/src/grml-debootstrap-config-vm/boot ']'
+ '[' -d /home/joey/src/grml-debootstrap-config-vm/etc ']'
+ '[' -d /home/joey/src/grml-debootstrap-config-vm/sbin ']'
+ '[' -d /home/joey/src/grml-debootstrap-config-vm/share ']'
+ '[' -d /home/joey/src/grml-debootstrap-config-vm/usr ']'
+ '[' -d /home/joey/src/grml-debootstrap-config-vm/var ']'
+ DEFAULT_INTERFACES='# /etc/network/interfaces - generated by grml-debootstrap
# Include files from /etc/network/interfaces.d when using
# ifupdown v0.7.44 or newer:
#source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp
'
+ '[' -x /bin/udevadm ']'
++ mktemp
+ tmpfile=/tmp/tmp.7KWfEvO84q
+ for interface in /sys/class/net/*
+ udevadm info --query=all --path=/sys/class/net/dummy0
+ grep -q 'P: /devices/virtual/net/' /tmp/tmp.7KWfEvO84q
+ continue
+ for interface in /sys/class/net/*
+ udevadm info --query=all --path=/sys/class/net/lo
+ grep -q 'P: /devices/virtual/net/' /tmp/tmp.7KWfEvO84q
+ continue
+ for interface in /sys/class/net/*
+ udevadm info --query=all --path=/sys/class/net/net00
+ grep -q 'P: /devices/virtual/net/' /tmp/tmp.7KWfEvO84q
+ for property in ID_NET_NAME_FROM_DATABASE ID_NET_NAME_ONBOARD ID_NET_NAME_SLOT ID_NET_NAME_PATH ID_NET_NAME_MAC
+ grep -q ID_NET_NAME_FROM_DATABASE /tmp/tmp.7KWfEvO84q
+ for property in ID_NET_NAME_FROM_DATABASE ID_NET_NAME_ONBOARD ID_NET_NAME_SLOT ID_NET_NAME_PATH ID_NET_NAME_MAC
+ grep -q ID_NET_NAME_ONBOARD /tmp/tmp.7KWfEvO84q
+ for property in ID_NET_NAME_FROM_DATABASE ID_NET_NAME_ONBOARD ID_NET_NAME_SLOT ID_NET_NAME_PATH ID_NET_NAME_MAC
+ grep -q ID_NET_NAME_SLOT /tmp/tmp.7KWfEvO84q
+ for property in ID_NET_NAME_FROM_DATABASE ID_NET_NAME_ONBOARD ID_NET_NAME_SLOT ID_NET_NAME_PATH ID_NET_NAME_MAC
+ grep -q ID_NET_NAME_PATH /tmp/tmp.7KWfEvO84q
++ grep ID_NET_NAME_PATH /tmp/tmp.7KWfEvO84q
++ sed -n -e 's/E: ID_NET_NAME_PATH=\([^$*]\)/\1/p'
+ interface=enp3s0
+ DEFAULT_INTERFACES='# /etc/network/interfaces - generated by grml-debootstrap
# Include files from /etc/network/interfaces.d when using
# ifupdown v0.7.44 or newer:
#source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp
allow-hotplug enp3s0
iface enp3s0 inet dhcp
'
+ break
+ rm -f /tmp/tmp.7KWfEvO84q
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n 1 ']'
+ einfo 'Setting up Virtual Machine, installing default /etc/network/interfaces'
+ einfon 'Setting up Virtual Machine, installing default /etc/network/interfaces\n'
+ '[' '' '!=' yes ']'
+ '[' einfon = ebegin ']'
+ printf ' %s*%s Setting up Virtual Machine, installing default /etc/network/interfaces\n' '' ''
* Setting up Virtual Machine, installing default /etc/network/interfaces
+ LAST_E_CMD=einfon
+ return 0
+ return 0
+ mkdir -p /mnt/debootstrap.13526/etc/network
+ echo '# /etc/network/interfaces - generated by grml-debootstrap
# Include files from /etc/network/interfaces.d when using
# ifupdown v0.7.44 or newer:
#source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp
allow-hotplug enp3s0
iface enp3s0 inet dhcp
'
+ eend 0
+ local retval=0
+ shift
+ '[' 0 -gt 0 ']'
+ return 0
+ '[' -r /etc/network/interfaces.examples ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -d /run/udev ']'
+ einfo 'Setting up bind-mount /run/udev'
Looking at
https://github.com/grml/grml-debootstrap/blob/59e75958079096421a679c83e2526c973038ba83/grml-debootstrap#L1777-L1809
the code adding DHCP settings for predictable network interface names, extends the variable with all these interfaces unconditionally.
Thanks for debugging, so it's not about host's /etc/network/interfaces, but about the extended default configuration, I see.
I'm afraid there's no easy solution to this, and we're considering switching to systemd-networkd anyway (see e.g. #136 + #110) , which should also solve this problem.
Thanks for debugging, so it's not about host's
/etc/network/interfaces, but about the extended default configuration, I see.
Yes, sorry for not being clear about that. Is there any use case by having “build host” network device information in the VM?
I'm afraid there's no easy solution to this,
I am going to work around it using --nointerfaces.
and we're considering switching to systemd-networkd anyway (see e.g. #136 + #110) , which should also solve this problem.
I am looking forward to this.