Debian Bug report logs - #615600
Please allow selecting interface by its MAC address

version graph

Package: netcfg; Maintainer for netcfg is Debian Install System Team <debian-boot@lists.debian.org>;

Reported by: Thomas Mieslinger <thomas.mieslinger@1und1.de>

Date: Sun, 27 Feb 2011 17:24:02 UTC

Severity: normal

Fixed in version netcfg/1.63

Done: Colin Watson <cjwatson@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#615600; Package debian-installer. (Sun, 27 Feb 2011 17:24:05 GMT) (full text, mbox, link).


Acknowledgement sent to Thomas Mieslinger <thomas.mieslinger@1und1.de>:
New Bug report received and forwarded. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Sun, 27 Feb 2011 17:24:05 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Thomas Mieslinger <thomas.mieslinger@1und1.de>
To: submit@bugs.debian.org
Subject: BOOTIF= kernel commandline option does not work
Date: Sun, 27 Feb 2011 18:20:48 +0100
Package: debian-installer
Version: 20110106+b1

Hi,

I try to install a HP DL180G6 fully automated. The Server has an 
addtional dualport NIC. kernel and initrd are loaded over the NIC 
labeled 0 on the Box, after the kernel has initialized all NICs the 
first Ethernet on the add in card is eth0.

~ # cat /proc/cmdline
initrd=/boot/DEBIAN6_x8664/initrd.gz 
preseed/url=http://4.3.2.1/installation/profiles/1cc1deebab9e 
BOOTIF=01-1C-C1-DE-EB-AB-9E BOOT_DEBUG=2 DEBCONF_DEBUG=5 fb=false 
language=en console-setup/layoutcode=de locale=en_US 
netcfg/choose_interface=eth0 hostname=review-dl180g6 domain=server.lan 
usb_storage.blacklist=yes console-keymaps-at/keymap=de 
console-keymaps-usb/keymap=mac-usb-de-latin1 debian-installer/country=US 
console=ttyS0 BOOT_IMAGE=/boot/DEBIAN6_x8664/linux

Booting the commandline on this machine results in this
~ # ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN qlen 
1000
    link/ether 00:15:17:cc:d0:16 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN qlen 1000
    link/ether 1c:c1:de:eb:ab:9e brd ff:ff:ff:ff:ff:ff
4: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN qlen 
1000
    link/ether 00:15:17:cc:d0:17 brd ff:ff:ff:ff:ff:ff
5: eth3: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN qlen 1000
    link/ether 1c:c1:de:eb:ab:9f brd ff:ff:ff:ff:ff:ff

this is seriously twisted, because 1c:c1:de:eb:ab:9e and f are onboard 
igb devices and 00:15:17:cc:d0:16 and 7 are on one dualport e1000e add 
in Card.

Please fix this.

Thanks Thomas




Bug reassigned from package 'debian-installer' to 'netcfg'. Request was from Joey Hess <joeyh@debian.org> to control@bugs.debian.org. (Sun, 27 Feb 2011 20:21:08 GMT) (full text, mbox, link).


Bug No longer marked as found in versions debian-installer/20110106. Request was from Joey Hess <joeyh@debian.org> to control@bugs.debian.org. (Sun, 27 Feb 2011 20:21:08 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#615600; Package netcfg. (Sun, 27 Feb 2011 20:24:05 GMT) (full text, mbox, link).


Acknowledgement sent to Joey Hess <joeyh@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Sun, 27 Feb 2011 20:24:05 GMT) (full text, mbox, link).


Message #14 received at 615600@bugs.debian.org (full text, mbox, reply):

From: Joey Hess <joeyh@debian.org>
To: Thomas Mieslinger <thomas.mieslinger@1und1.de>, 615600@bugs.debian.org
Subject: Re: Bug#615600: BOOTIF= kernel commandline option does not work
Date: Sun, 27 Feb 2011 16:22:28 -0400
[Message part 1 (text/plain, inline)]
Thomas Mieslinger wrote:
> I try to install a HP DL180G6 fully automated. The Server has an
> addtional dualport NIC. kernel and initrd are loaded over the NIC
> labeled 0 on the Box, after the kernel has initialized all NICs the
> first Ethernet on the add in card is eth0.
> 
> ~ # cat /proc/cmdline
> initrd=/boot/DEBIAN6_x8664/initrd.gz
> preseed/url=http://4.3.2.1/installation/profiles/1cc1deebab9e
> BOOTIF=01-1C-C1-DE-EB-AB-9E BOOT_DEBUG=2 DEBCONF_DEBUG=5 fb=false

BOOTIF is a pxelinux boot parameter. It is supported by the Debian
initramfs when pxe booting, but it is not supported by the Debian
installer.

Perhaps it should be. In the meantime, you can use the documented
preseeding interface of booting with interface=eth1. I don't think
netcfg allows specifying a interface by MAC though.

-- 
see shy jo
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#615600; Package netcfg. (Sun, 27 Feb 2011 21:15:07 GMT) (full text, mbox, link).


Acknowledgement sent to Thomas Mieslinger <thomas.mieslinger@1und1.de>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Sun, 27 Feb 2011 21:15:07 GMT) (full text, mbox, link).


Message #19 received at 615600@bugs.debian.org (full text, mbox, reply):

From: Thomas Mieslinger <thomas.mieslinger@1und1.de>
To: Joey Hess <joeyh@debian.org>
Cc: "615600@bugs.debian.org" <615600@bugs.debian.org>, 504753@bugs.debian.org
Subject: Re: Bug#615600: BOOTIF= kernel commandline option does not work
Date: Sun, 27 Feb 2011 22:12:27 +0100
Am 27.02.2011 21:22, schrieb Joey Hess:
> Thomas Mieslinger wrote:
>> BOOTIF=01-1C-C1-DE-EB-AB-9E BOOT_DEBUG=2 DEBCONF_DEBUG=5 fb=false
>
> BOOTIF is a pxelinux boot parameter. It is supported by the Debian
> initramfs when pxe booting, but it is not supported by the Debian
> installer.

Understood. While googling, I found 
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=504753. This does a 
half hearted job by setting automatically netcfg/choose_interface.

> Perhaps it should be. In the meantime, you can use the documented
> preseeding interface of booting with interface=eth1. I don't think
> netcfg allows specifying a interface by MAC though.

In my reality there are lots of boxes (>5k) with lots of different 
configurations of onboard and addin cards.

To get my job done all those 5000 Machines must comply to some very very 
basic guidelines. After the installation, the inner interface is always 
eth0 if there is a public interface, it is eth1. If there are crosslinks 
they are eth1 and onward.

I need a simple and powerful mechanism to enforce this against the 
quirks of udev and bioses.

reagards Thomas




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#615600; Package netcfg. (Mon, 28 Feb 2011 08:09:03 GMT) (full text, mbox, link).


Acknowledgement sent to Christian PERRIER <bubulle@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Mon, 28 Feb 2011 08:09:03 GMT) (full text, mbox, link).


Message #24 received at 615600@bugs.debian.org (full text, mbox, reply):

