# Macchanger: interface up or not permission BCM4313 [SOLVED]

## HeXiLeD

I have macchanger in 2 systems and it works wel in one but not on the other.

Regardless of having the eth* up or down the error is always the same.

```
# macchanger -r eth1

Current MAC: 11:22:33:44:55:00 (unknown)

ERROR: Can't change MAC: interface up or not permission: Too many open files in system
```

However it does change the mac but does not show the change.

Trying to set the mac using ifconfig also outputs an error:

```
SIOCSIFHWADDR: Too many open files in system
```

I thought if this would be related to system limits but i get:

```
# ulimit 

unlimited
```

I also found this similar topic but without a solution and i wonder if it might be related to this.

Package version: 

```
# macchanger -V

GNU MAC changer 1.5.0

Written by Alvaro Lopez Ortega <alvaro@gnu.org>

Copyright (C) 2003 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```

Any suggestions ?

----------

## salahx

For many of the network related ioctls and netlink commands, the usual error codes are "overloaded" to mean different things. For example, when tryign to add a route that exlready exists (or would conflict) the system returns -EEXIST ("File exists"). Unfortunately the tools blindly perror() the result, so the errors are often misleading.

In this case, the SIOCSIFHWADDR ioctl is returning -ENFILE (Too many open files in system). However, that's not one of the usual returns for that function, so the error may be coming from the NIC driver. What driver is the NIC using?

----------

## HeXiLeD

```
*  net-wireless/broadcom-sta

      Latest version available: 5.100.82.112-r2

      Homepage:      http://www.broadcom.com/support/802.11/linux_sta.php

      Description:   Broadcom's IEEE 802.11a/b/g/n hybrid Linux device driver.

      License:       Broadcom
```

----------

## salahx

Unfortunately that driver is just binary blob with Linux wrapping. Only Broadcom can help you with them.

However your wireless device MIGHT be supported by the linux open-source b43 driver: http://linuxwireless.org/en/users/Drivers/b43 or brcm80211: http://linuxwireless.org/en/users/Drivers/brcm80211 (in staging).  You'll need to use lspci to find your chipset.

----------

## HeXiLeD

I have tried another driver before but without much success. At the time some drivers seemed to work well for somethings but not for all. Maybe there is a new update now.

The nic is:

```
02:00.0 Network controller: Broadcom Corporation BCM4313 802.11b/g/n Wireless LAN Controller (rev 01)
```

Extra detailed hardware info can be seen here.

and the computer wiki page here.

It is an Asus eeepc 1015ped

----------

## salahx

That chipset (BCM4313) isn't currently supported by the b43 drivers (but it is being worked on), however it IS supported by brcm80211 (lshal shows a PCI ID of (14e4:4727).

This driver was only moved out of staging very recently - it occurred after 3.1 was released - in (3.2-rc1). So at this point you have 3 options:

1) Wait until 3.2 is released (very soon)

2) Use the latest 3.2-rcX kernel

3) Use the staging driver if have an older kernel (not recommended as this drivers has had many change to it since 3.0 was released)

