User avatar
mikerr
Posts: 2489
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Wifi troubles - wlan4: renamed from wlan0

Thu May 28, 2015 5:37 pm

Ok so I have a few Pi's and a few wifi dongles:

Image

I have wifi setup and working great on the pi, but its now all gone wrong.

Dmesg reports

Code: Select all

rt800usb 1-1.2:1.0 wlan7 renamed from wlan0
The pi then won't connect (config setup for wlan0)

And yes, that's with a single wifi dongle inserted.

It seems to be tracking individual dongles, as the same wifi dongle will show wlan7
unplug that and another one will show wlan4, the first will again show wlan7 if plugged in again

I've moved the SD card from pi to pi, with the same problem.
Not sure what's changed as I used to be able to plug any dongle into any pi and it all work ok ?!
Last edited by mikerr on Thu May 28, 2015 6:19 pm, edited 1 time in total.
Android app - Raspi Card Imager - download and image SD cards - No PC required !

User avatar
mikerr
Posts: 2489
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Wifi troubles - wlan4: renamed from wlan0

Thu May 28, 2015 6:17 pm

Digging, I've found the culprit is the file /etc/udev/rules.d/70-persistent-net.rules

This had the MAC addresses of each wifi dongle stored...

Deleting that file and rebooting has fixed it - though unsure why I've never had this problem before...
Android app - Raspi Card Imager - download and image SD cards - No PC required !

Heater
Posts: 7741
Joined: Tue Jul 17, 2012 3:02 pm

Re: Wifi troubles - wlan4: renamed from wlan0

Thu May 28, 2015 6:32 pm

That file may well be recreated on reboot, or at least that is what I have read about it around the net, did you try a reboot and see if that happened?

User avatar
rpdom
Posts: 11522
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK

Re: Wifi troubles - wlan4: renamed from wlan0

Thu May 28, 2015 6:34 pm

mikerr wrote:Digging, I've found the culprit is the file /etc/udev/rules.d/70-persistent-net.rules

This had the MAC addresses of each wifi dongle stored...

Deleting that file and rebooting has fixed it - though unsure why I've never had this problem before...
The default behaviour in Debian (and Rapsbian, I believe), but not the Foundation images, is for that file to accumulate entries for every network interface encountered.

There is a file somewhere which controls that, but I can't remember where (and I think dinner might be burning, so I've got to go...)

Tom_A
Posts: 272
Joined: Fri Dec 06, 2013 8:34 am

Re: Wifi troubles - wlan4: renamed from wlan0

Thu May 28, 2015 7:10 pm

If I insert more than one wifi dongle, they are assigned wlan0, wlan1, etc... based on whichever one is found on the USB interface first. If I have them plugged in two of them through a hub one way, swap their positions and reboot, they will have swapped their connections. I'd actually like them to keep their wlan0, wlan1 designations based on their mac addresses as I'm using the extra one to provide a wifi hotspot. The settings for the hotspot are different for each of the dongles that I'm using and I want the one with the better range to be the connection going out to the internet. What I have been doing now is not plugging in the second dongle until after booting to insure it gets wlan1.

I don't have a 70-persistent-net.rules file on the install I'm using now.

User avatar
rpdom
Posts: 11522
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK

Re: Wifi troubles - wlan4: renamed from wlan0

Thu May 28, 2015 7:39 pm

Tom_A wrote:If I insert more than one wifi dongle, they are assigned wlan0, wlan1, etc... based on whichever one is found on the USB interface first. If I have them plugged in two of them through a hub one way, swap their positions and reboot, they will have swapped their connections. I'd actually like them to keep their wlan0, wlan1 designations based on their mac addresses as I'm using the extra one to provide a wifi hotspot. The settings for the hotspot are different for each of the dongles that I'm using and I want the one with the better range to be the connection going out to the internet. What I have been doing now is not plugging in the second dongle until after booting to insure it gets wlan1.

I don't have a 70-persistent-net.rules file on the install I'm using now.
The 70-persistent-net.rules file is auto generated if not blocked.

You could create a manual one for your interfaces
Something like

Code: Select all

# wlan0
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="AA:BB:CC:DD:EE:FF", KERNEL=="wlan*", NAME="wlan0"

# wlan1
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:11:22:33:44:55", KERNEL=="wlan*", NAME="wlan1"
Replace the AA:BB:CC:DD:EE:FF and 00:11:22:33:44:55 with the MAC addresses of your dongles and I think that will fix the names of the interfaces.

User avatar
DougieLawson
Posts: 29735
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Wifi troubles - wlan4: renamed from wlan0

Fri May 29, 2015 7:05 am

rpdom wrote: The 70-persistent-net.rules file is auto generated if not blocked.
Eh? By what process? It doesn't exist on any of my RPis that have WiFi dongles.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

User avatar
rpdom
Posts: 11522
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK

Re: Wifi troubles - wlan4: renamed from wlan0

Fri May 29, 2015 7:40 am

DougieLawson wrote:
rpdom wrote: The 70-persistent-net.rules file is auto generated if not blocked.
Eh? By what process? It doesn't exist on any of my RPis that have WiFi dongles.
Exactly!

That's what "if not blocked" in my post meant. In the RPF images the config file that causes this to be auto generated has been disabled.

User avatar
mikerr
Posts: 2489
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Wifi troubles - wlan4: renamed from wlan0

Fri May 29, 2015 7:53 am

Ah - I have a mix of (raspbian) cards
- this image originated from a cut down raspbian: Minibian
https://minibianpi.wordpress.com/features/
Android app - Raspi Card Imager - download and image SD cards - No PC required !

MrEngman
Posts: 3562
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Wifi troubles - wlan4: renamed from wlan0

Fri May 29, 2015 10:12 am

/etc/udev/rules.d/70-persistent-net.rules is generated dependent on the contents of file /lib/udev/rules.d/75-persistent-net-generator.rules. Particularly this line

Code: Select all

# device name whitelist
KERNEL!="ath*|msh*|ra*|sta*|ctc*|lcs*|hsi*", \
                                        GOTO="persistent_net_generator_end"
If the line includes wlan*| persistent names will be generated for wifi modules. Deleting wlan*| from the line will stop it generating /etc/udev/rules.d/70-persistent-net.rules for wlan devices.

The current default for raspbian is as above so it will not generate persistent names for wlan or eth devices. Originally it included eth*|wlan*| so generated persistent names for both eth and wlan devices but was changed way back.

If you want to create persistent names, for example if you use more than one wifi module connected to your Pi, then add wlan*| to that line and your wifi modules will be given persistent names.


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

User avatar
mikerr
Posts: 2489
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Wifi troubles - wlan4: renamed from wlan0

Mon Jun 01, 2015 12:11 pm

Thanks, that fixed it permanently
Android app - Raspi Card Imager - download and image SD cards - No PC required !

Return to “Raspbian”

Who is online

Users browsing this forum: No registered users and 16 guests