From: Christian PERRIER <bubulle@debian.org>
To: Thomas Mieslinger <thomas.mieslinger@1und1.de>, 615600@bugs.debian.org
Subject: Re: Bug#504753: Bug#615600: BOOTIF= kernel commandline option does not work
Date: Mon, 28 Feb 2011 06:39:48 +0100
[Message part 1 (text/plain, inline)]
reassign 615600 netcfg
retitle 615600 Please allow selecting interface by its MAC address
thanks

Quoting Thomas Mieslinger (thomas.mieslinger@1und1.de):

> To get my job done all those 5000 Machines must comply to some very
> very basic guidelines. After the installation, the inner interface
> is always eth0 if there is a public interface, it is eth1. If there
> are crosslinks they are eth1 and onward.
> 
> I need a simple and powerful mechanism to enforce this against the
> quirks of udev and bioses.


You may want to develop the needed support for such things in
netcfg.

From what I read of Joey's answer, a solution could be allowing to
specify the wanted interface by its MAC address, in netcfg, through a
specific boot parameter...or s specific handling of the existing
"interface" parameter.




[signature.asc (application/pgp-signature, inline)]

Changed Bug title to 'Please allow selecting interface by its MAC address' from 'BOOTIF= kernel commandline option does not work' Request was from Christian PERRIER <bubulle@debian.org> to control@bugs.debian.org. (Mon, 28 Feb 2011 08:09:05 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#615600; Package netcfg. (Mon, 28 Feb 2011 09:12:03 GMT) (full text, mbox, link).


Acknowledgement sent to Marc Haber <mh+debian-bugs@zugschlus.de>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Mon, 28 Feb 2011 09:12:03 GMT) (full text, mbox, link).


Message #31 received at 615600@bugs.debian.org (full text, mbox, reply):

From: Marc Haber <mh+debian-bugs@zugschlus.de>
To: Thomas Mieslinger <thomas.mieslinger@1und1.de>, 615600@bugs.debian.org, 615600-submitter@bugs.debian.org
Cc: Marc Haber <mh+debian-bugs@zugschlus.de>
Subject: Re: Bug#615600: BOOTIF= kernel commandline option does not work
Date: Mon, 28 Feb 2011 10:08:11 +0100
On Sun, Feb 27, 2011 at 06:20:48PM +0100, Thomas Mieslinger wrote:
> I try to install a HP DL180G6 fully automated. The Server has an
> addtional dualport NIC. kernel and initrd are loaded over the NIC
> labeled 0 on the Box, after the kernel has initialized all NICs the
> first Ethernet on the add in card is eth0.
> 
> ~ # cat /proc/cmdline
> initrd=/boot/DEBIAN6_x8664/initrd.gz
> preseed/url=http://4.3.2.1/installation/profiles/1cc1deebab9e
> BOOTIF=01-1C-C1-DE-EB-AB-9E BOOT_DEBUG=2 DEBCONF_DEBUG=5 fb=false
> language=en console-setup/layoutcode=de locale=en_US
> netcfg/choose_interface=eth0 hostname=review-dl180g6
> domain=server.lan usb_storage.blacklist=yes
> console-keymaps-at/keymap=de
> console-keymaps-usb/keymap=mac-usb-de-latin1
> debian-installer/country=US console=ttyS0
> BOOT_IMAGE=/boot/DEBIAN6_x8664/linux
> 
> 3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN qlen 1000
>     link/ether 1c:c1:de:eb:ab:9e brd ff:ff:ff:ff:ff:ff
> 
> this is seriously twisted, because 1c:c1:de:eb:ab:9e and f are
> onboard igb devices and 00:15:17:cc:d0:16 and 7 are on one dualport
> e1000e add in Card.

So you would basically want the installer to rename the interfaces so
that the interface that the system booted from (as given as BOOTIF
kernel command line parameter) is eth0 in the freshly installed
system?

Maybe it would be a good idea not to have this enabled by default, but
for example by a new command line parameter eth0=<macaddress> with the
special case of eth0=bootif which would make sure that eth0 is the PXE
device?

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#615600; Package netcfg. (Mon, 28 Feb 2011 09:12:04 GMT) (full text, mbox, link).


Acknowledgement sent to Marc Haber <mh+debian-bugs@zugschlus.de>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Mon, 28 Feb 2011 09:12:04 GMT) (full text, mbox, link).


Message #36 received at 615600@bugs.debian.org (full text, mbox, reply):

From: Marc Haber <mh+debian-bugs@zugschlus.de>
To: Christian PERRIER <bubulle@debian.org>, 615600@bugs.debian.org, 615600-submitter@bugs.debian.org
Cc: Thomas Mieslinger <thomas.mieslinger@1und1.de>, Marc Haber <mh+debian-bugs@zugschlus.de>
Subject: Re: Bug#615600: Bug#504753: Bug#615600: BOOTIF= kernel commandline option does not work
Date: Mon, 28 Feb 2011 10:09:44 +0100
On Mon, Feb 28, 2011 at 06:39:48AM +0100, Christian PERRIER wrote:
> Quoting Thomas Mieslinger (thomas.mieslinger@1und1.de):
> > To get my job done all those 5000 Machines must comply to some very
> > very basic guidelines. After the installation, the inner interface
> > is always eth0 if there is a public interface, it is eth1. If there
> > are crosslinks they are eth1 and onward.
> > 
> > I need a simple and powerful mechanism to enforce this against the
> > quirks of udev and bioses.
> 
> 
> You may want to develop the needed support for such things in
> netcfg.

Are there any docs for netcfg? After a cursory glance at the source
package, it looks like the docs are contained in those nice .c and .h
files with a little too little documentation about the interfaces.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835




Message sent on to Thomas Mieslinger <thomas.mieslinger@1und1.de>:
Bug#615600. (Mon, 28 Feb 2011 09:12:09 GMT) (full text, mbox, link).


Message sent on to Thomas Mieslinger <thomas.mieslinger@1und1.de>:
Bug#615600. (Mon, 28 Feb 2011 09:12:10 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#615600; Package netcfg. (Mon, 28 Feb 2011 16:09:06 GMT) (full text, mbox, link).


Acknowledgement sent to Ferenc Wagner <wferi@niif.hu>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Mon, 28 Feb 2011 16:09:06 GMT) (full text, mbox, link).


Message #47 received at 615600@bugs.debian.org (full text, mbox, reply):

From: Ferenc Wagner <wferi@niif.hu>
To: Marc Haber <mh+debian-bugs@zugschlus.de>
Cc: 615600@bugs.debian.org, Christian PERRIER <bubulle@debian.org>, 615600-submitter@bugs.debian.org, Thomas Mieslinger <thomas.mieslinger@1und1.de>
Subject: Re: Bug#615600: Bug#504753: Bug#615600: BOOTIF= kernel commandline option does not work
Date: Mon, 28 Feb 2011 17:08:07 +0100
Marc Haber <mh+debian-bugs@zugschlus.de> writes:

