pwnagotchi icon indicating copy to clipboard operation
pwnagotchi copied to clipboard

Image won’t boot on Raspberry Pi Zero 2 W

Open AlexWhitehouse opened this issue 2 years ago • 170 comments

Expected Behaviour

Expected to boot on Pi Zero 2 W. Fails to boot.

Current Behaviour

Fails to boot

Possible Solution

Recompile kernel for RPiZ2W

Steps to Reproduce (for bugs)

  1. Flash image to SD
  2. Load SD into RPiZ2W
  3. Try to boot

Your Environment

  • [x] You're using the official images (1.5.5)

  • [x] You're using a raspberry pi zero 2 w

  • [x] You're using a supported LCD (waveshare v2)

AlexWhitehouse avatar Nov 02 '21 12:11 AlexWhitehouse

Funny - i just swapped mine over with no issues at all:

root@pwnagotchu:~# dmesg|more [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 5.4.83-Re4son-v7+ (root@kali) (gcc version 10.2.1 20210110 (Debian 10.2.1-6)) #1 SMP Sat May 15 03:22:58 UTC 2021 [ 0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d [ 0.000000] CPU: div instructions available: patching division code [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache [ 0.000000] OF: fdt: Machine model: Raspberry Pi Zero 2 Rev 1.0

root@pwnagotchu:~# lscpu Architecture: armv7l Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 1

root@pwnagotchu:~# cat /usr/local/src/pwnagotchi/pwnagotchi/_version.py version = '1.5.5'

akhepcat avatar Nov 02 '21 21:11 akhepcat

I don't even get past the multicoloured square to boot to the kernel image. Neither do I get any status lights on the pi itself. I have loaded other images to check there is no problem with the pi and these have booted successfully.

AlexWhitehouse avatar Nov 03 '21 00:11 AlexWhitehouse

FWIW - i'm running on a 64G SanDisk Ultra, Class 10 (A1) that had previously been running on a Pi0w-v1

You could try booting up on a V1, using the usb ethernet sharing and "internet sharing" then ssh into the pi and make sure there are no filesystem issues, and run an apt-get update / upgrade cycle to get everything up to date? (you may need to manually fix-up /etc/resolv.conf, and set your time/date.)

But I didn't do any of that prior to booting it on the V2 ... just swapped the card over, and it worked fine.

akhepcat avatar Nov 03 '21 01:11 akhepcat

Very strange, I don't have a v1 to hand to test that unfortunately. Does the fact there are no status lights or anything output to HDMI suggest that the pi is not accepting the image on the SD card? It works fine with other builds just not the pwnagotchi image.

AlexWhitehouse avatar Nov 03 '21 01:11 AlexWhitehouse

you could try re-imaging the sdcard. Or try booting it on any other pi hardware you might have, possibly excepting for the wifi and cdcether, it should otherwise start up (tested on a Pi4, even cdcether works)

akhepcat avatar Nov 03 '21 01:11 akhepcat

I have re-imaged the sdcard, plugged into RPi Zero 2 and nothing. I then plug the same card into a Pi4 and I get activity lights and an IP address. I then plug the same card back into the zero 2 and get nothing again. I have also tried just raspbian light on the SD card in the zero 2 and this works fine.

AlexWhitehouse avatar Nov 03 '21 01:11 AlexWhitehouse

Seeing the same issue. The Zero 2 fails to boot with any of the following:

  • clean flash of v1.5.5
  • clean flash of v1.5.5, apt update&upgrade
  • "old image" (running latest 1.5.5)
  • old image, apt update&upgrade

But it did boot with the latest raspbian

For reference, here's what we see while it boots from the Pi Zero W (non Zero2) root@pwnagotchi:~# dmesg|more [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 5.4.83-Re4son+ (root@kali) (gcc version 10.2.1 20210110 (Debian 10.2.1-6)) #1 Sat May 15 12:50:45 UTC 2021 [ 0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache [ 0.000000] OF: fdt: Machine model: Raspberry Pi Zero W Rev 1.1

