can't set hardware address in /etc/network/interfaces

Bug #109725 reported by atollic on 2007-04-24
26
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ifupdown (Debian)
Fix Released
Unknown
ifupdown (Ubuntu)
Undecided
Unassigned

Bug Description

My SIS900 hardware address is not correctly recognized, so I've added line in to /etc/network/interfaces:

auto eth1
iface eth1 inet dhcp
        hwaddress ether 00:0b:6a:3a:30:a6

This worked well with 6.10 but not with fresh installed Feisty. Ifconfig says that hardware address is FF:FF:FF:FF:FF:FF. And because of this dhcp cannot assign correct IP.
I know SIS900 auto conf has problems but why does not the manual hw-address line in /etc/network/interfaces work in Feisty?

Ok, sorry, didn't realize that it would create problems, my sincere apologies. (I'm newbie on posting bugreports, Should the /e/n/i-file be sent to <email address hidden>?)

Here is my interfaces file anyway:

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

# The loopback interface
# automatically added when upgrading
auto lo
iface lo inet loopback

# The first network card - this entry was created during the Debian installation # (network, broadcast and gateway are optional) # automatically added when upgrading auto eth0 iface eth0 inet static
        hwaddress ether 00:a0:24:12:f5:a3
        address 10.1.9.51
        netmask 255.0.0.0
        network 10.0.0.0
        broadcast 10.255.255.255
        gateway 10.4.8.2

Regards
Ulf Ljungdahl

-----Ursprungligt meddelande-----
Från: Marc Haber [mailto:<email address hidden>]
Skickat: den 19 december 2003 11:23
Till: Ljungdahl, Ulf; <email address hidden>
Ämne: Re: Bug#224468: Ifup has problem with "hw ether xx:xx:xx:xx:xx:xx" in the interfaces-file

On Fri, Dec 19, 2003 at 09:54:29AM +0100, <email address hidden> wrote:
> Cc: <email address hidden>

Why are you Ccing the maintainer? The BTS does that automatically, and aj received your bug report twice.

> When specifying "hw ether xx:xx:xx:xx:xx:xx" in the interfaces-file to
> set the MAC-address on an interface you just get a "SIOCSIFHWADDR:
> Device or resource busy" error. This seem to come from the fact that
> ifup doesn't give the parameter/options to ifconfig in the right
> order, because ifup -v eth0
> gives:

Can you please post your /e/n/i file?

Greetings
Marc

--
-----------------------------------------------------------------------------
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Karlsruhe, Germany | lose things." Winona Ryder | Fon: *49 721 966 32 15
Nordisch by Nature | How to make an American Quilt | Fax: *49 721 966 31 29

On Fri, Dec 19, 2003 at 09:54:29AM +0100, <email address hidden> wrote:
> Cc: <email address hidden>

Why are you Ccing the maintainer? The BTS does that automatically, and
aj received your bug report twice.

> When specifying "hw ether xx:xx:xx:xx:xx:xx" in the interfaces-file to
> set the MAC-address on an interface you just get a "SIOCSIFHWADDR:
> Device or resource busy" error.
> This seem to come from the fact that ifup doesn't give the
> parameter/options to ifconfig in the right order, because ifup -v eth0
> gives:

Can you please post your /e/n/i file?

Greetings
Marc

--
-----------------------------------------------------------------------------
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Karlsruhe, Germany | lose things." Winona Ryder | Fon: *49 721 966 32 15
Nordisch by Nature | How to make an American Quilt | Fax: *49 721 966 31 29

reassign 224468 net-tools
thanks

* <email address hidden> [2003-12-19T09:54+0100]:
> Package:ifupdown
> Version:0.6.4-4.4
>
> When specifying "hw ether xx:xx:xx:xx:xx:xx" in the interfaces-file to
> set the MAC-address on an interface you just get a "SIOCSIFHWADDR:
> Device or resource busy" error.
> This seem to come from the fact that ifup doesn't give the
> parameter/options to ifconfig in the right order, because ifup -v eth0
> gives:
>
> Configuring interface eth0=eth0 (inet)
> run-parts /etc/network/if-pre-up.d
> ifconfig eth0 10.1.9.51 netmask 255.0.0.0 broadcast 10.255.255.255
> hw ether 00:a0:24:12:f5:a3 up
> SIOCSIFHWADDR: Device or resource busy