> On Mon, Feb 28, 2011 at 06:39:48AM +0100, Christian PERRIER wrote:
>
>> Quoting Thomas Mieslinger (thomas.mieslinger@1und1.de):
>>
>>> To get my job done all those 5000 Machines must comply to some very
>>> very basic guidelines. After the installation, the inner interface
>>> is always eth0 if there is a public interface, it is eth1. If there
>>> are crosslinks they are eth1 and onward.
>>> 
>>> I need a simple and powerful mechanism to enforce this against the
>>> quirks of udev and bioses.
>> 
>> You may want to develop the needed support for such things in
>> netcfg.
>
> Are there any docs for netcfg? After a cursory glance at the source
> package, it looks like the docs are contained in those nice .c and .h
> files with a little too little documentation about the interfaces.

There's no docs for netcfg, AFAIK, but it isn't that complicated.
However, Matt Palmer is currently reorganizing the code, so you'd better
synchronize with him before you start fiddling with it.

On the other hand, the issue at hand probably doesn't belong into
netcfg.  Naming network interfaces is a job for udev, and netcfg can
simply use eth0 after that, if I read Thomas correctly.

I routinely do this by putting /etc/udev/rules.d/60-manual-net.rules
into the installer initramfs AND copying it into /target at the end of
the installation.  One could make this fully dynamic if needed, even
without remastering the initramfs, by elaborate preseed/early_command
specifications.
-- 
Regards,
Feri.




Message sent on to Thomas Mieslinger <thomas.mieslinger@1und1.de>:
Bug#615600. (Mon, 28 Feb 2011 16:09:10 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#615600; Package netcfg. (Tue, 01 Mar 2011 15:30:06 GMT) (full text, mbox, link).


Acknowledgement sent to Marc Haber <mh+debian-bugs@zugschlus.de>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Tue, 01 Mar 2011 15:30:06 GMT) (full text, mbox, link).


Message #55 received at 615600@bugs.debian.org (full text, mbox, reply):

From: Marc Haber <mh+debian-bugs@zugschlus.de>
To: Joey Hess <joeyh@debian.org>, 615600@bugs.debian.org, 615600-submitter@bugs.debian.org
Cc: Thomas Mieslinger <thomas.mieslinger@1und1.de>, Marc Haber <mh+debian-bugs@zugschlus.de>
Subject: Re: Bug#615600: BOOTIF= kernel commandline option does not work
Date: Tue, 1 Mar 2011 16:28:16 +0100
On Sun, Feb 27, 2011 at 04:22:28PM -0400, Joey Hess wrote:
> Thomas Mieslinger wrote:
> > I try to install a HP DL180G6 fully automated. The Server has an
> > addtional dualport NIC. kernel and initrd are loaded over the NIC
> > labeled 0 on the Box, after the kernel has initialized all NICs the
> > first Ethernet on the add in card is eth0.
> > 
> > ~ # cat /proc/cmdline
> > initrd=/boot/DEBIAN6_x8664/initrd.gz
> > preseed/url=http://4.3.2.1/installation/profiles/1cc1deebab9e
> > BOOTIF=01-1C-C1-DE-EB-AB-9E BOOT_DEBUG=2 DEBCONF_DEBUG=5 fb=false
> 
> BOOTIF is a pxelinux boot parameter. It is supported by the Debian
> initramfs when pxe booting, but it is not supported by the Debian
> installer.
> 
> Perhaps it should be. In the meantime, you can use the documented
> preseeding interface of booting with interface=eth1. I don't think
> netcfg allows specifying a interface by MAC though.

