Raspi Network Failure Shenanigan

It seems as I run into a common issue with my Raspberry 4. After an indeterministic uptime, the wifi stops working.

And here is the hotfix, a small script provided by @pitto first restarting the nic and if anything fails just reboots the device:

This bash script checks for wireless internet connection and, if it is failing, tries to fix it.

It is simple and it seems to work.


I just have to write some automation to roll it out automatically including a corresponding cron job once I find some time.

GitHub Repo: https://github.com/ltpitt/bash-network-repair-automation

Automation of the Home Automation

After we talked a lot about it in our podcast, I finally started with my “Automation of the Home Automation” project.

What I’ve done so far: Set up a Raspi 4 with Ubuntu Server, fully provisioned using Ansible. Also, it seems, the Kernel bug causing USB devices to fail on the 4 GB version of the Raspi 4 seams to be removed with the most recent binaries available.

Deployed MQTT, InfluxDB, Telegraf and Node-Red on Docker containers using Ansible.

Wrote my very first Node-Red flow to get data into the broker and the database:

The data is read from my EZcontrol XS1, which became surprisingly easy using Node-Red.

The EZcontrol XS1 integration for Home Assistant allows you to observe and control devices configured on the XS1 Gateway. Please have a look at the official docs for using this gateway.

While I was not sure about the available resources on the Raspberry, it seems there is plenty of space (RAM, CPU) left on the device.

On the other side, using Ansible I will be able to deploy services to other (more) nodes once necessary.

Unfortunately, docker-ce is not yet available for Ubuntu 19.10 Eoan. Therefore, adding the Docker repositories will fail.

A simple workaround is to add the repositories for disco instead.

The Ansible code to do so is quite simple:

- name: Add stabel repository 
  apt_repository: 
    repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu "disco" stable
    state: present  

Also, I realized some issues with Ansible on Ubuntu running on the Raspi and Python. Therefore, I made sure Python 2.7 is entirely uninstalled. Instead, I made sure my inventory file is set to use Python 3 on the target system.

[raspi]
raspi4

[raspi:vars]
ansible_python_interpreter=/usr/bin/python3

There have been some other issues, I came along, especially because for various bits OI was looking for there are no ARM aarch64 releases available. Also, the official Docker images I used do not support Apline on ARM v8 / aarch64 as Alpine seems not to support this target architecture, yet.

More bits and bytes to be added soon…

Fixing USB Problems Ubuntu Server on Raspberry 4

When trying to rung Ubunto Server on a Raspberry 4 with 4 GB RAM, you might end up with the same problem as me: USB is not working at all.

The cause is a kernel bug affecting 4 GB version of the Raspberry 4 Model B only. 1 and 2 GB versions are working quite fine.

The issue has been identified and it’s been found to be a kernel bug with a solution in the works that being tested. In the meantime, you can access to your Raspberry Pi 4 4GB USB ports by limiting the memory to 3GB in /boot/firmware/usercfg.txt […]

To limit the available RAM to 3 GB just add

total_mem=3072

to the usercfg.txt.

Link: https://www.cnx-software.com/2019/11/04/raspberry-pi-4-4gb-models-usb-ports-dont-work-on-ubuntu-19-10/

Raspberry Pi – Setting a static IPv4 address

It run me mad, as I tried to change the IP address of my Raspberry to a static one. I changed literally everything in  /etc/network/interfaces and reloaded, restarted and reboot the device over and over.

iface eth0 inet static
address 192.168.0.207
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.

As the above configuration did not help a lot, I figured out that based on the Raspberry model, you need to change settings on various places.

First run

cat /proc/cpuinfo

to determine you model. While getting something like

pi@raspberrypi:~ $ cat /proc/cpuinfo
processor    : 0
model name    : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS    : 2.00
Features    : half thumb fastmult vfp edsp java tls
CPU implementer    : 0x41
CPU architecture: 7
CPU variant    : 0x0
CPU part    : 0xb76
CPU revision    : 7

Hardware    : BCM2708
Revision    : 0004
Serial        : 000000004715b608

you need to use the hardware revision and

Model and Pi Revision 256MB Hardware Revision Code from cpuinfo
Model B Revision 1.0 256MB 0002
Model B Revision 1.0 + ECN0001 (no fuses, D14 removed) 256MB 0003
Model B Revision 2.0
Mounting holes
256MB 0004
0005
0006
Model A
Mounting holes
256MB 0007
0008
0009
Model B Revision 2.0
Mounting holes
512MB 000d
000e
000f
Model B+ 512MB 0010
Compute Module 512MB 0011
Model A+ 256MB 0012
Pi 2 Model B 1GB a01041 (Sony, UK)
a21041 (Embest, China)
PiZero 512MB 900092

Based on this information you need

Model a

Static IP addresses in /etc/network/interfaces is not the “prefered” way,as it is an old way and DHCPCD5 is installed.

Model b

Static IP addresses are configured in the /etc/dhcpcd.conf and it is  required that /etc/network/interfaces is set to manually.

iface eth0 inet manual

That’s all…

Locating unknown Raspberry Pi device in your Network

Just as a quick hint, once you have set up a new Raspberry Pi device (or probably any other device) which you don’t know, simply run the arp command to find out about your neighborhood.

Running

arp -a

will make usage of the ARP protocol and give you some interesting information about some devices in your network.

arp -a

In my very case, I was told, the newly installed Raspberry Pi got the IPv4 address 192.168.0.82.