From what ifconfig --help says, this appears to be the right order of
arguments:

[217]% /sbin/ifconfig --help
Usage:
  ifconfig [-a] [-i] [-v] [-s] <interface> [[<AF>] <address>]
  [add <address>[/<prefixlen>]]
  [del <address>[/<prefixlen>]]
  [[-]broadcast [<address>]] [[-]pointopoint [<address>]]
  [netmask <address>] [dstaddr <address>] [tunnel <address>]
  [outfill <NN>] [keepalive <NN>]
  [hw <HW> <address>] [metric <NN>] [mtu <NN>]
  [[-]trailers] [[-]arp] [[-]allmulti]
  [multicast] [[-]promisc]
  [mem_start <NN>] [io_addr <NN>] [irq <NN>] [media <type>]
  [txqueuelen <NN>]
  [[-]dynamic]
  [up|down] ...

(net-tools_1.60-8)

So, I am inclined to think this is an ifconfig bug.

Reassigned to net-tools. net-tools maintainer, would you agree?

Cheers,
Michael

is the interface down while the command line is issued? I will check if it
is setting the mac before it is upping the interface.

Greetings
Bernd

* Bernd Eckenfels <email address hidden> [2003-12-19T18:08+0100]:
> is the interface down while the command line is issued? I will check if it
> is setting the mac before it is upping the interface.

In the most basic case (assigning static IP to interface): yes. But
this cannot generally be assumed, the interface might be still up
from network probing (arping, dhclient), and cannot be shut down
easily without confusing some software, deleting routes, etc. I am
afraid this restriction cannot easily be changed within ifupdown.

Could you explain a little about error, where it stems from and how
the order of arguments to ifconfig affects it?

Cheers,
Michael

reassign 224468 ifupdown
thanks

On Fri, Dec 19, 2003 at 11:50:39PM +0100, Michael Weber wrote:
> Could you explain a little about error, where it stems from and how
> the order of arguments to ifconfig affects it?

Well, ifconfig is doing an SIOCSIFHWADDR ioctl to tell the kernel to change
the HW address of an interface. It is doing this while parsing the command
line, therefore it will do this before it "ups" the interface, if it is
given before the up (and if the interface was not up then) verb:

calista:/home/ecki# ifconfig eth0 up
calista:/home/ecki# ifconfig eth0 hw ether 00:00:C0:A1:E7:CD
SIOCSIFHWADDR: Device or resource busy
calista:/home/ecki# ifconfig eth0 down hw ether 00:00:C0:A1:E7:CD
calista:/home/ecki# ifconfig eth0 down hw ether 00:00:C0:A1:E7:CD up
calista:/home/ecki# ifconfig eth0 hw ether 00:00:C0:A1:E7:CD
SIOCSIFHWADDR: Device or resource busy

There is nothing much ifconfig can do about it. One option would be to
actually check the current mac, and not issue the ioctl, if it is the
desired value (asuming, that the one who upped the interface already have
reconfigured the mac).

Perhaps it is a good idea to issue this command on its own, and ignore failure.

Reassigning this bug to ifupdown, please keep me posted, at least if you
want the patch to check for mac changes.

Greetings
Bernd
--
  (OO) -- <email address hidden> --
 ( .. ) ecki@{inka.de,linux.de,debian.org} http://home.pages.de/~eckes/
  o--o *plush* 2048/93600EFD eckes@irc +497257930613 BE5-RIPE
(O____O) When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl!

retitle 224468 ifupdown: hw option not implemented correctly

The only case I'm personally interested in is when you up the interface from scratch (boottime), so no problem with dhcp etc. I also think that issueing the command and getting an error if the the interface already is up is ok, but it _should_ work if you take the interface down first or run it from sctrach at boottime(and don't have any dhcp etc running before the network is configured)! Please tell me if you want more feedback from me, I'm a bit new to this bugthing.

Regards
/ulf Ljungdahl

-----Ursprungligt meddelande-----
Från: Bernd Eckenfels [mailto:<email address hidden>]
Skickat: den 20 december 2003 02:42
Till: <email address hidden>
Kopia: Michael Weber; <email address hidden>; Ljungdahl, Ulf
Ämne: Re: Bug#224468: Ifup has problem with "hw ether xx:xx:xx:xx:xx:xx" in the interfaces-file

reassign 224468 ifupdown
thanks

