PiAware not starting at boot on Raspberry Pi Zero W

I’ve had to set my stack of Pi Zero Ws back up from scratch due to a batch of failed / failing micro SD cards, including my PiAware device. To keep things simple, I created several vanilla Raspberry Pi OS Lite (Bookworm) SD cards to build upon from scratch. All seemed to go without a hitch, except for my PiAware device. After running (sudo apt update && sudo apt upgrade -y) to get the OS up to date, I installed the RTL-SDR drivers for my RTL-SDR v4 USB stick using these steps:

sudo apt update
sudo apt install libusb-1.0-0-dev git cmake
sudo apt install debhelper
git clone GitHub - rtlsdrblog/rtl-sdr-blog: Modified Osmocom drivers with enhancements for RTL-SDR Blog V3 and V4 units.
cd rtl-sdr-blog
sudo dpkg-buildpackage -b --no-sign
cd …
sudo dpkg -i librtlsdr0_*
sudo dpkg -i librtlsdr-dev_*
sudo dpkg -i rtl-sdr_*

Followed by a reboot. I then started following the process for installing PiAware, using the steps on this page: PiAware - dump1090 ADS-B integration with FlightAware - FlightAware

I followed the steps exactly as printed with no deviation. Before rebooting (following the installation of dump1090-fa) I changed my feeder-id to my existing site ID using the following command:

sudo piaware-config feeder-id (my site id)

After rebooting, I noticed my feeder wasn’t showing online on my stats page so I ran (piaware-status) and had the following response:

PiAware master process (piaware) is not running.
PiAware ADS-B client (faup1090) is not running.
PiAware ADS-B UAT client (faup978) is not running (disabled by configuration settings)
PiAware mlat client (fa-mlat-client) is not running.
Local ADS-B receiver (dump1090-fa) is running with pid 574.

dump1090-fa (pid 574) is listening for ES connections on port 30005.
faup1090 is NOT connected to the ADS-B receiver.
piaware is NOT connected to FlightAware.

dump1090 is producing data on localhost:30005.

Your feeder ID is (my site id) (configured at /etc/piaware.conf:9)

I ran (sudo systemctl enable piaware), which completed successfully and rebooted. On reboot, (piaware-status) produces the same response as above. I then ran (sudo systemctl start piaware), which started piaware without issue. My feeder was then showing online and feeding aircraft as normal. I tried another reboot but again, piaware did not start on boot. Again, running (sudo systemctl start piaware) starts piaware without issue. If I run (sudo service piaware status) immediately after a reboot, I get the following response:

× piaware.service - FlightAware ADS-B uploader
Loaded: loaded (/lib/systemd/system/piaware.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Fri 2024-07-19 00:01:57 BST; 3min 43s ago
Duration: 6.547s
Docs: PiAware - ADS-B and MLAT Receiver - FlightAware
Process: 444 ExecStart=/usr/bin/piaware -p /run/piaware/piaware.pid -plainlog -statusfile /run/piaware/status.json (code>
Main PID: 444 (code=exited, status=6)
CPU: 1.963s

Jul 19 00:01:50 PiZeroW1 systemd[1]: Started piaware.service - FlightAware ADS-B uploader.
Jul 19 00:01:57 PiZeroW1 piaware[444]: software failed to determine MAC address of the device. cannot proceed without it.
Jul 19 00:01:57 PiZeroW1 systemd[1]: piaware.service: Main process exited, code=exited, status=6/NOTCONFIGURED
Jul 19 00:01:57 PiZeroW1 systemd[1]: piaware.service: Failed with result ‘exit-code’.
Jul 19 00:01:57 PiZeroW1 systemd[1]: piaware.service: Consumed 1.963s CPU time.

If I then run (sudo service piaware start), the piaware service starts and then running (sudo service piaware status) produces the following response:

● piaware.service - FlightAware ADS-B uploader
Loaded: loaded (/lib/systemd/system/piaware.service; enabled; preset: enabled)
Active: active (running) since Fri 2024-07-19 00:12:49 BST; 6s ago
Docs: PiAware - ADS-B and MLAT Receiver - FlightAware
Main PID: 864 (piaware)
Tasks: 2 (limit: 387)
CPU: 2.838s
CGroup: /system.slice/piaware.service
└─864 /usr/bin/piaware -p /run/piaware/piaware.pid -plainlog -statusfile /run/piaware/status.json

Jul 19 00:12:49 PiZeroW1 systemd[1]: Started piaware.service - FlightAware ADS-B uploader.
Jul 19 00:12:53 PiZeroW1 piaware[864]: creating pidfile /run/piaware/piaware.pid
Jul 19 00:12:53 PiZeroW1 piaware[864]: ****************************************************
Jul 19 00:12:53 PiZeroW1 piaware[864]: piaware version 9.0.1 is running, process ID 864
Jul 19 00:12:53 PiZeroW1 piaware[864]: your system info is: Linux PiZeroW1 6.6.40+ #1784 Tue Jul 16 13:49:51 BST 2024 armv6l>
Jul 19 00:12:54 PiZeroW1 piaware[864]: Connecting to FlightAware adept server at piaware.flightaware.com/1200
Jul 19 00:12:54 PiZeroW1 piaware[864]: Connection with adept server at piaware.flightaware.com/1200 established

After starting the service, the feeder works once again without issue.

TL;DR the issue appears to be that the service cannot determine the MAC address when attempting to start the service on boot, but it determines the MAC address fine when started manually. I don’t even know where to start with this one, any ideas?

1 Like

I’ve actually managed to fix this, so for anyone else with the same issue this is what I did to resolve:

sudo nano /lib/systemd/system/piaware.service

Locate the following in the [Service] section:

Restart=on-failure
RestartSec=30
RestartPreventExitStatus=4 6

Remove the number 6 from the last line so it reads:

RestartPreventExitStatus=4

This tells the service to attempt a restart after 30 seconds even if it cannot find a MAC address.

2 Likes

It’s a timing issue, your workaround should be fine for now. In the next version of piaware, failing to find a MAC address will be non-fatal (we haven’t really needed to know the MAC for a long time now, since the switch to using UUIDs to identify feeders)

1 Like

Thank obj. Is this due to the Pi Zero W being too slow to boot or the service attempting to start too early? I’ve started to replace my Zero Ws with Zero 2Ws, would this resolve the issue?

I can’t remember the specific details, but IIRC it was a race condition between the wifi interface becoming properly operational (firmware loaded, etc) and piaware starting – if piaware gets there first, then it doesn’t see the wifi interface (and there’s no onboard ethernet on a Zero to provide an alternative). It’s related to system speed, yeah, so a 2W is less likely to see it.

1 Like