The config option you want is called BRCMSMAC . You also need the firmware files - emerge the linux-firmware packages (the BCM4313 firmware was added upstream April 26 2011, so the lastest stable - 20110731 should have the firmware you need.

----------

## HeXiLeD

I upgraded to vanilla-sources 3.2.1 and recompiled with recommeded support however something seems not to be working:

```
 # lsmod

Module                  Size  Used by

brcmsmac              472818  0 

brcmutil                2707  1 brcmsmac

crc8                     920  1 brcmsmac

cordic                   865  1 brcmsmac
```

```
*  sys-kernel/linux-firmware

      Latest version available: 20110818

      Latest version installed: 20110818

      Size of files: 15,648 kB

      Homepage:      http://www.kernel.org/pub/linux/kernel/people/dwmw2/firmware

      Description:   Linux firmware files

      License:       GPL-1 GPL-2 GPL-3 BSD freedist
```

```
# lspci -v 

02:00.0 Network controller: Broadcom Corporation BCM4313 802.11b/g/n Wireless LAN Controller (rev 01)

        Subsystem: AzureWave Device 2047

        Flags: bus master, fast devsel, latency 0, IRQ 17

        Memory at fbffc000 (64-bit, non-prefetchable) [size=16K]

        Capabilities: [40] Power Management version 3

        Capabilities: [58] Vendor Specific Information: Len=78 <?>

        Capabilities: [48] MSI: Enable- Count=1/1 Maskable- 64bit+

        Capabilities: [d0] Express Endpoint, MSI 00

        Kernel driver in use: brcmsmac

        Kernel modules: wl, brcmsmac
```

```

 # ifconfig  eth1 up

eth1: ERROR while getting interface flags: No such device
```

Either this driver does not supports the nic or something may be missing.

Any ideas?

----------

## salahx

is the device still eth1? With the new driver it might something else like wlan0. You can use 'ip link' to see the names of the adapters.

----------

## HeXiLeD

Negative result with ip link. I also checked udev and net rules configuration files.

Perhaps some extra missing details. 

I updated all my hardware infos

Check out dmesg and the latest kernel.

----------

## salahx

Here's the problem:

```

ieee80211 phy0: Failed to select rate control algorithm

ieee80211 phy0: Failed to initialize rate control algorithm

ieee80211 phy0: brcms_attach: ieee80211_register_hw failed, status-2

```

Not sure why is doing it, though. Make sure you have the firmware in /lib/firmware, and blacklist any other Broadcomm drivers ( bcma,b43,b43legacy,brcm80211,ssb) /etc/modprobe.d/blacklist.conf; you may need to rebuild your initramfs (if you are using one) after blacklist as well.

----------

## HeXiLeD

Kernel Vanilla sources 3.2.6

```

# lsmod 

Module                  Size  Used by

brcmsmac              472882  0 

mac80211              175526  1 brcmsmac

brcmutil                2707  1 brcmsmac

cfg80211              140086  2 brcmsmac,mac80211
```

```
# dmesg | grep ieee80211

ieee80211 phy0: Failed to select rate control algorithm

ieee80211 phy0: Failed to initialize rate control algorithm

ieee80211 phy0: brcms_attach: ieee80211_register_hw failed, status-2
```

```
# emerge -pv sys-kernel/linux-firmware

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R   ~] sys-kernel/linux-firmware-20110818  USE="-savedconfig" 0 kB
```

```
 ls /lib/firmware/ | grep brcm

brcm
```

```
 # ls /lib/firmware/brcm/       

bcm4329-fullmac-4.bin  bcm4329-fullmac-4.txt  bcm43xx-0.fw  bcm43xx_hdr-0.fw
```

```
/etc/modprobe.d/blacklist.conf 

# This file lists modules which will not be loaded by udev,

# not at coldplugging and not on hotplug events.

# Add your own entries to this file

# in the format "blacklist <name of module>"

# Some examples:

# evbug is a debug tool and should be loaded explicitly

blacklist evbug

# Autoloading eth1394 most of the time re-orders your network

# interfaces, and with buggy kernel 2.6.21, udev persistent-net

# is not able to rename these devices, so you get eth?_rename devices

# plus an exceeded 30sec boot timeout

blacklist eth1394

# You probably want this to not get the console beep loud on every tab :)

#blacklist pcspkr

# these drivers are very simple, the HID drivers are usually preferred

#blacklist usbmouse

#blacklist usbkbd

# Sometimes loading a framebuffer driver at boot gets the console black

#install pci:v*d*sv*sd*bc03sc*i* /bin/true

# hplip and cups 1.4+ use raw USB devices, so it requires usblp not be loaded

#blacklist usblp

blacklist ieee80211

blacklist bcma                            

blacklist b43legacy

blacklist brcm8021

blacklist ssb
```

```
 # iwconfig 

lo        no wireless extensions.

usb0      no wireless extensions.

tunl0     no wireless extensions.

eth0      no wireless extensions.

```

initramfs does not exist or is used and the current kernel config is here.

The current loaded drivers are what a friend of mine has on his system and works.

I am out of ideas.

----------

## HeXiLeD

I found someone with a similar problem and some workaround. However it does not work for me.

 *salahx wrote:*   

> Not sure why is doing it, though. Make sure you have the firmware in /lib/firmware, and blacklist any other Broadcomm drivers ( bcma,b43,b43legacy,brcm80211,ssb) /etc/modprobe.d/blacklist.conf

 

I also found that my kernel 3.2.7 config insists in the following:

```
# cat /usr/src/linux/.config| grep BCMA

CONFIG_BCMA_POSSIBLE=y

# CONFIG_BCMA is not set
```

I unselected all Broadcom Specific AMBA options but that setting persists no matter what. Even when editing the config manually and saving it does not work once make is executed the config changes and sets that option again.

However this says

```
The driver is also available in the 3.2 and newer kernels. When using 'make menuconfig' it can be accessed: 

Location: -> Device Drivers 

-> Network device support 

-> Wireless LAN 

-> < > Broadcom IEEE802.11n PCIe SoftMAC WLAN driver 

-> < > Broadcom IEEE802.11n embedded FullMAC WLAN driver 

-> [ ] SDIO bus interface support for FullMAC driver 

-> [ ] USB bus interface support for FullMAC driver 
```

For the PCIe SoftMAC WLAN driver (brcmsmac) you need to enable select the BCMA bus driver as well:

```
Location: -> Device Drivers 

-> Broadcom specific AMBA 

-> <M> BCMA support 

-> [*] Support for BCMA on PCI-host bus
```

I will try a few compiles and then post the results as well as a working kernel.

----------

## HeXiLeD

Finally i was able to get the driver to work.

The working config is here

I added the kernel support that is related to minstrel_ht rate algorithm

The wlan interface is now up and running; however i cant macchage it as the errors still persist. In fact now the mac does not even change at all.

```
ERROR: Can't change MAC: interface up or not permission: Device or resource busy
```

Any ideas?

----------

## Hu

 *HeXiLeD wrote:*   

> The wlan interface is now up and running
> 
> ```
> ERROR: Can't change MAC: interface up or not permission: Device or resource busy
> ```
> ...

 Most drivers refuse to change their interface MAC address when the interface is up.  You stated you have the interface up, so it is likely that this is the cause.

----------

## HeXiLeD

Yes you are correct i was just recompiling to troubleshoot details and saw that.

```
ifconfig wlan0 down

macchanger -r 

ifconfig wlan0 up
```

Topic is SOLVED

----------

## darktowermage

I have also been trying to get my bcm4313 card to allow mac changing but don't follow what exactly resolved the problem for you. Would you be willing to walk me through the steps that worked.  Any and all help is greatly appreciated!!

Here's my error, which looks like your original. 

macchanger -r eth1 

Permanent MAC: 00:00:00:00:00:00 (Xerox Corporation) 

Current MAC: c0:cb:38:18:03:43 (Hon Hai Precision Ind. Co.,ltd.) 

ERROR: Can't change MAC: interface up or not permission: Operation not permitted 

And some additional info:

-Version-

Kernel		: Linux 3.2.0-27-generic (x86_64)

Compiled		: #43-Ubuntu SMP Fri Jul 6 14:25:57 UTC 2012

C Library		: Unknown

Default C Compiler		: GNU C Compiler version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) 