I guess the following changes do kind of a job:
etc/udev/rules.d/69-bootif.rules (inside the installer's initrd)
ACTION=="add", SUBSYSTEM=="net", IMPORT{program}="bootif $attr{address}"

lib/udev/bootif (inside the installer's initrd)
#!/bin/sh

bootif="$(< /proc/cmdline sed 's/.*[[:space:]]BOOTIF=\([-0-9A-Fa-f]\+\).*/\1/' | tr '[A-F-]' '[a-f:]')"

if [ "01:$1" = "$bootif" ]; then
  echo INTERFACE_NAME=eth0
fi

Unfortunately, this seems to go a little too far. My test system comes
up with the second interface being the bootif, so it's eth1 without
these additions. With my additions, the following numbering happens:

MAC Address    without additions    with additions
     A            eth0                 eth4
     B            eth1                 eth0
     C            eth2                 eth3
     D            eth3                 eth5

The /etc/udev/rules.d/70-persistent-net.rules that is being generated
has the first interface found twice:

ATTR{address}   NAME with additions
     C            eth2
     C            eth3
     B            eth0
     A	          eth4
     D            eth5

I guess there may be a race going on. Is there any possibility to have
bootif honored without generating a broken 70-persistent-net.rules and
with still having the interfaces numbered consecutively?

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835




Message sent on to Thomas Mieslinger <thomas.mieslinger@1und1.de>:
Bug#615600. (Tue, 01 Mar 2011 15:30:15 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#615600; Package netcfg. (Tue, 01 Mar 2011 15:54:11 GMT) (full text, mbox, link).


Acknowledgement sent to Marc Haber <mh+debian-bugs@zugschlus.de>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Tue, 01 Mar 2011 15:54:11 GMT) (full text, mbox, link).


Message #63 received at 615600@bugs.debian.org (full text, mbox, reply):

From: Marc Haber <mh+debian-bugs@zugschlus.de>
To: 615600@bugs.debian.org, 615600-submitter@bugs.debian.org
Cc: Joey Hess <joeyh@debian.org>, Thomas Mieslinger <thomas.mieslinger@1und1.de>, Marc Haber <mh+debian-bugs@zugschlus.de>
Subject: Re: Bug#615600: BOOTIF= kernel commandline option does not work
Date: Tue, 1 Mar 2011 16:52:00 +0100
On Tue, Mar 01, 2011 at 04:28:16PM +0100, Marc Haber wrote:
> I guess the following changes do kind of a job:
> etc/udev/rules.d/69-bootif.rules (inside the installer's initrd)
> ACTION=="add", SUBSYSTEM=="net", IMPORT{program}="bootif $attr{address}"
> 
> Unfortunately, this seems to go a little too far. My test system comes
> up with the second interface being the bootif, so it's eth1 without
> these additions.

This seems to be the fault of the additional rule which gives the
impression that the rule is actually doing something. Even when I
replace the bootif script with a call to true, I get multiple stanzas
per interface in 70-persistent-net.rules.

Do I need to say in the 69-bootif.rules that this should be treated as
a no-op rule?

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835




Message sent on to Thomas Mieslinger <thomas.mieslinger@1und1.de>:
Bug#615600. (Tue, 01 Mar 2011 15:54:15 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#615600; Package netcfg. (Tue, 01 Mar 2011 16:03:07 GMT) (full text, mbox, link).


Acknowledgement sent to Floris Bos <bos@je-eigen-domein.nl>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Tue, 01 Mar 2011 16:03:07 GMT) (full text, mbox, link).


Message #71 received at 615600@bugs.debian.org (full text, mbox, reply):

From: Floris Bos <bos@je-eigen-domein.nl>
To: 615600@bugs.debian.org
Subject: Re: Bug#615600: BOOTIF= kernel commandline option does not work
Date: Tue, 1 Mar 2011 16:38:19 +0100
Hi,

On Tuesday, March 01, 2011 04:28:16 pm Marc Haber wrote:
> On Sun, Feb 27, 2011 at 04:22:28PM -0400, Joey Hess wrote:
> > Thomas Mieslinger wrote:
> > > I try to install a HP DL180G6 fully automated. The Server has an
> > > addtional dualport NIC. kernel and initrd are loaded over the NIC
> > > labeled 0 on the Box, after the kernel has initialized all NICs the
> > > first Ethernet on the add in card is eth0.
> > > 
> > > ~ # cat /proc/cmdline
> > > initrd=/boot/DEBIAN6_x8664/initrd.gz
> > > preseed/url=http://4.3.2.1/installation/profiles/1cc1deebab9e
> > > BOOTIF=01-1C-C1-DE-EB-AB-9E BOOT_DEBUG=2 DEBCONF_DEBUG=5 fb=false
> > 
> > BOOTIF is a pxelinux boot parameter. It is supported by the Debian
> > initramfs when pxe booting, but it is not supported by the Debian
> > installer.
> > 
> > Perhaps it should be. In the meantime, you can use the documented
> > preseeding interface of booting with interface=eth1. I don't think
> > netcfg allows specifying a interface by MAC though.
> 
> I guess the following changes do kind of a job:
> etc/udev/rules.d/69-bootif.rules (inside the installer's initrd)
> ACTION=="add", SUBSYSTEM=="net", IMPORT{program}="bootif $attr{address}"

The related Ubuntu bug has a patch as well: https://bugs.launchpad.net/ubuntu/+source/netcfg/+bug/56679

(Matt already mentioned he doesn't like that patch, so it's not a permantent solution.
But if you are just looking for a quick fix for now, you can use it in your own build).


-- 
Yours sincerely,

Floris Bos




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#615600; Package netcfg. (Wed, 02 Mar 2011 00:45:07 GMT) (full text, mbox, link).


Acknowledgement sent to Ferenc Wagner <wferi@niif.hu>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Wed, 02 Mar 2011 00:45:07 GMT) (full text, mbox, link).


Message #76 received at 615600@bugs.debian.org (full text, mbox, reply):

From: Ferenc Wagner <wferi@niif.hu>
To: Marc Haber <mh+debian-bugs@zugschlus.de>
Cc: 615600@bugs.debian.org, 615600-submitter@bugs.debian.org, Joey Hess <joeyh@debian.org>, Thomas Mieslinger <thomas.mieslinger@1und1.de>
Subject: Re: Bug#615600: BOOTIF= kernel commandline option does not work
Date: Wed, 02 Mar 2011 01:41:58 +0100
Marc Haber <mh+debian-bugs@zugschlus.de> writes:

> On Tue, Mar 01, 2011 at 04:28:16PM +0100, Marc Haber wrote:
>> I guess the following changes do kind of a job:
>> etc/udev/rules.d/69-bootif.rules (inside the installer's initrd)
>> ACTION=="add", SUBSYSTEM=="net", IMPORT{program}="bootif $attr{address}"
>> 
>> Unfortunately, this seems to go a little too far. My test system comes
>> up with the second interface being the bootif, so it's eth1 without
>> these additions.
>
> This seems to be the fault of the additional rule which gives the
> impression that the rule is actually doing something. Even when I
> replace the bootif script with a call to true, I get multiple stanzas
> per interface in 70-persistent-net.rules.

In my limited testing (with two Qemu interfaces) this didn't happen
after several

# rm 70-persistent-net.rules
# udevadm trigger --verbose --action=add --subsystem-match=net

cycles.  Actually, your rule worked perfectly well, despite that you
don't reserve the eth0 name, just try to assign it even if it's taken
already.  Unless I overlook something, this should be fixed.

I usually assign symbolic names instead of ethX ones, like wlan, utp,
private, gb1 (chassis label) or similar; they usually work just fine,
but sometimes break assumptions of some software (like Munin plugins).
Maybe keeping the domain and the range of the mapping would help
debugging this case as well.

> Do I need to say in the 69-bootif.rules that this should be treated as
> a no-op rule?

I don't think so.  But /lib/udev/write_net_rules activates set -x if
udev logging is set to debug level, and while the output in
/var/log/syslog is less than readable, it may prove some insight.

# udevadm control --log-priority=debug
-- 
Regards,
Feri.




Message sent on to Thomas Mieslinger <thomas.mieslinger@1und1.de>:
Bug#615600. (Wed, 02 Mar 2011 00:45:08 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#615600; Package netcfg. (Wed, 02 Mar 2011 14:33:03 GMT) (full text, mbox, link).


Acknowledgement sent to Marc Haber <mh+debian-bugs@zugschlus.de>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Wed, 02 Mar 2011 14:33:03 GMT) (full text, mbox, link).


Message #84 received at 615600@bugs.debian.org (full text, mbox, reply):

From: Marc Haber <mh+debian-bugs@zugschlus.de>
To: Ferenc Wagner <wferi@niif.hu>, 615600@bugs.debian.org, 615600-submitter@bugs.debian.org
Cc: Marc Haber <mh+debian-bugs@zugschlus.de>, Joey Hess <joeyh@debian.org>, Thomas Mieslinger <thomas.mieslinger@1und1.de>
Subject: Re: Bug#615600: BOOTIF= kernel commandline option does not work
Date: Wed, 2 Mar 2011 15:28:50 +0100
On Wed, Mar 02, 2011 at 01:41:58AM +0100, Ferenc Wagner wrote:
> Marc Haber <mh+debian-bugs@zugschlus.de> writes:
> > On Tue, Mar 01, 2011 at 04:28:16PM +0100, Marc Haber wrote:
> >> I guess the following changes do kind of a job:
> >> etc/udev/rules.d/69-bootif.rules (inside the installer's initrd)
> >> ACTION=="add", SUBSYSTEM=="net", IMPORT{program}="bootif $attr{address}"
> >> 
> >> Unfortunately, this seems to go a little too far. My test system comes
> >> up with the second interface being the bootif, so it's eth1 without
> >> these additions.
> >
> > This seems to be the fault of the additional rule which gives the
> > impression that the rule is actually doing something. Even when I
> > replace the bootif script with a call to true, I get multiple stanzas
> > per interface in 70-persistent-net.rules.
> 
> In my limited testing (with two Qemu interfaces) this didn't happen
> after several
> 
> # rm 70-persistent-net.rules
> # udevadm trigger --verbose --action=add --subsystem-match=net
> 
> cycles.

Did you try with a multiprocessor VM? I guess that this is some
threading/multiprocessing issue that multiple interfaces get processed
at the same time, causing races.

>   Actually, your rule worked perfectly well, despite that you don't
>   reserve the eth0 name, just try to assign it even if it's taken
>   already.  Unless I overlook something, this should be fixed.

How do I reserve a name?

> I usually assign symbolic names instead of ethX ones, like wlan, utp,
> private, gb1 (chassis label) or similar; they usually work just fine,
> but sometimes break assumptions of some software (like Munin plugins).
> Maybe keeping the domain and the range of the mapping would help
> debugging this case as well.

I do this for my personal servers as well, but for the default
install, I'd rather follow the principle of least surprise for the
other admins that will use the servers deployed by me.

So it would really be nice to have ethx, starting at eth0 being the
right interfaces, with the other interfaces being consecutively
numbered as ethx.

> > Do I need to say in the 69-bootif.rules that this should be treated as
> > a no-op rule?
> 
> I don't think so.  But /lib/udev/write_net_rules activates set -x if
> udev logging is set to debug level, and while the output in
> /var/log/syslog is less than readable, it may prove some insight.
> 
> # udevadm control --log-priority=debug

I'll try that and report back. Thanks for helping.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835




Message sent on to Thomas Mieslinger <thomas.mieslinger@1und1.de>:
Bug#615600. (Wed, 02 Mar 2011 14:33:05 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#615600; Package netcfg. (Wed, 02 Mar 2011 15:48:08 GMT) (full text, mbox, link).


Acknowledgement sent to Ferenc Wagner <wferi@niif.hu>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Wed, 02 Mar 2011 15:48:08 GMT) (full text, mbox, link).


Message #92 received at 615600@bugs.debian.org (full text, mbox, reply):

From: Ferenc Wagner <wferi@niif.hu>
To: Marc Haber <mh+debian-bugs@zugschlus.de>
Cc: 615600@bugs.debian.org, 615600-submitter@bugs.debian.org, Joey Hess <joeyh@debian.org>, Thomas Mieslinger <thomas.mieslinger@1und1.de>
Subject: Re: Bug#615600: BOOTIF= kernel commandline option does not work
Date: Wed, 02 Mar 2011 16:44:07 +0100
Marc Haber <mh+debian-bugs@zugschlus.de> writes:

> On Wed, Mar 02, 2011 at 01:41:58AM +0100, Ferenc Wagner wrote:
>
>> Marc Haber <mh+debian-bugs@zugschlus.de> writes:
>>
>>> On Tue, Mar 01, 2011 at 04:28:16PM +0100, Marc Haber wrote:
>>>
>>>> I guess the following changes do kind of a job:
>>>> etc/udev/rules.d/69-bootif.rules (inside the installer's initrd)
>>>> ACTION=="add", SUBSYSTEM=="net", IMPORT{program}="bootif $attr{address}"
>>>> 
>>>> Unfortunately, this seems to go a little too far. My test system comes
>>>> up with the second interface being the bootif, so it's eth1 without
>>>> these additions.
>>>
>>> This seems to be the fault of the additional rule which gives the
>>> impression that the rule is actually doing something. Even when I
>>> replace the bootif script with a call to true, I get multiple stanzas
>>> per interface in 70-persistent-net.rules.
>> 
>> In my limited testing (with two Qemu interfaces) this didn't happen
>> after several
>> 
>> # rm 70-persistent-net.rules
>> # udevadm trigger --verbose --action=add --subsystem-match=net
>> 
>> cycles.
>
> Did you try with a multiprocessor VM? I guess that this is some
> threading/multiprocessing issue that multiple interfaces get processed
> at the same time, causing races.

Maybe, I didn't try it on SMP.  write_net_rules has some locking to
prevent such issues, though.

>> Actually, your rule worked perfectly well, despite that you don't
>> reserve the eth0 name, just try to assign it even if it's taken
>> already.  Unless I overlook something, this should be fixed.
>
> How do I reserve a name?

By renaming eth0 to something else, unless it isn't the boot interface.

>> But /lib/udev/write_net_rules activates set -x if udev logging is set
>> to debug level, and while the output in /var/log/syslog is less than
>> readable, it may prove some insight.
>> 
>> # udevadm control --log-priority=debug
>
> I'll try that and report back. Thanks for helping.

Hey, thanks for maintaining Exim!
-- 
Regards,
Feri.




Message sent on to Thomas Mieslinger <thomas.mieslinger@1und1.de>:
Bug#615600. (Wed, 02 Mar 2011 15:48:12 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#615600; Package netcfg. (Wed, 02 Mar 2011 17:15:04 GMT) (full text, mbox, link).


Acknowledgement sent to Marc Haber <mh+debian-bugs@zugschlus.de>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Wed, 02 Mar 2011 17:15:04 GMT) (full text, mbox, link).


Message #100 received at 615600@bugs.debian.org (full text, mbox, reply):

From: Marc Haber <mh+debian-bugs@zugschlus.de>
To: Ferenc Wagner <wferi@niif.hu>
Cc: 615600@bugs.debian.org, 615600-submitter@bugs.debian.org, Joey Hess <joeyh@debian.org>, Thomas Mieslinger <thomas.mieslinger@1und1.de>
Subject: Re: Bug#615600: BOOTIF= kernel commandline option does not work
Date: Wed, 2 Mar 2011 18:12:42 +0100
On Wed, Mar 02, 2011 at 04:44:07PM +0100, Ferenc Wagner wrote:
> Marc Haber <mh+debian-bugs@zugschlus.de> writes:
> > On Wed, Mar 02, 2011 at 01:41:58AM +0100, Ferenc Wagner wrote:
> >
> >> Marc Haber <mh+debian-bugs@zugschlus.de> writes:
> >>
> >>> On Tue, Mar 01, 2011 at 04:28:16PM +0100, Marc Haber wrote:
> >>>
> >>>> I guess the following changes do kind of a job:
> >>>> etc/udev/rules.d/69-bootif.rules (inside the installer's initrd)
> >>>> ACTION=="add", SUBSYSTEM=="net", IMPORT{program}="bootif $attr{address}"
> >>>> 
> >>>> Unfortunately, this seems to go a little too far. My test system comes
> >>>> up with the second interface being the bootif, so it's eth1 without
> >>>> these additions.
> >>>
> >>> This seems to be the fault of the additional rule which gives the
> >>> impression that the rule is actually doing something. Even when I
> >>> replace the bootif script with a call to true, I get multiple stanzas
> >>> per interface in 70-persistent-net.rules.
> >> 
> >> In my limited testing (with two Qemu interfaces) this didn't happen
> >> after several
> >> 
> >> # rm 70-persistent-net.rules
> >> # udevadm trigger --verbose --action=add --subsystem-match=net
> >> 
> >> cycles.
> >
> > Did you try with a multiprocessor VM? I guess that this is some
> > threading/multiprocessing issue that multiple interfaces get processed
> > at the same time, causing races.
> 
> Maybe, I didn't try it on SMP.  write_net_rules has some locking to
> prevent such issues, though.

My rule hasn't, but it shouldn't do anything if the script is silent,
should it?

> >> Actually, your rule worked perfectly well, despite that you don't
> >> reserve the eth0 name, just try to assign it even if it's taken
> >> already.  Unless I overlook something, this should be fixed.
> >
> > How do I reserve a name?
> 
> By renaming eth0 to something else, unless it isn't the boot interface.

So my script should print INTERFACE_NAME="foo0" to its standard output
if invoked for an interface that is eth0 and not the boot interface?
And who is responsible to rename it back into the ethx namespace?

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 3221 2323190




Message sent on to Thomas Mieslinger <thomas.mieslinger@1und1.de>:
Bug#615600. (Wed, 02 Mar 2011 17:15:06 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#615600; Package netcfg. (Wed, 02 Mar 2011 17:57:03 GMT) (full text, mbox, link).


Acknowledgement sent to Ferenc Wagner <wferi@niif.hu>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Wed, 02 Mar 2011 17:57:03 GMT) (full text, mbox, link).


Message #108 received at 615600@bugs.debian.org (full text, mbox, reply):

From: Ferenc Wagner <wferi@niif.hu>
To: Marc Haber <mh+debian-bugs@zugschlus.de>
Cc: 615600@bugs.debian.org, 615600-submitter@bugs.debian.org, Joey Hess <joeyh@debian.org>, Thomas Mieslinger <thomas.mieslinger@1und1.de>
Subject: Re: Bug#615600: BOOTIF= kernel commandline option does not work
Date: Wed, 02 Mar 2011 18:52:44 +0100
Marc Haber <mh+debian-bugs@zugschlus.de> writes:

> On Wed, Mar 02, 2011 at 04:44:07PM +0100, Ferenc Wagner wrote:
> 
>> Maybe, I didn't try it on SMP.  write_net_rules has some locking to
>> prevent such issues, though.
>
> My rule hasn't, but it shouldn't do anything if the script is silent,
> should it?

Your rule shouldn't do anything than possibly importing a property into
the event environment, and the bootif script only reads constant data,
so it shouldn't need any locking either.

>>>> Actually, your rule worked perfectly well, despite that you don't
>>>> reserve the eth0 name, just try to assign it even if it's taken
>>>> already.  Unless I overlook something, this should be fixed.
>>>
>>> How do I reserve a name?
>> 
>> By renaming eth0 to something else, unless it isn't the boot interface.
>
> So my script should print INTERFACE_NAME="foo0" to its standard output
> if invoked for an interface that is eth0 and not the boot interface?
> And who is responsible to rename it back into the ethx namespace?

Nobody, I'm afraid.  What you want isn't particularly simple, especially
that ethX devices may be appearing concurrently, so you'll have to
synchronize much like write_net_rules does.  You can't even guarantee
that there will be an eth0 at the end!  I'd probably start by modifying
write_net_rules, it already has some special code handling eth0.
-- 
Regards,
Feri.




Message sent on to Thomas Mieslinger <thomas.mieslinger@1und1.de>:
Bug#615600. (Wed, 02 Mar 2011 17:57:07 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#615600; Package netcfg. (Thu, 24 Mar 2011 01:33:02 GMT) (full text, mbox, link).


Acknowledgement sent to Dustin Kirkland <kirkland@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Thu, 24 Mar 2011 01:33:03 GMT) (full text, mbox, link).


