lerner
Posts: 507
Joined: Sun Mar 29, 2015 12:12 am

allow hot-plug wlan0

Sat Sep 07, 2019 12:15 am

I have a RPZ(W) and now and then the WiFi goes down.

Yes, that is in itself a problem.

Every time it goes down, the RPZ dies. Or, more so: Is disconnected from the WiFI and doesn't reconnect when it comes back up.

Reading stuff there is/was a line you could put in the file that is:

Code: Select all

allow hot-plug wlan0
And that would stop this happening.

I can't seem to get it to work.

I never really got to try it on wlan0 with Stretch or Wheezy.
I got my RPI just at the end of Wheezy and it wasn't a RPZ.

I could do things like

Code: Select all

 allow hot-plug eth0
so I could plug/unplug/replug the ether net and it would keep working.

I never needed it that much for that side of things.

Then as I updated to Jessie and Stretch it still wasn't needed that often as most of them are eth0 connections.

But recently I have got a RPZ (Jessie, alas) and I am stuck with this problem to allow it to reconnect if the WiFi goes down.

As these machines are headless it is really annoying.

I have tried plugging keyboard/monitor into them and trying

Code: Select all

 ifup wlan0
after the Wifi has come back up but I just get an error something like:

No interface found.

It was there before the WiFi went down. So I don't get what is going on.

Thanks in advance.

lerner
Posts: 507
Joined: Sun Mar 29, 2015 12:12 am

Re: allow hot-plug wlan0

Sat Sep 07, 2019 12:33 am

It is kind of difficult to try a different "card" on a RPz(W).

The "card" is part and parcel to the machine.

I really don't get the sarcasm - though I am from Oz.

If that is the accepted way to talk to others, then it is not really of any help to anyone.

If people know things and other people like me don't. I ask.

Why people can't/don't want to share their knowledge beats me.

fruitoftheloom
Posts: 20736
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: allow hot-plug wlan0

Sat Sep 07, 2019 8:14 am

lerner wrote:
Sat Sep 07, 2019 12:15 am
I have a RPZ(W) and now and then the WiFi goes down.

Yes, that is in itself a problem.

Every time it goes down, the RPZ dies. Or, more so: Is disconnected from the WiFI and doesn't reconnect when it comes back up.

Reading stuff there is/was a line you could put in the file that is:

Code: Select all

allow hot-plug wlan0
And that would stop this happening.

I can't seem to get it to work.

I never really got to try it on wlan0 with Stretch or Wheezy.
I got my RPI just at the end of Wheezy and it wasn't a RPZ.

I could do things like

Code: Select all

 allow hot-plug eth0
so I could plug/unplug/replug the ether net and it would keep working.

I never needed it that much for that side of things.

Then as I updated to Jessie and Stretch it still wasn't needed that often as most of them are eth0 connections.

But recently I have got a RPZ (Jessie, alas) and I am stuck with this problem to allow it to reconnect if the WiFi goes down.

As these machines are headless it is really annoying.

I have tried plugging keyboard/monitor into them and trying

Code: Select all

 ifup wlan0
after the Wifi has come back up but I just get an error something like:

No interface found.

It was there before the WiFi went down. So I don't get what is going on.

Thanks in advance.

Raspbian Buster is the currently supported Operating System, there were / are many changes in Stretch / Buster compared to earlier Wheezy.

https://www.raspberrypi.org/downloads/raspbian/

https://www.raspberrypi.org/documentati ... /README.md
Retired disgracefully.....

lerner
Posts: 507
Joined: Sun Mar 29, 2015 12:12 am

Re: allow hot-plug wlan0

Sat Sep 07, 2019 9:30 am

fruitoftheloom

Thanks very much. I have a fixed point now.

But reading that it doesn't cover/explain how to reconnect to the WAP if it (the WAP) goes down and back up.
Or, I don't understand what I am seeing.

no mention of hot-plug

For setting up the WAP, that looks like the page I have bookmarked to do it.

I appreciate you pointing me in that direction, but if I have "done the leg work" and 99.9% believe it is the kernel panic problem,
how can I roll back to the previous working kernel?

It just seems to defy belief that a working kernel has been updated (bad use of the word) to the point that a working dongle that DID work: now when used to make an access point and a device connects causes a kernel panic and the machine locks up.

AND that a brand name wifi dongle also doesn't work.
I edit the hostapd.conf file line for the WiPi dongle and it doesn't give me a wlan0 interface.

Preparing for "worst case scenario", is there a command to see what packages I have installed so if I have to make a new SD card with Buster, I know what else I need to install?

(like nfs-utils as an example - be it valid or not)
MQTT,
EXFS,
and a whole lot of other stuff which I have collected over time.

Again: Thanks in advance.

epoch1970
Posts: 3695
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: allow hot-plug wlan0

Sat Sep 07, 2019 10:27 am

/etc/network/interfaces, ifup/ifdown, the "hotplug" keyword are all obsolete. Even in Jessie.

What you want is the modern way of configuring network interfaces, which is event-driven: when an interface is brought up, an event is fired and dhcpcd configures networking (see /etc/dhcpcd.conf). When an interface disappears, an event is fired and dhcpcd deconfigures networking.
In a sense, it is all "hotplug" by default now.