Distribution		: Ubuntu 12.04 LTS

Desktop Environment		: Unity (ubuntu)

macchanger -V 

GNU MAC changer 1.5.0 

Written by Alvaro Lopez Ortega <alvaro@gnu.org> 

Copyright (C) 2003 Free Software Foundation, Inc. 

This is free software; see the source for copying conditions. There is NO 

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

sudo lsmod 

lib80211_crypt_tkip 17390 0 

lib80211 14381 2 lib80211_crypt_tkip,wl 

wl 2568210 0 

lshw 

*-pci:1 

description: PCI bridge 

product: 5 Series/3400 Series Chipset PCI Express Root Port 2 

vendor: Intel Corporation 

physical id: 1c.1 

bus info: pci@0000:00:1c.1 

version: 06 

width: 32 bits 

clock: 33MHz 

capabilities: pci pciexpress msi pm normal_decode bus_master cap_list 

configuration: driver=pcieport 

resources: irq:41 ioport:2000(size=4096) memory:fbe00000-fbefffff ioport:d0a00000(size=2097152) 

*-network 

description: Wireless interface 

product: BCM4313 802.11b/g/n Wireless LAN Controller 

vendor: Broadcom Corporation 

physical id: 0 

bus info: pci@0000:12:00.0 

logical name: eth1 