Junohea avatar Nov 05 '21 07:11 Junohea

I am having the same problem on my zero 2. I have also tried the steps @Junohea tried in his post above. The sd card works fine on my rpi 4 and everything else with it works to but the status lights don't even blink on the zero2.

isthisausername1 avatar Nov 05 '21 07:11 isthisausername1

One difference i see in your bootlog is the kernel version: Mine (booting) : 5.4.83-Re4son-v7+ Yours (failing) : 5.4.83-Re4son+

This would seem to indicate that you need to upgrade your kernel, or the image that you're using.

Boot it on a working device, get internet connectivity (via wired, or 2nd wifi) and run a distro upgrade to see if there's an upgraded kernel for you.

(apparently I may have done that, but I don't remember upgrading the system...)

akhepcat avatar Nov 05 '21 16:11 akhepcat

I think it defiantly could have been that, unfortunately i didn't check the version before updating but now after doing

sudo apt update && sudo apt full-upgrade -y

it started working and now it boots and i can ssh into it and see the web ui. Hope that can help someone.

isthisausername1 avatar Nov 05 '21 22:11 isthisausername1

One issue with this is that there's apparently a change with numpy ( #1045 ), and now the ai crashes on load.

There's already a bug open on it, so you might want to go give it a thumbs-up

akhepcat avatar Nov 05 '21 22:11 akhepcat

I did see that in the logs but didn't think to much of it. That's not the only problem I'm having, whenever I try to put it into auto mode it keeps saying "[INFO] waiting for bettercap API to be available". However when I put it in my pi4 it works in auto fine. The passwords are still the default and I haven't changed them which is the common thing between all the reports of this problem on Google so I'm not sure if that's a me broke something thing Or a pi zero 2w thing.


From: Leif @.> Sent: Saturday, November 6, 2021 9:37:51 AM To: evilsocket/pwnagotchi @.> Cc: Joshua Guthrie @.>; Manual @.> Subject: Re: [evilsocket/pwnagotchi] Image won’t boot on Raspberry Pi Zero 2 W (Issue #1046)

One issue with this is that there's apparently a change with numpy, and now the ai crashes on load.

There's already a bug open on it, so you might want to go give it a thumbs-up

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/evilsocket/pwnagotchi/issues/1046#issuecomment-962261013, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AQQS7IWC3OQKZMCLTGRCG7LUKRTE7ANCNFSM5HGJZUXA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

isthisausername1 avatar Nov 05 '21 23:11 isthisausername1

I think it defiantly could have been that, unfortunately i didn't check the version before updating but now after doing

sudo apt update && sudo apt full-upgrade -y

it started working and now it boots and i can ssh into it and see the web ui. Hope that can help someone.

Retried the setups from before but did the full-upgrade and it worked in all instances. 👍

Junohea avatar Nov 06 '21 03:11 Junohea

Retried the setups from before but did the full-upgrade and it worked in all instances. 👍

Glad to here it got it going, have you had any other problems running it on the pi zero 2 w

I manually started the better cap api now im getting error 400: exit status 254 in the logs. Googleing this turned up nothing.

isthisausername1 avatar Nov 06 '21 05:11 isthisausername1

I think it defiantly could have been that, unfortunately i didn't check the version before updating but now after doing sudo apt update && sudo apt full-upgrade -y it started working and now it boots and i can ssh into it and see the web ui. Hope that can help someone.

Retried the setups from before but did the full-upgrade and it worked in all instances. 👍

To clear up a little this sorted my install but I had to boot the image using a PI 3. The image wouldnt boot on a PI4. Once booted and upgraded everything looks to be working fine (so far)

ianculpan avatar Nov 07 '21 15:11 ianculpan

I've gotten the zero 2 to boot with the apt full-upgrade but haven't been able to get it to find any networks while running. The mon0 interface comes up and I can see networks with iwlist mon0 scan. It gets to 50 blind epochs and reboots in 6 minutes.

[CRITICAL] 50 epochs without visible access points -> rebooting ...

I notice this in the system log but doesn't seem to give many more clues.

brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43436-sdio.raspberrypi,model-zero-2.txt failed with error -2

The same image works on the original 0w.

The AI issue I worked around by apt install libavformat58 libavcodec58 but this replaced kalipi-bootloader with raspberrypi-bootlader.

skontrolle avatar Nov 10 '21 02:11 skontrolle

@skontrolle you'll need to make sure you've got the most recent linux-firmware packages (libre and nonfree) installed.

Worst-case, you can grab the firmware files from any ubuntu machine running 21.04 or 21.10 right out of /lib/firmware/brcm/ and install them into the same place on the rPi

the "brcmfmac43436-sdio.raspberrypi,model-zero-2.txt" file warning can be ignored. it's a backup file for setting the firmware variables, but the less specific driver file will take care of it.

akhepcat avatar Nov 10 '21 02:11 akhepcat

Thanks, for the warning explanation. The latest firmware appears to be in place and the checksums of the files match https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm firmware-brcm80211/oldstable,now 1:20190114-2+rpt4 all [installed] which was upgraded from rpt2. If I remove the brcmfmac43436-* files the wifi doesn't come up at all as expected.

Is there something in bettercap I can set to log or try?

skontrolle avatar Nov 10 '21 05:11 skontrolle

I just retraced all of my steps with a clean 1.5.5 image to make sure I didn't have any issues with my backup config.

  • raw image doesn't boot on zero2
  • boot 0w
  • sudo apt update && sudo apt full-upgrade -y
  • swap card to zero2
  • boots but no wifi for bettercap
    • install firmware not upgraded in the full-upgrade sudo apt install firmware-brcm80211; reboot
  • pwnagotchi starts, mon0 interface up & can iwlist mon0 scan, numpy error in logs, all epochs are blind
    • update numpy sudo pip3 install --upgrade numpy to resolve #1015
  • with numpy fixed, all epochs are still blind, and the AI fails in import cv2
    • sudo apt install libavcodec58 libavformat58; these remove the kalipi-bootloader. reboot for good measure
  • epochs still blind, AI starts really quickly, pwnagotchi restarts after 50 blind epochs.
  • drop card back in 0w, everything works.

skontrolle avatar Nov 13 '21 19:11 skontrolle

Okay, so @skontrolle - i'm not sure if you'll be able to revert back, but you can try to force re- install kalipi-bootloader and kalipi-kernel

i think that without the kalipi kernel (and modules) you won't get the correct driver for the mon interface, so won't be able to sniff correctly.

I was able to just install libavcodec58 libavformat58 without upgrading/installing the raspberrypi-bootloader/kernel by marking the two packages as "hold" - apt-mark hold kalipi-bootloader kalipi-kernel

it's a horrible workaround, but seems to have gotten mine up and running fully now ( also setting /etc/default/crda to the correct domain)

akhepcat avatar Nov 15 '21 03:11 akhepcat

Thanks @akhepcat but still no joy on the wifi

The kalipi-kernel has persisted through the updates. I reverted the av..58s reinstalled the kalipi-bootlaoder held them but was unable to install the files. Looking a bit more I found the libraspberrypi0 is the reason the bootloader is tried to replace. Installing a slightly older one allowed me to get the av..58 files installed and to keep the bootloader. libraspberrypi0/oldstable 1:1.20211029-1~buster armhf [upgradable from: 5.4.83-20210516]

I also set the /etc/default/crda. When messing manually in bettercap, I was able to see it failing on channels outside my locality with wifi.recon on so this might be doing something.

For good measure, here's the wifi loading line from the kernel, is yours similar? brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/2 wl0: Oct 9 2020 14:44:32 version 9.88.4.65 (test) (f149b32@shgit) (r679549) FWID 01-f40f3270

I'm not sure it's supported upstream in nexmon yet... https://github.com/seemoo-lab/nexmon/issues/500

skontrolle avatar Nov 15 '21 05:11 skontrolle

~~This worked perfectly, everything is working now and it is working great.~~ i lied, everything except the wifi parts work. i made a quick script for anyone wanting to use the new rpi and is lazy like me. If you see anything i could do better please let me know, this is my first ever script.

https://github.com/isthisausername2/pwnagotchi_rpi_zero_2_fix

isthisausername2 avatar Nov 15 '21 05:11 isthisausername2

This worked perfectly, everything is working now and it is working great.

i made a quick script for anyone wanting to use the new rpi and is lazy like me. If you see anything i could do better please let me know, this is my first ever script.

https://github.com/isthisausername2/pwnagotchi_rpi_zero_2_fix

I'm sorry but... What exactly working great? I've follow all steps from the first comment, and tried everything... But my rpi 02w still not working. If I do "sudo iwlist mon0 scan" I receive all networks around me, but bettercap didn't found anything. It's me or nobody with the new zero have it working?

Btw I didn't update libav*58 because I didn't understand what to do after with kalipi-bootloader.

andur82 avatar Nov 15 '21 16:11 andur82

The steps written by @skontrolle got my Zero 2 w working*.

I recommend flashing your sd card with a fresh install of pwnagotchi, following those steps or using the script on a pi that does boot, then putting that fresh sd card in your zero 2 w and seeing if that fixes it. That's how i got mine working.

isthisausername2 avatar Nov 15 '21 19:11 isthisausername2

I cloned the repo from @isthisausername2 and made some changes to ward off some potential issues that I foresee. https://github.com/akhepcat/pwnagotchi_rpi_zero_2_fix

@andur82 - burn a new, fresh image of 1.5.5.
Boot onto a pi0w-v1 and either using a USB-ethernet or the usb-gadget interface for network connectivity, run the script as root. It'll take about an hour to download and upgrade. You can't use wifi to do the upgrade, currently.

you should also be able to use a pi3 or pi4 for the first booting and upgrades (again, you'll need to use usb-gadget or ethernet for network connectivity)

That said: it still won't work on the pi zero v2, because the only firmware available for the brcmfmac43436 chip doesn't support the full promiscuous capture in monitor mode, unlike the brcmfmac43430 of the -v1.

And as @skontrolle mentioned, until nexmon releases a working firmware, running this on the zero-v2 isn't going to get us anywhere. ( https://github.com/seemoo-lab/nexmon/issues/500 )

akhepcat avatar Nov 15 '21 23:11 akhepcat

@akhepcat many thanks for this explain. I've done all stuff by hand and not by script on a pi3. Didn't understand about the nexmon firmware and the zero-v2. Sorry.

Strange things: on the rpi3, after done all update with libav*58 (and installing raspberry bootloader instead of the original kali) the pwnagotchi do only one round with the first found aps, then completely die. No more scan. It's normal? Otherwise I'll back to older "original" 1.5.5 release.

andur82 avatar Nov 15 '21 23:11 andur82

@isthisausername2 interesting that you got it to work. What wifi firmware chipset /firmware do you get from sudo dmesg |grep brcm I just tried a few of the nexmon patched pi3 firmwares without any luck. @akhepcat nice summary!

In a sense, the original issue is solved in getting the 0w2 to boot, but the wifi issue is a different blocker for at least my boards.

skontrolle avatar Nov 16 '21 01:11 skontrolle

@akhepcat Thanks for that, i see some things added that i had no idea how to and also some other things that would help.

@skontrolle I will try when i can. I remember seeing it catch a handshake but there are a few wifi networks around me so theres a chance it isn't actually working properly or they weren't in range. I took it on the bus with me today so i will see what or if its captured anything. Should we make a new issue with an updated title or should we just leave it here and wait for the other softwares to be updated to support this new device.

isthisausername2 avatar Nov 16 '21 01:11 isthisausername2

@isthisausername2 my initial hint that things weren't working was that the access points CH * APS 0 (0) always remained at 0. The monitor interface will come up even if it can't actually monitor.

skontrolle avatar Nov 16 '21 02:11 skontrolle

I think mine might have been saying that as well but i cant remember exactly, i will be able to check in around 2 hours and i can report back.

isthisausername2 avatar Nov 16 '21 02:11 isthisausername2