Another cannot read LCD text from python script / script not running

Hello,

Seems like this is a reoccurring title however none of the existing ones seemed to really fit my situation. Just got my spark, did a fresh wheezy install - followed instructions, got all updates, ran the install script, ran the update script etc etc etc yada yada yada…

So here are the symptoms… approx. every 60-90 seconds on average the web LCD readout says “Cannot read LCD text from python script” and the button says “Script not running.” it recovers after about ten seconds and resumes running for another 60-90 ish… rinse and repeat… forever.

Also, and this may be part of the same issue but even though the internet connection is fine, the logs show the following over and over

/home/brewpi/utils/wifiChecker.sh: line 32: [: 192.168.1.1: binary operator expected
BrewPi: wifiChecker: Attempt 1 to reach 192.168.1.1
192.168.1.1 failed (Sun Jan 10 00:40:11 MST 2016)
BrewPi: wifiChecker: Attempt 2 to reach 192.168.1.1
192.168.1.1 failed (Sun Jan 10 00:40:36 MST 2016)
BrewPi: wifiChecker: Unable to reach router. Restarting wlan0 interface… (Sun Jan 10 00:41:01 MST 2016)
BrewPi: wifiChecker: Cannot find gateway IP. Restarting wlan0 interface… (Sun Jan 10 00:50:01 MST 2016)
/sbin/ifdown: interface wlan0 not configured

and it appears to restart the wifi every ten minutes like clockwork.

So this leaves me wondering, did I configure something wrong? Is there an issue with the wifichecker script? I come from the Windows world of IT, so RaspberryPi / Linux is pretty new territory for me. I can get around for the most part, with the help of Google of course, and I’m picking it up fast, but its just not what I know, so any directions, advice or troubleshooting steps you can give will likely need to be spelled out for me.

Thanks again!

The wifi checker runs every 10 minutes if you enable it to check whether the wifi is working. If it doesnt, it resets the wlan0 interface.
It seems that the check is not working for you and it resets the wifi (while it is actually working), giving you a short timeout every 10 minutes.

You can disable the wifi check by editing the cron file:

sudo nano /etc/cron.d/brewpi

change entries="brewpi wifichecker" to entries="brewpi ~wifichecker"

Then run

sudo /home/brewpi/utils/updateCron.sh

Hi Spy,

On the command line, could you please type

ip route

and paste the output?

Thanks

Thanks for the info Elco, I will disable it if I can’t get it fixed. I’d really like for it to work properly if possible though.

192.168.1.1 is the gateway and the address the script is checking and returning a failure.

The pi’s address is .25

I have no idea what the 303 metric is or what the .130 address is either… I’ll have to investigate that address.

pi@BrewPi ~ $ ip route
default via 192.168.1.1 dev wlan0
default via 192.168.1.1 dev wlan0 metric 303
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.130 metric 303
pi@BrewPi ~ $

EDIT: I investigated the .130 address and everything is saying it is my BrewPi that is assigned to .25 statically is also at .130 as well… Not sure how but I can hit the the web interface on both IP’s. Found it in my routers dhcp table and removed it, but was still able to browse to it on the .130 address… Thoughts?

edit brewpi-script/utils/wifiChecker.sh line 32, and modify it to read:

gateway=$(/sbin/ip route | awk ‘/default/ { print $3 }’)| head -n 1

That is a quick fix for you in this situation. I’m guessing you somehow managed to add a backup route or vpn or something similar to it. I’m ashamed to say I haven’t gotten smart on the ip command yet (old dog, new trick, etc) but something similar to

ip route del default via 192.168.1.1 dev wlan0 metric 303

may delete that second entry. Anyway, a few things there for you to try. Good luck, let us know if any of those solutions fix your problem.

Elco, I can submit a PR if this works :slight_smile:

What does that line I’m adding to the script actually do?

I couldn’t find a dir called brewpi-script… is it supposed to be /home/brewpi/utils/wifiChecker.sh? Also, in my file it was line 30… dunno if that means anything…

After running the ip route del command, ip route shows the following

pi@BrewPi ~ $ ip route del default via 192.168.1.1 dev wlan0 metric 303
RTNETLINK answers: Operation not permitted
pi@BrewPi ~ $ sudo ip route del default via 192.168.1.1 dev wlan0 metric 303
pi@BrewPi ~ $ ip route
default via 192.168.1.1 dev wlan0
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.130 metric 303
pi@BrewPi ~ $

so the .130 metric 303 is still there… or at least part of it… part of it seems to be gone now. What the heck is it? it just seems odd that there would be 2 functioning IP’s assigned to the Pi… not sure how that could even happen… and I don’t get why the metric would be 303. I did install xrdp, could that be related?

I don’t know how it got added there, but its not part of the default. I can’t really answer more than ‘it was something you did’ (I know users love to hear that :slight_smile: ), so xrdp could be a culprit- but i just don’t know. What was happening was you were returning a value of “ip\nip” back to the script, which couldn’t handle a two-line return. Modifying line 30 simply told it to just pick the first one, if there was more than one. However, you successfully deleted the second gw entry, so now its back to only having one entry, and you don’t need the ‘head’ command anymore. But, it won’t hurt to leave it in there.

It sounds like it should be fixed now then, yes?

Ah, thanks for the clarification on that. Much appreciated, love learning what’s going on.

I think it must or would almost have to be xrdp since its literally the only deviation from the instructions…

Except it still isn’t liking something.

instead of getting

/home/brewpi/utils/wifiChecker.sh: line 32: [: 192.168.1.1: binary operator expected
BrewPi: wifiChecker: Attempt 1 to reach 192.168.1.1
192.168.1.1 failed (Sun Jan 10 00:40:11 MST 2016)
BrewPi: wifiChecker: Attempt 2 to reach 192.168.1.1
192.168.1.1 failed (Sun Jan 10 00:40:36 MST 2016)
BrewPi: wifiChecker: Unable to reach router. Restarting wlan0 interface… (Sun Jan 10 00:41:01 MST 2016)
BrewPi: wifiChecker: Cannot find gateway IP. Restarting wlan0 interface… (Sun Jan 10 00:50:01 MST 2016)
/sbin/ifdown: interface wlan0 not configured

I’m now just getting

BrewPi: wifiChecker: Cannot find gateway IP. Restarting wlan0 interface… (Mon Jan 11 20:50:01 MST 2016)
BrewPi: wifiChecker: Cannot find gateway IP. Restarting wlan0 interface… (Mon Jan 11 21:00:01 MST 2016)

What do you think?

After the gateway= line, could you add
echo $gateway

and post what that value is? It should just be a number that appears in your log

I added it, but it didn’t report anything at all… no change in output just the restart message.

This may go faster if you join the IRC channel #brewpi on irc.freenode.net , we can try to help you (interactively) if you’re around. Just hang out a bit if no one answers right away; I’m perplexed as to why it would still be doing that.

also available at http://brewpi.com/chat