Message #116 received at 615600@bugs.debian.org (full text, mbox, reply):

From: Dustin Kirkland <kirkland@ubuntu.com>
To: 615600@bugs.debian.org
Cc: Colin Watson <cjwatson@ubuntu.com>
Subject: Re: Bug#615600: BOOTIF= kernel commandline option does not work
Date: Wed, 23 Mar 2011 20:31:56 -0500
[Message part 1 (text/plain, inline)]
Howdy,

I just came across this report in Debian's bug tracker.

On Sun, 27 Feb 2011 16:22:28 -0400, Joey Hess wrote:
> BOOTIF is a pxelinux boot parameter. It is supported by the Debian
> initramfs when pxe booting, but it is not supported by the Debian
> installer.
>
> Perhaps it should be. In the meantime, you can use the documented
> preseeding interface of booting with interface=eth1. I don't think
> netcfg allows specifying a interface by MAC though.

Floris Bos mentioned that this is similar to an oldish bug (at least
by Ubuntu standards) in Ubuntu's bug tracker against the netcfg
package:
 provide a method to use a specified MAC-address as the installation device
 * https://bugs.launchpad.net/ubuntu/+source/netcfg/+bug/56679

We have a proposed solution, in the attached script, S31pxedust.

Adding 'ipappend 2' to the host's pxelinux config file makes PXELINUX
append the mac address of that interface to the kernel options.
 * http://syslinux.zytor.com/wiki/index.php/SYSLINUX#IPAPPEND_flag_val_.5BPXELINUX_only.5D

