Public bug reported:

Discovered in Ubuntu 16.04.1 LTS
in initramfs-tools version 0.122ubuntu8.3

I expect that, when I set "DEVICE=eth0" in /etc/initramfs-
tools/initramfs.conf, my system will bring up DHCP on eth0, and ignore
any other interfaces on the system (nothing is plugged into eth1), so
that it can bring up dropbear and wait for me to SSH in and unlock my
root filesystem. This would also affect anything attempting to netboot
with this version of initramfs-tools.

Instead, it ignores my DEVICE line, and instead tries and fails to bring
up DHCP on a fictional interface called "eth0 eth1". This is caused by
_multiple_ bugs in /usr/share/initramfs-tools/scripts/functions.

I'd be sending a patch, but I'm not sure where to send it.


Here's a detailed breakdown:

If the 'ip' bootarg and $IP variable is undefined, then:
* It matches the case on line 285 of 'functions': ""|::::*|on|any|dhcp)
* It then matches the 'if' condition on line 288:  if ! echo "${IP}" | grep -qc 
'BOOTIF'; then
* So we execute: DEVICE="${IP#*:*:*:*:*:*}";

It's not at all obvious why that if statement is even there, since if
$IP was BOOTIF, it wouldn't match the given case branch. Continuing:

* Since $IP was empty, $DEVICE is now empty
* Since $DEVICE is empty, on line 295: DEVICE=$(all_netbootable_devices)

$DEVICE is now "eth0 eth1", which might be fine, except:

* On line 299: for dev in "${DEVICE}"; do

This loop would do the right thing -- it would loop through each
interface and try it in turn, and stop once one of them was configured
successfully -- except that, thanks to that quoting, that 'dev' variable
is not set progressively to 'eth0' and then 'eth1'. It is set once, to
the string "eth0 eth1".

That is clearly not what the rest of the script expects. This is
supposed to be the loop where it iterates over 'eth0' and then 'eth1' to
decide which of them to set DEVICE to, so the rest of this script can
understand the DEVICE variable. But instead, it tries to do silly things
like invoke dhclient on a fictional interface called "eth0 eth1",
instead of invoking dhclient once on each interface.

I don't know how to fix the bug where DEVICE is overridden even if the
ip bootarg is absent. Maybe that's the intended behavior? But to at
least fix autodetection, someone could just remove the quotes on $DEVICE
on line 299.

** Affects: initramfs-tools (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1632601

Title:
  initramfs fails to bring up networking with multiple interfaces, even
  when an interface is specified

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/1632601/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to