Forget the old commands "ifup wlan0" / "ifdown wlan0".
Instead get in the habit of using "ifconfig wlan0 up" / "ifconfig wlan0 down". Or, to be entirely up-to-date, "ip link set wlan0 up" / "ip link set wlan0 down". These commands will make dhcpcd do something.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

lerner
Posts: 507
Joined: Sun Mar 29, 2015 12:12 am

Re: allow hot-plug wlan0

Sat Sep 07, 2019 10:37 am

epoch1970 wrote:
Sat Sep 07, 2019 10:27 am
/etc/network/interfaces, ifup/ifdown, the "hotplug" keyword are all obsolete. Even in Jessie.

What you want is the modern way of configuring network interfaces, which is event-driven: when an interface is brought up, an event is fired and dhcpcd configures networking (see /etc/dhcpcd.conf). When an interface disappears, an event is fired and dhcpcd deconfigures networking.
In a sense, it is all "hotplug" by default now.

Forget the old commands "ifup wlan0" / "ifdown wlan0".
Instead get in the habit of using "ifconfig wlan0 up" / "ifconfig wlan0 down". Or, to be entirely up-to-date, "ip link set wlan0 up" / "ip link set wlan0 down". These commands will make dhcpcd do something.
Thanks. Very helpful. Well, helpful, but I don't quite understand it.

Ok, so the "ifup" and "ifdown" are no longer used.

So rather I would do the

Code: Select all

ifconfig wlan0 up
command.

But where/how do I invoke these commands?

All things being good, the WAP is there and the RPI is happy.

For what ever reason the WAP goes down.
What happens on the RPI and what do I need to do at this stage?

Then the WAP comes back up.
How does the RPI know?
If it has disabled the connection . . . I don't get how it knows the WAP is back.

Yeah, ok, it will be blindingly obvious but please indulge me.

Ernst
Posts: 1232
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: allow hot-plug wlan0

Sat Sep 07, 2019 10:49 am

lerner wrote:
Sat Sep 07, 2019 9:30 am

It just seems to defy belief that a working kernel has been updated (bad use of the word) to the point that a working dongle that DID work: now when used to make an access point and a device connects causes a kernel panic and the machine locks up.

AND that a brand name wifi dongle also doesn't work.I edit the hostapd.conf file line for the WiPi dongle and it doesn't give me a wlan0 interface.

Going back in this thread I have been unable to find sufficient information to analyze your problem.
You started with a wlan problem on a RPZ(W), now you mention a dongle and hostapd.

If you need help then it is your duty to provide correct and adequate information so that we can try to help you solve your problem.

EDIT: What is the WAP, where is the WAP ?
The road to insanity is paved with static ip addresses

lerner
Posts: 507
Joined: Sun Mar 29, 2015 12:12 am

Re: allow hot-plug wlan0

Sat Sep 07, 2019 11:01 am

I am sorry.

I have two BIG problems with the RPI just now.

I am getting them mixed up.

One is the RPz(W) not reconnecting and the other is a RPI (early version) suddenly not working with a new kernel being installed.

My head is all over the shop with it and I am sorry I mixed the two problems up.

lerner
Posts: 507
Joined: Sun Mar 29, 2015 12:12 am

Re: allow hot-plug wlan0

Tue Oct 08, 2019 9:20 am

epoch1970 wrote:
Sat Sep 07, 2019 10:27 am
Forget the old commands "ifup wlan0" / "ifdown wlan0".
Instead get in the habit of using "ifconfig wlan0 up" / "ifconfig wlan0 down". Or, to be entirely up-to-date, "ip link set wlan0 up" / "ip link set wlan0 down". These commands will make dhcpcd do something.
I know it has been a while, but it is how it is.

How can I detect that wlan0 has dropped off?

pcmanbob
Posts: 6939
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: allow hot-plug wlan0

Tue Oct 08, 2019 12:47 pm

lerner wrote:
Tue Oct 08, 2019 9:20 am

How can I detect that wlan0 has dropped off?
You can do that with a simple bash script like this

Code: Select all

#!/bin/bash

# keep wifi alive

ping -c2 192.168.1.1 

 
if [ $? != 0 ] 
then 

  sudo ifconfig wlan0 down
  sleep 30
  sudo ifconfig wlan0 up
  
fi
just change the ip address 192.168.1.1 to your routers address , and after making the scrip executable call it ever 5min using cron, if no connection to router it will run the down up commands.

if you want to keep a record of events then you could use this version

Code: Select all

#!/bin/bash

# keep wifi alive
echo "................................................"
date "+%Y.%m.%d %H:%M:%S"
echo " "
ping -c2 192.168.1.1 

 
if [ $? != 0 ] 
then 
  echo " "
  echo "No network connection, restarting wlan0"
  
  sudo ifconfig wlan0 down
  sleep 30
  sudo ifconfig wlan0 up
  
else
    echo " "
    cat /proc/net/wireless
fi
echo "................................................"
echo " "
and pipe the output to a file in the cron line like this

Code: Select all

*/5 * * * * /home/pi/checkwifi.sh  >>/home/pi/log.txt 2>&1
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

lerner
Posts: 507
Joined: Sun Mar 29, 2015 12:12 am

Re: allow hot-plug wlan0

Tue Oct 08, 2019 7:27 pm

Thank you thank you thank you.

Return to “Troubleshooting”