This allows the initrd to access to the mac address of the interface
which PXE booted and is probably the interface we want to use for
DHCP.

Executing from the debian-installer-startup.d directory of the initrd,
this script reads the value of the 'BOOTIF' kernel option and looks to
see if there is an interface name with this mac address.  If so, it
then uses 'db_set' to change the 'netcfg/choose_interface' option to
this interface name.

Would you be willing to consider this approach?  We'd absolutely like
to avoid diverging from Debian in support of a BOOTIF kernel option
for installations, and we have a great need for a supported approach.
I'm willing and able to modify and test the attached boot accordingly.

Please advise.

Thanks,
-- 
:-Dustin

Dustin Kirkland
Ubuntu Core Developer
[S31pxedust (application/octet-stream, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#615600; Package netcfg. (Thu, 16 Jun 2011 17:06:05 GMT) (full text, mbox, link).


Acknowledgement sent to Colin Watson <cjwatson@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Thu, 16 Jun 2011 17:06:05 GMT) (full text, mbox, link).


Message #121 received at 615600@bugs.debian.org (full text, mbox, reply):

From: Colin Watson <cjwatson@debian.org>
To: Dustin Kirkland <kirkland@ubuntu.com>
Cc: 615600@bugs.debian.org
Subject: Re: Bug#615600: BOOTIF= kernel commandline option does not work
Date: Thu, 16 Jun 2011 18:02:25 +0100
tags 615600 pending
thanks

On Wed, Mar 23, 2011 at 08:31:56PM -0500, Dustin Kirkland wrote:
> On Sun, 27 Feb 2011 16:22:28 -0400, Joey Hess wrote:
> > BOOTIF is a pxelinux boot parameter. It is supported by the Debian
> > initramfs when pxe booting, but it is not supported by the Debian
> > installer.
> >
> > Perhaps it should be. In the meantime, you can use the documented
> > preseeding interface of booting with interface=eth1. I don't think
> > netcfg allows specifying a interface by MAC though.
> 
> Floris Bos mentioned that this is similar to an oldish bug (at least
> by Ubuntu standards) in Ubuntu's bug tracker against the netcfg
> package:
>  provide a method to use a specified MAC-address as the installation device
>  * https://bugs.launchpad.net/ubuntu/+source/netcfg/+bug/56679
> 
> We have a proposed solution, in the attached script, S31pxedust.

Thanks for sending this along.

I think honouring BOOTIF is the right thing to do.  You can always
remove 'ipappend 2' if you don't like it, but I think the overwhelming
probability is that you want to use the same interface for installation
as you did for PXE-booting.

However, I think this implementation has two problems:

 * It's at too high a priority: it overrides any other setting of
   netcfg/choose_interface.  If you have 'ipappend 2' but also for some
   reason have (say) interface=eth1 in your boot parameters, then the
   latter is a more explicit instruction to d-i and therefore should
   win.  (Andrew noted this in
   https://bugs.launchpad.net/ubuntu/+source/netcfg/+bug/56679/comments/13.)

 * It runs too early.  Network interfaces may not necessarily be
   available when debian-installer-startup runs; this isn't too likely
   in a netboot image, granted, but it's possible if you're adding
   drivers later by way of a USB stick or something.

I think Andrew's script was expedient for him - it's a lot simpler to
drop a shell script into d-i's initramfs than it is to modify C programs
there - but a better long-term solution for us would be to do this in
netcfg itself.  I have put my money where my mouth is and implemented
this.  My patch overrides the results of link detection with the
interface that matches BOOTIF, but preseeding an interface name
overrides both of those.  This feels right to me.  I've done some
testing in a qemu instance with multiple network interfaces and it's
behaving exactly as I'd expect.

I've committed the following patch, and I plan to release netcfg 1.63
with it shortly.

commit 33aeb7186837a6d7fa4762d72455e70672501cbe
Author: Colin Watson <cjwatson@debian.org>
Date:   Thu Jun 16 18:00:44 2011 +0100

    If BOOTIF= is set on the Linux command line, look for an interface with that address and use it by default (closes: #615600, LP: #56679).

diff --git a/debian/changelog b/debian/changelog
index 61df533..1bcd302 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+netcfg (1.63) UNRELEASED; urgency=low
+
+  * If BOOTIF= is set on the Linux command line, look for an interface with
+    that address and use it by default (closes: #615600, LP: #56679).
+
+ -- Colin Watson <cjwatson@debian.org>  Thu, 16 Jun 2011 14:20:04 +0100
+
 netcfg (1.62) unstable; urgency=low
 
   [ Updated translations ]
diff --git a/netcfg-common.c b/netcfg-common.c
index 972ce86..7e5a3fa 100644
--- a/netcfg-common.c
+++ b/netcfg-common.c
@@ -46,6 +46,10 @@
 
 #include <ifaddrs.h>
 
+#ifdef __linux__
+#define SYSCLASSNET "/sys/class/net/"
+#endif /* __linux__ */
+
 #ifdef __FreeBSD_kernel__
 #define LO_IF	"lo0"
 #else
@@ -128,8 +132,6 @@ void open_sockets (void)
 
 #ifdef __linux__
 
-#define SYSCLASSNET "/sys/class/net/"
-
 /* Returns non-zero if this interface has an enabled kill switch, otherwise
  * zero.
  */
@@ -187,8 +189,6 @@ int check_kill_switch(const char *iface)
     return ret;
 }
 
-#undef SYSCLASSNET
-
 #else /* !__linux__ */
 int check_kill_switch(const char *iface)
 {
@@ -471,6 +471,102 @@ FILE *file_open(char *path, const char *opentype)
     }
 }
 
+const char *find_bootif_iface(int num_interfaces, char **ifs)
+{
+#ifdef __linux__
+#define PROC_CMDLINE "/proc/cmdline"
+#define ADDRESS_LEN 17 /* aa:bb:cc:dd:ee:ff */
+
+    int i;
+    FILE *cmdline_file;
+    char *cmdline = NULL;
+    size_t dummy;
+    const char *s;
+    char *bootif = NULL;
+
+    /* Look for BOOTIF= entry in kernel command line. */
+
+    cmdline_file = file_open(PROC_CMDLINE, "r");
+    if (!cmdline_file) {
+        di_error("Failed to open " PROC_CMDLINE ": %s", strerror(errno));
+        return NULL;
+    }
+    if (getline(&cmdline, &dummy, cmdline_file) < 0) {
+        di_error("Failed to read line from " PROC_CMDLINE ": %s",
+                 strerror(errno));
+        fclose(cmdline_file);
+        return NULL;
+    }
+
+    s = cmdline;
+    while ((s = strstr(s, "BOOTIF=")) != NULL) {
+        if (s == cmdline || s[-1] == ' ') {
+            size_t bootif_len;
+            char *subst;
+
+            s += sizeof("BOOTIF=") - 1;
+            bootif_len = strcspn(s, " ");
+            if (bootif_len != ADDRESS_LEN + 3)
+                continue;
+            bootif = strndup(s + 3, bootif_len - 3); /* skip hardware type */
+            for (subst = bootif; *subst; subst++)
+                if (*subst == '-')
+                    *subst = ':';
+            break;
+        }
+        s++;
+    }
+
+    if (!bootif) {
+        di_info("Could not find valid BOOTIF= entry in " PROC_CMDLINE);
+        free(cmdline);
+        fclose(cmdline_file);
+        return NULL;
+    }
+
+    free(cmdline);
+    fclose(cmdline_file);
+
+    /* Look for an interface matching BOOTIF. */
+
+    for (i = 0; i < num_interfaces; i++) {
+        size_t len;
+        char *kobj;
+        FILE *kobj_file;
+        char address[ADDRESS_LEN + 1];
+
+        len = strlen(SYSCLASSNET) + strlen(ifs[i]) + strlen("/address") + 1;
+        kobj = malloc(len);
+        snprintf(kobj, len, SYSCLASSNET "%s/address", ifs[i]);
+        kobj_file = file_open(kobj, "r");
+        if (!kobj_file)
+            goto next;
+        if (!fgets(address, ADDRESS_LEN + 1, kobj_file))
+            goto next;
+        if (strncmp(address, bootif, ADDRESS_LEN) == 0) {
+            di_info("Found interface %s with BOOTIF address %s",
+                    ifs[i], bootif);
+            fclose(kobj_file);
+            free(kobj);
+            free(bootif);
+            return ifs[i];
+        }
+
+next:
+        fclose(kobj_file);
+        free(kobj);
+    }
+
+    di_error("Could not find any interface with address %s", bootif);
+    free(bootif);
+
+#undef ADDRESS_LEN
+#undef PROC_CMDLINE
+#endif /* __linux__ */
+
+    return NULL;
+}
+
 void netcfg_die(struct debconfclient *client)
 {
     if (netcfg_progress_displayed)
@@ -486,15 +582,17 @@ void netcfg_die(struct debconfclient *client)
  * @param client - client
  * @param interface      - set to the answer
  * @param numif - number of interfaces found.
+ * @param defif - default interface from link detection.
  */
 
 int netcfg_get_interface(struct debconfclient *client, char **interface,
-                         int *numif, char* defif)
+                         int *numif, const char *defif)
 {
     char *inter = NULL, **ifs;
     size_t len;
     int ret, i, asked;
     int num_interfaces = 0;
+    const char *bootif;
     char *ptr = NULL;
     char *ifdsc = NULL;
     char *old_selection = NULL;
@@ -512,6 +610,12 @@ int netcfg_get_interface(struct debconfclient *client, char **interface,
 
     num_interfaces = get_all_ifs(1, &ifs);
 
+    /* If BOOTIF is set and matches an interface, override any provided
+     * default from link detection. */
+    bootif = find_bootif_iface(num_interfaces, ifs);
+    if (bootif)
+        defif = bootif;
+
     /* If no default was provided, use the first in the list of interfaces. */
     if (! defif && num_interfaces > 0) {
         defif=ifs[0];
diff --git a/netcfg.h b/netcfg.h
index e79f445..9304bb3 100644
--- a/netcfg.h
+++ b/netcfg.h
@@ -97,7 +97,7 @@ extern FILE *file_open (char *path, const char *opentype);
 
 extern void netcfg_die (struct debconfclient *client);
 
-extern int netcfg_get_interface(struct debconfclient *client, char **interface, int *num_interfaces, char* defif);
+extern int netcfg_get_interface(struct debconfclient *client, char **interface, int *num_interfaces, const char *defif);
 
 extern short valid_hostname (const char *hname);
 extern short valid_domain (const char *dname);

Regards,

-- 
Colin Watson                                       [cjwatson@debian.org]




Reply sent to Colin Watson <cjwatson@debian.org>:
You have taken responsibility. (Thu, 16 Jun 2011 17:30:14 GMT) (full text, mbox, link).


Notification sent to Thomas Mieslinger <thomas.mieslinger@1und1.de>:
Bug acknowledged by developer. (Thu, 16 Jun 2011 17:30:14 GMT) (full text, mbox, link).


Message #126 received at 615600-close@bugs.debian.org (full text, mbox, reply):

From: Colin Watson <cjwatson@debian.org>
To: 615600-close@bugs.debian.org
Subject: Bug#615600: fixed in netcfg 1.63
Date: Thu, 16 Jun 2011 17:18:01 +0000
Source: netcfg
Source-Version: 1.63

We believe that the bug you reported is fixed in the latest version of
netcfg, which is due to be installed in the Debian FTP archive:

netcfg-static_1.63_i386.udeb
  to main/n/netcfg/netcfg-static_1.63_i386.udeb
netcfg_1.63.dsc
  to main/n/netcfg/netcfg_1.63.dsc
netcfg_1.63.tar.gz
  to main/n/netcfg/netcfg_1.63.tar.gz
netcfg_1.63_i386.udeb
  to main/n/netcfg/netcfg_1.63_i386.udeb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 615600@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Colin Watson <cjwatson@debian.org> (supplier of updated netcfg package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Thu, 16 Jun 2011 18:03:01 +0100
Source: netcfg
Binary: netcfg netcfg-static
Architecture: source i386
Version: 1.63
Distribution: unstable
Urgency: low
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Changed-By: Colin Watson <cjwatson@debian.org>
Description: 
 netcfg     - Configure the network (udeb)
 netcfg-static - Configure a static network (udeb)
Closes: 615600
Changes: 
 netcfg (1.63) unstable; urgency=low
 .
   * If BOOTIF= is set on the Linux command line, look for an interface with
     that address and use it by default (closes: #615600, LP: #56679).
 .
   [ Updated translations ]
   * Asturian (ast.po) by MAAC
   * German (de.po) by Holger Wansing
   * Italian (it.po) by Milo Casagrande
Checksums-Sha1: 
 c6af2699cf3cbbbb85d6a16950a789a2a832cb56 1757 netcfg_1.63.dsc
 7660cd39ff1ce345025ec8f5350943607558f936 435502 netcfg_1.63.tar.gz
 c4ec42c0b460789629d583d6d8a4fb777c6b3e9b 331484 netcfg_1.63_i386.udeb
 4ac565811375857f1868d02552104ea2c686dff3 255320 netcfg-static_1.63_i386.udeb
Checksums-Sha256: 
 375b2f67585ad8be1d9c8b044bfbadb8d707c4c3553158cb5f61a0d9b060ef0d 1757 netcfg_1.63.dsc
 b5d8996833f79b3c9938eb3cac9051a9d1602fa06e5fe056ca18cd309d1a56f4 435502 netcfg_1.63.tar.gz
 29f3dc7340f8ccc48d41460296267eea31723cd2274ad8a05286b016cd718254 331484 netcfg_1.63_i386.udeb
 1990ac6722298669064e13fd59cce2101ecd4f3fbfef7833647030be853aa1d3 255320 netcfg-static_1.63_i386.udeb
Files: 
 7d0b91364bb1fb73559d8b631126a9b4 1757 debian-installer optional netcfg_1.63.dsc
 5a025a1d1722270760fca44058834e26 435502 debian-installer optional netcfg_1.63.tar.gz
 ed28f52b32e2eed40bd3f010533b1446 331484 debian-installer optional netcfg_1.63_i386.udeb
 ff2edc74ffb709928396b2f7b0bcd61f 255320 debian-installer optional netcfg-static_1.63_i386.udeb
Package-Type: udeb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Colin Watson <cjwatson@debian.org> -- Debian developer

iQIVAwUBTfo3jTk1h9l9hlALAQgtAQ//etcl6G+DEDkrVfPQDYy8wYOj7IZprfJ9
Z16nt1JeRIrmLUO5Z6HoPULBpFF8KZuWpJ8FJ73ErbFGY71dm9F1oBUvS8F2u/0e
aJAFoH+cGlfxpulml2ZGcYxQk/ArTYoqzbTdW8DveEh59KTh3tp2n4p8s01bgxS7
cDg4DR9S1g+YcRe4osF5udIHIOQgAgUPBDc+sOO+/gIezMJJmgENkLXB41craUJf
giOhAQoovu0S1yslPg5foqmx9FSr4kXWmlfzpJgPg+Jo03u09DeECuKK3XbUe1EL
A3/A9iB4BqQps5XZLUTBYemdoGKaASJApdp2dEuosAiNz7fwfgURZbBfrB8WTtKd
7z4a2qegVZ99S/vTJYNHbVonwexa5j6/Q3K4u00tA9JJaGF3u84GtTGLXWfq9TGI
I41mje2wa4mgmV00HZ7TZwxdKsL6LSzGMbAsNMxoND427OWS4jfPTb6+voM46Qzl
K36wvm5KDuDULj8dKcCZf8ncfkmdcSQfn39lTbPjd84d0X6sZD/7rhUynNGUlH6g
CWVgpLHyxep3OUnl5eZMsQ2qAi4KO1sGsQXogYBpdZr8C4HsWLmZWToiVq5sBTo+
88ZW7z14wxsGVz0fvCqXM2DNnTTB4GksJzsaGQNxdWEDISTJaGM778R6avzkbs6R
aT9/JJd96Os=
=S5KW
-----END PGP SIGNATURE-----





Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Mon, 25 Jul 2011 07:31:21 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Jan 14 04:24:10 2018; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.