version: 01 

serial: c0:cb:38:18:03:43 

width: 64 bits 

clock: 33MHz 

capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless 

configuration: broadcast=yes driver=wl0 driverversion=5.100.82.38 ip=172.20.238.119 latency=0 multicast=yes wireless=IEEE 802.11 

resources: irq:17 memory:fbe00000-fbe03fff

----------

## HeXiLeD

Reading the topic with attention instead of sending private messages crying for help or post almost irrelevant information about your problem will get you better results solving the problem for you. (That is if on ubuntu people were taught how to think using the terminal)

 *salahx wrote:*   

> Unfortunately that driver is just binary blob with Linux wrapping. Only Broadcom can help you with them.
> 
> However your wireless device MIGHT be supported by the linux open-source b43 driver: http://linuxwireless.org/en/users/Drivers/b43 or brcm80211: http://linuxwireless.org/en/users/Drivers/brcm80211 (in staging).  You'll need to use lspci to find your chipset.

 

The brcm80211 is out of staging and has now been enhanced in the latest stable kernel. (Assuming you know what is the "latest kernel").

You are using Broadcom.

```
wl 2568210 0
```

Typical from an ubuntu user. Does not read, does not care to read, does not make an effort to read or to be useful to his community (or others; hence why sending private messages) and uses ubuntu because it "reminds him of windows" and the mouse is all he/she needs. What happened to your forums ? People lost the terminal ? compiling too *hard* ?

Read the topic carefully. You might have to recompile the kernel *SCARY*

Note: This is a gentoo forum. People know what they use and the tools to troubleshoot it. You may want to stay out of it or change your distro if you intend to seriously learn. We help in community means for all to benefit and NOT on private messages.

----------

## HeXiLeD

Flawlessly working with brcmsmac opensource driver.

kernel using Broadcom brcmsmac opensource (PCIe) driver: 

```
[*] Networking support  --->

 -*-   Wireless  --->

  <M>   cfg80211 - wireless configuration API

  [*]     enable powersave by default (optional)

  [*]     cfg80211 wireless extensions compatibility

  [*]   Wireless extensions sysfs files

  <M>   Generic IEEE 802.11 Networking Stack (mac80211)

  [*]   Minstrel

  [*]     Minstrel 802.11n support

  [*]   Enable mac80211 mesh networking (pre-802.11s) support '(optional/for mesh networks)

 <*>   RF switch subsystem support  --->

  [*]   RF switch input support

Device Drivers  --->

 [*] Network device support  --->

   [*]   Wireless LAN  --->

    <M>   Broadcom IEEE802.11n PCIe SoftMAC WLAN driver

 Broadcom specific AMBA  ---> 

  <*> BCMA support 

  [*]   Support for BCMA on PCI-host bus
```

Driver instalation: 

```
# echo modules="brcmsmac brcmutil mac80211 cfg80211" >> /etc/conf.d/modules
```

Driver name brcmsmac

```
# emerge linux-firmware
```

```
# lsmod

Module                  Size  Used by

brcmsmac              456307  0 

mac80211              207812  1 brcmsmac

brcmutil                2432  1 brcmsmac

cfg80211              140101  2 brcmsmac,mac80211
```

Fully tested with EEEPC 1015PED 

Network controller: Broadcom Corporation BCM4313 802.11b/g/n Wireless LAN Controller (rev 01) Subsystem: AzureWave Device 2047 BCM4313 802.11b/g/n Wireless LAN Controller

----------

