[Bug 1632601] Re: initramfs fails to bring up networking with multiple interfaces, even when an interface is specified
David Masover
1632601 at bugs.launchpad.net
Wed Oct 12 08:39:11 UTC 2016
Workaround: In /etc/initramfs-tools/initramfs.conf, I simply set:
IP=eth0
DEVICE=eth0
If my analysis is correct, DEVICE is ignored and I can simply use IP. If
so, I think there are still at least two bugs here: Autodetection
doesn't work with multiple interfaces (and it's clear from the code that
it's _trying_ to support that use case), and the sample file has this
misleading comment:
#
# DEVICE: ...
#
# Specify a specific network interface, like eth0
# Overridden by optional ip= bootarg
#
This makes it sound like DEVICE is used if ip= isn't set, but that's not
true -- if ip= isn't set, and IP isn't set, DEVICE is overridden anyway.
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to initramfs-tools in Ubuntu.
https://bugs.launchpad.net/bugs/1632601
Title:
initramfs fails to bring up networking with multiple interfaces, even
when an interface is specified
Status in initramfs-tools package in Ubuntu:
New
Bug description:
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.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/1632601/+subscriptions
More information about the foundations-bugs
mailing list