On Fri, Dec 19, 2003 at 11:50:39PM +0100, Michael Weber wrote:
> Could you explain a little about error, where it stems from and how
> the order of arguments to ifconfig affects it?

Well, ifconfig is doing an SIOCSIFHWADDR ioctl to tell the kernel to change the HW address of an interface. It is doing this while parsing the command line, therefore it will do this before it "ups" the interface, if it is given before the up (and if the interface was not up then) verb:

calista:/home/ecki# ifconfig eth0 up
calista:/home/ecki# ifconfig eth0 hw ether 00:00:C0:A1:E7:CD
SIOCSIFHWADDR: Device or resource busy
calista:/home/ecki# ifconfig eth0 down hw ether 00:00:C0:A1:E7:CD calista:/home/ecki# ifconfig eth0 down hw ether 00:00:C0:A1:E7:CD up calista:/home/ecki# ifconfig eth0 hw ether 00:00:C0:A1:E7:CD
SIOCSIFHWADDR: Device or resource busy

There is nothing much ifconfig can do about it. One option would be to actually check the current mac, and not issue the ioctl, if it is the desired value (asuming, that the one who upped the interface already have reconfigured the mac).

Perhaps it is a good idea to issue this command on its own, and ignore failure.

Reassigning this bug to ifupdown, please keep me posted, at least if you want the patch to check for mac changes.

Greetings
Bernd
--
  (OO) -- <email address hidden> --
 ( .. ) ecki@{inka.de,linux.de,debian.org} http://home.pages.de/~eckes/
  o--o *plush* 2048/93600EFD eckes@irc +497257930613 BE5-RIPE
(O____O) When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl!

tags 224468 patch
thanks

From my understanding, the following patch should solve the issue,
shouldn't it? (it sets the hardware address before 'upping' the interface)

Regards

Javi

$ diff -u inet.defn.orig inet.defn
--- inet.defn.orig 2004-01-21 15:17:01.000000000 +0100
+++ inet.defn 2004-01-21 15:20:04.000000000 +0100
@@ -33,9 +33,10 @@
     mtu size -- MTU size

   up
+ [[ ifconfig %iface% hw %hwaddress%]]
     ifconfig %iface% %address% netmask %netmask% [[broadcast %broadcast%]] \
        [[pointopoint %pointopoint%]] [[media %media%]] [[mtu %mtu%]] \
- [[hw %hwaddress%]] up
+ up
     route add -net %network% \
         if ( mylinuxver() < mylinux(2,1,100) )
     [[ route add default gw %gateway% %iface% ]]

tags 224468 patch
tags 135502 patch
tags 207727 patch
tags 229503 l10n
tags 210436 patch
thanks

Download full text (8.3 KiB)

tag 101204 + fixed
tag 113338 + fixed
tag 129003 + fixed
tag 135502 + fixed
tag 148666 + fixed
tag 164823 + fixed
tag 169194 + fixed
tag 171981 + fixed
tag 172147 + fixed
tag 196366 + fixed
tag 196865 + fixed
tag 198841 + fixed
tag 207727 + fixed
tag 208607 + fixed
tag 210436 + fixed
tag 213068 + fixed
tag 213723 + fixed
tag 216716 + fixed
tag 224468 + fixed
tag 229503 + fixed
tag 229527 + fixed
tag 231404 + fixed
tag 231910 + fixed
tag 231995 + fixed
tag 232347 + fixed
tag 232594 + fixed
tag 235993 + fixed
tag 239142 + fixed
tag 241248 + fixed
tag 57830 + fixed
tag 76142 + fixed
tag 81150 + fixed
tag 82339 + fixed
tag 84602 + fixed
tag 86902 + fixed
tag 92993 + fixed
tag 96265 + fixed
tag 97782 + fixed

quit

This message was generated automatically in response to a
non-maintainer upload. The .changes file follows.

-----BEGIN PGP SIGNED MESSAGE-----

Format: 1.7
Date: Mon, 5 Apr 2004 21:12:05 +0200
Source: ifupdown
Binary: ifupdown
Architecture: source i386
Version: 0.6.4-4.7
Distribution: unstable
Urgency: low
Maintainer: Anthony Towns <email address hidden>
Changed-By: Javier Fernandez-Sanguino Pen~a <email address hidden>
Description:
 ifupdown - High level tools to configure network interfaces
Closes: 57830 76142 81150 82339 84602 86902 92993 96265 97782 101204 113338 129003 135502 148666 164823 169194 171981 172147 196366 196865 198841 207727 208607 210436 213068 213723 216716 224468 229503 229527 231404 231910 231995 232347 232594 235993 239142 241248
Changes:
 ifupdown (0.6.4-4.7) unstable; urgency=low
 .
   * Non-maintainer upload. This is mostly a bug-fix release, no new
     features have been added and the behaviour of ifupdown has only changed
     slightly. Content has been reviewed by both the maintainer and several
     other maintainers (who have NMUed this package previously)
     - Ifupdown.dvi now depends on *eps files (Closes: #101204)
     - Added missing Build-Dep to noweb since the Makefile calls makenwdep.sh
       (and it calls 'noroots') on build.
     - Remove the undocumented (and unused) -s option from the manpage and the
       main.c code. (Closes: #231404)
     - inet6.defn
       + Make it possible to run an v4tunnel without an address (Closes: #96265)
     - inet.defn
       + Included different handling of dhclient3 versus dhclient.
       + Avoids inconsistency in interface state if the command run
        by ifup fails, also added -e option to dhclient in order to
        have it return an error if it cannot get an address.
        Notice that this is not yet done with dhclient3 (-1) since that would
        mean not running dhclient3 as a daemon and renews not being done.
        (Closes: #97782, #82339, #113338, #148666, #169194)
       + An independent lease file is created per interface so that dhclient
        can be used in more than one interface (Closes: #196366)
       + If dhcp3-client is installed (the binary /sbin/dhclient3 is available)
        then use the -r option instead of with a KILL signal, this enables
        it to release the DHCP release an execute the hook script before
        exiting. Also, the package now suggests 'dhcp-client | dhcp3-client'
        (since dhcp3-client does not p...

Read more...

Download full text (25.2 KiB)

Source: ifupdown
Source-Version: 0.6.5

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

ifupdown_0.6.5.dsc
  to pool/main/i/ifupdown/ifupdown_0.6.5.dsc
ifupdown_0.6.5.tar.gz
  to pool/main/i/ifupdown/ifupdown_0.6.5.tar.gz
ifupdown_0.6.5_i386.deb
  to pool/main/i/ifupdown/ifupdown_0.6.5_i386.deb

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 <email address hidden>,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Anthony Towns <email address hidden> (supplier of updated ifupdown 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 <email address hidden>)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Mon, 4 Apr 2005 23:41:06 +1000
Source: ifupdown
Binary: ifupdown
Architecture: source i386
Version: 0.6.5
Distribution: unstable
Urgency: low
Maintainer: Anthony Towns <email address hidden>
Changed-By: Anthony Towns <email address hidden>
Description:
 ifupdown - high level tools to configure network interfaces
Closes: 54814 57731 57830 62542 62633 63071 67743 67796 68869 69723 70030 71779 72872 74312 74563 75279 76086 76142 76198 76985 79683 79822 81143 81150 81611 82339 82604 83496 83542 83557 83804 84602 84697 85206 86410 86895 86902 88946 88947 88948 92993 94656 96265 97782 98448 99444 101204 103868 105342 107701 108857 108876 110198 112012 112652 113338 113620 114429 121755 122422 129003 135502 138403 138694 141634 148666 150773 151465 151932 152853 152893 154517 156789 157698 160918 164823 169194 171981 172147 173101 174764 175679 178226 178630 180000 186316 196366 196865 198841 200786 203636 204468 207727 208607 208726 208811 209006 210436 213068 213723 216716 224468 229503 229527 231404 231910 231995 232347 232594 235993 239142 241248 242314 242527 242537 242607 242867 245067 245067 247772 248717 249233 250713 254388 255218 255228 255574 258965 259609 263913 264134 265165 266282 266479 283649 284123 286155 286166 287172 294970 296273 297762 297898 300937 302519
Changes:
 ifupdown (0.6.5) unstable; urgency=low
 .
   * The Gernot Heiser release -- aged like a fine South Australian wine.
 .
   * Switch to Debian-native versioning / source packaging for the time being.
     (Closes: Bug#84697)
   * Change Section: to base, to match overrides.
 .
   * Thanks to Michael Weber, Javier Fernandez-Sanguino Pena, Marc
     Haber, and Thomas Hood for NMUs. (Closes: Bug#150773, Bug#151465,
     Bug#152893, Bug#208726, Bug#209006, Bug#242314, Bug#263913,
     Bug#266282, Bug#297762)
 .
   * debian/rules: Don't re-build unnecessarily. Thanks to Michael Banck
     (Closes: Bug#296273)
 .
   * Add post-up, pre-down as aliases for "up" and "down". (Closes: Bug#62633)
 .
   * Deprecate (undocument) "--exclude" option.
 .
   * Add support for "allow-*" lines for systems such as hotplug or ifplugd.
     Usage is "ifup --allow=hotplug <interfaces>"...

atollic (eu9645) wrote :

My SIS900 NIC hardware address is not correctly recognized, so I've added line in to /etc/network/interfaces:

auto eth1
iface eth1 inet dhcp
        hw ether 00:0b:6a:3a:30:a6

This worked well with 6.10 but not with fresh installed Feisty. Ifconfig says that hardware address is FF:FF:FF:FF:FF:FF and because of this dhcp cannot assign correct IP.
I know SIS900 auto conf has problems but why does not the manual hw-address line in /etc/network/interfaces work in Feisty?

atollic (eu9645) on 2007-04-24
description: updated
atollic (eu9645) on 2007-04-24
description: updated
atollic (eu9645) wrote :

dmesg

atollic (eu9645) wrote :
atollic (eu9645) wrote :

Internet connection can be established by doing manually:

sudo ifconfig eth1 down
sudo ifconfig eth1 inet hw ether 00:0b:6a:3a:30:a6 up
sudo dhclient3

LKRaider (paul-eipper) wrote :

Try using a pre-up rule on the /etc/network/interfaces file, like this:

auto eth0
iface eth0 inet static
pre-up ifconfig eth0 hw ether 01:01:01:01:01:01
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1

I don't know why Feisty is not sending the hwaddress option before the others, something must have changed on the ifupdown source.

Busybox had a similar bug, fixed here:
http://bugs.busybox.net/view.php?id=880
Summary: 0000880: ifupdown fails to set hwaddress
Description: When using ifup to enable an interface that has a hwaddress line in /etc/network/interfaces the SIOCSIFHWADDR ioctl fails with a message that the device is busy. This happens because all the parameters are sent on a single ifconfig line and thus the interface is set to an UP state before the hwaddress portion is processed.

LKRaider (paul-eipper) on 2007-05-24
Changed in ifupdown:
status: Needs Info → Confirmed
Richard Hansen (rhansen) wrote :

I am having a similar problem in Gutsy. After adding the line "hwaddress ether 01:23:45:67:89:ab" to /etc/network/interfaces and running "sudo /etc/init.d/networking restart", I get the error message "SIOCSIFHWADDR: Device or resource busy". Commenting out the hwaddress line and adding a pre-up rule as suggested by LKRaider seems to work.

atollic: do you also get the SIOCSIFHWADDR error?

Debian bug #224468 (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=224468) and Ubuntu bug #150924 may also be related.

Rainer Sabelka (sabelka) wrote :

Oh Hardy the file /etc/network/if-pre-up.d/vlan contains a hook for setting the hardware address of the interface:

# This is not vlan specific, and should actually go somewhere else.
if [ -n "$IF_HW_MAC_ADDRESS" ]; then
    ip link set $IFACE address $IF_HW_MAC_ADDRESS
fi

But unforunately this doesn't work because $IF_HW_MAC_ADDRESS is not set anywhere.

Changed in ifupdown:
status: Unknown → Fix Released
Stefan Sauer (ensonic) wrote :

I just installed 8.10 on a laptop that has sis900 for ethernet. Network does not work as hw address is 00:00:00:00:00:00.
When I do
fconfig eth0 hw ether 01:23:45:67:89:ab
I get
SIOCSIFHWADDR: cannot assign requested address

see also:
http://bugzilla.kernel.org/show_bug.cgi?id=11649

suki (m-daoust) wrote :

>> sudo ifconfig eth0 inet hw ether 00:0b:6a:3a:30:a6 up

!sweet, thanks atollic!

my Ethernet connection has been broken for almost 4 months.
and that's all it took to fix it...

Stéphane Graber (stgraber) wrote :

Should have been working fine for a few years now.

Changed in ifupdown (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.