No wifi connection on Raspberry Pi Zero 2W

Hi folks. I just got my hands on a pi zero 2W and decided to have a play with nerves on it. I ran mix nerves.new, enabled the nerves_system_rpi_0_2, statically configured a wifi SSID and wrote the SD card with mix firmware.burn. I wanted to validate that my dev env was set up correctly and working.

I configured the network thusly:

config :vintage_net,
  regulatory_domain: "NZ",
  internet_host_list: [{"harton.dev", 443}],
  config: [
    {"usb0", %{type: VintageNetDirect}},
    {"eth0",
     %{
       type: VintageNetEthernet,
       ipv4: %{method: :dhcp}
     }},
    {"wlan0",
     %{
       type: VintageNetWiFi,
       vintage_net_wifi: %{
         networks: [
           %{
             key_mgmt: :wpa_psk,
             ssid: System.fetch_env!("DEFAULT_WIFI_SSID"),
             psk: System.fetch_env!("DEFAULT_WIFI_PSK")
           }
         ]
       },
       ipv4: %{method: :dhcp}
     }}
  ]

As far as I understand it, VintageNet will automatically start and connect without any further configuration, right? Looking at the logs in the UniFi console it doesn’t even appear to be trying to connect.

The actual code (such as it is) is available here.

I’m using MIX_TARGET=rpi0_2 and setting the DEFAULT_WIFI_SSID and DEFAULT_WIFI_PSK with an environment variable at build time.

Pointers appreciated.

1 Like

Well this explains much. It’s not even booting. I connected a serial cable and this is what I see:

[    7.218363] watchdog: watchdog0: watchdog did not stop!
[    8.237418] reboot: Restarting system
[    0.448748] EXT4-fs (mmcblk0p3): VFS: Can't find ext4 filesystem
1 Like

Okay, so I built and flashed an rpi0 image to an older Zero W I had sitting on my desk and it booted and connected to the wifi fine, so it’s not a problem with the app config, it’s definitely the rpi0_2 nerves system not booting :sob:

1 Like

I managed to get it to boot with the rpi3a nerves system, so I guess I’m unblocked for now.

3 Likes

Well I don’t think I have much helpful info for you. I tried the linked repo without modifications and was able to burn a new firmware and update an existing using MIX_TARGET=rpi0_2

One thing to not is the EXT4-fs (mmcblk0p3): VFS: Can't find ext4 filesystem is fairly normal for the first time boot. The /data partition is not formatted until the first boot and it gets formatted shortly after. So there might be other clues in the startup logs

And this might be a silly question, but you’re absolutely positive it is a zero 2W? (Not just a zero W). The main difference between rpi3a and rpi0_2 is the latter is 64bit, but I’m not sure what else might be causing your device to fail booting

mix upload

mix burn

1 Like

Thanks for trying. I’ll reconnect the serial console and try flashing and booting a rpi0_2 image again and get back to you.

Okay, so here’s the output. First I booted it with the rpi3a image and ran dmesg to get the output:

Erlang/OTP 26 [erts-14.2.3] [source] [32-bit] [smp:4:4] [ds:4:4:10] [async-threads:1]

Interactive Elixir (1.16.2) - press Ctrl+C to exit (type h() ENTER for help)
████▄▄    ▐███
█▌  ▀▀██▄▄  ▐█
█▌  ▄▄  ▀▀  ▐█   N  E  R  V  E  S
█▌  ▀▀██▄▄  ▐█
███▌    ▀▀████
podbox 0.1.0 (3254317d-d000-5190-75ee-c061980a6157) arm rpi3a
  Serial       : 1431
  Uptime       : 4.392 seconds
  Clock        : 2024-04-25 20:38:54 UTC (unsynchronized)
  Temperature  : 35.4°C

  Firmware     : Valid (B)               Applications : 44 started
  Memory usage : 54 MB (17%)             Part usage   : 0 MB (0%)
  Hostname     : nerves-1431             Load average : 0.24 0.05 0.02


Nerves CLI help: https://hexdocs.pm/nerves/iex-with-nerves.html

Toolshed imported. Run h(Toolshed) for more info.
iex(1)> dmesg
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 6.1.73 (buildroot@buildroot) (armv7-nerves-linux-gnueabihf-gcc (crosstool-NG UNKNOWN) 13.2.0, GNU ld (crosstool-NG UNKNOWN) 2.40) #1 SMP PREEMPT Mon Apr  1 00:53:05 UTC 2024
[    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 W Rev 1.0
[    0.000000] random: crng init done
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] Reserved memory: created CMA memory pool at 0x0fc00000, size 64 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000000000000-0x0000000013ffffff]
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000013ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000013ffffff]
[    0.000000] percpu: Embedded 15 pages/cpu s32404 r8192 d20844 u61440
[    0.000000] pcpu-alloc: s32404 r8192 d20844 u61440 alloc=15*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 81200
[    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_headphones=0 snd_bcm2835.enable_hdmi=1 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 smsc95xx.macaddr=B8:27:EB:12:14:31 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000  root=/dev/mmcblk0p2 rootwait console=ttyAMA0,115200 quiet
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] mem auto-init: stack:all(zero), heap alloc:off, heap free:off
[    0.000000] Memory: 245808K/327680K available (7168K kernel code, 880K rwdata, 1260K rodata, 1024K init, 394K bss, 16336K reserved, 65536K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] trace event string verifier disabled
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu: 	RCU event tracing is enabled.
[    0.000000] 	Trampoline variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000000] arch_timer: cp15 timer(s) running at 19.20MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
[    0.000001] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
[    0.000018] Switching to timer-based delay loop, resolution 52ns
[    0.000385] Console: colour dummy device 80x30
[    0.000435] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
[    0.000453] CPU: Testing write buffer coherency: ok
[    0.000495] pid_max: default: 32768 minimum: 301
[    0.000749] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000766] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.001779] cgroup: Disabling memory control group subsystem
[    0.002262] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.002889] cblist_init_generic: Setting adjustable number of callback queues.
[    0.002897] cblist_init_generic: Setting shift to 2 and lim to 1.
[    0.003010] Setting up static identity map for 0x100000 - 0x10003c
[    0.003126] rcu: Hierarchical SRCU implementation.
[    0.003132] rcu: 	Max phase no-delay instances is 1000.
[    0.003583] smp: Bringing up secondary CPUs ...
[    0.004320] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.005123] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.005837] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.005925] smp: Brought up 1 node, 4 CPUs
[    0.005937] SMP: Total of 4 processors activated (153.60 BogoMIPS).
[    0.005947] CPU: All CPU(s) started in HYP mode.
[    0.005951] CPU: Virtualization extensions available.
[    0.006560] devtmpfs: initialized
[    0.018957] VFP support v0.3: implementor 41 architecture 3 part 40 variant 3 rev 4
[    0.019132] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.019157] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.021715] pinctrl core: initialized pinctrl subsystem
[    0.022679] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.024914] DMA: preallocated 1024 KiB pool for atomic coherent allocations
[    0.029887] thermal_sys: Registered thermal governor 'step_wise'
[    0.030185] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.030196] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.030420] Serial: AMBA PL011 UART driver
[    0.031034] ramoops: uncorrectable error in header
[    0.031185] ramoops: uncorrectable error in header
[    0.031332] ramoops: uncorrectable error in header
[    0.031479] ramoops: uncorrectable error in header
[    0.031626] ramoops: uncorrectable error in header
[    0.031778] ramoops: uncorrectable error in header
[    0.031923] ramoops: uncorrectable error in header
[    0.032067] ramoops: uncorrectable error in header
[    0.032303] printk: console [ramoops-1] enabled
[    0.032503] pstore: Registered ramoops as persistent store backend
[    0.032513] ramoops: using 0x100000@0xb000000, ecc: 16
[    0.038664] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[    0.060042] raspberrypi-firmware soc:firmware: Attached to firmware from 2023-10-17T15:43:26, variant start_x
[    0.070048] raspberrypi-firmware soc:firmware: Firmware hash is 30f0c5e4d076da3ab4f341d88e7d505760b93ad7
[    0.095629] bcm2835-dma 3f007000.dma: DMA legacy API manager, dmachans=0x1
[    0.096924] usb_phy_generic phy: supply vcc not found, using dummy regulator
[    0.097214] pps_core: LinuxPPS API ver. 1 registered
[    0.097224] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.097248] PTP clock support registered
[    0.098661] clocksource: Switched to clocksource arch_sys_counter
[    0.106757] NET: Registered PF_INET protocol family
[    0.106970] IP idents hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.108307] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.108341] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.108414] TCP established hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    0.108486] TCP bind hash table entries: 4096 (order: 4, 65536 bytes, linear)
[    0.108685] TCP: Hash tables configured (established 4096 bind 4096)
[    0.108788] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.108823] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.108995] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.109794] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 7 counters available
[    0.110960] Initialise system trusted keyrings
[    0.111139] workingset: timestamp_bits=14 max_order=17 bucket_order=3
[    0.120115] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.120594] Key type asymmetric registered
[    0.120607] Asymmetric key parser 'x509' registered
[    0.123022] bcm2708_fb soc:fb: FB found 1 display(s)
[    0.129101] Console: switching to colour frame buffer device 82x26
[    0.132635] bcm2708_fb soc:fb: Registered framebuffer for display 0, size 656x416
[    0.135422] Serial: 8250/16550 driver, 1 ports, IRQ sharing enabled
[    0.136617] bcm2835-rng 3f104000.rng: hwrng registered
[    0.136890] vc-mem: phys_addr:0x00000000 mem_base=0x1ec00000 mem_size:0x20000000(512 MiB)
[    0.145454] brd: module loaded
[    0.149959] loop: module loaded
[    0.150640] UDC core: g_ether: couldn't find an available UDC
[    0.150666] i2c_dev: i2c /dev entries driver
[    0.152194] sdhci: Secure Digital Host Controller Interface driver
[    0.152205] sdhci: Copyright(c) Pierre Ossman
[    0.152400] sdhci-pltfm: SDHCI platform and OF driver helper
[    0.153209] ledtrig-cpu: registered to indicate activity on CPUs
[    0.153392] bcm2835_vchiq 3f00b840.mailbox: there is not valid maps for state default
[    0.157721] NET: Registered PF_INET6 protocol family
[    0.158978] Segment Routing with IPv6
[    0.159019] In-situ OAM (IOAM) with IPv6
[    0.159132] NET: Registered PF_PACKET protocol family
[    0.159254] Registering SWP/SWPB emulation handler
[    0.159404] Loading compiled-in X.509 certificates
[    0.160020] pstore: Using crash dump compression: deflate
[    0.164464] 3f215040.serial: ttyS0 at MMIO 0x3f215040 (irq = 86, base_baud = 31250000) is a 16550
[    0.165387] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[    0.165653] bcm2835-power bcm2835-power: Broadcom BCM2835 power domains driver
[    0.169309] mmc-bcm2835 3f300000.mmcnr: mmc_debug:0 mmc_debug2:0
[    0.169337] mmc-bcm2835 3f300000.mmcnr: DMA channel allocated
[    0.197668] sdhost: log_buf @ e78d2a9a (cfd10000)
[    0.248558] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[    0.249123] uart-pl011 3f201000.serial: there is not valid maps for state default
[    0.250114] uart-pl011 3f201000.serial: cts_event_workaround enabled
[    0.250227] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 114, base_baud = 0) is a PL011 rev2
[    0.250690] printk: console [ttyAMA0] enabled
[    0.251155] of_cfs_init
[    0.251195] of_cfs_init: OK
[    0.252023] uart-pl011 3f201000.serial: no DMA platform data
[    0.252125] Waiting for root device /dev/mmcblk0p2...
[    0.308287] mmc1: new high speed SDIO card at address 0001
[    0.312139] mmc0: host does not support reading read-only switch, assuming write-enable
[    0.316204] mmc0: new high speed SDHC card at address aaaa
[    0.316845] mmcblk0: mmc0:aaaa SC16G 14.8 GiB
[    0.319344]  mmcblk0: p1 p2 p3
[    0.319917] mmcblk0: mmc0:aaaa SC16G 14.8 GiB (quirks 0x00004000)
[    0.345023] VFS: Mounted root (squashfs filesystem) readonly on device 179:2.
[    0.346848] devtmpfs: mounted
[    0.348633] Freeing unused kernel image (initmem) memory: 1024K
[    0.379020] Run /sbin/init as init process
[    0.379032]   with arguments:
[    0.379040]     /sbin/init
[    0.379048]   with environment:
[    0.379055]     HOME=/
[    0.379062]     TERM=linux
[    0.677961] EXT4-fs (mmcblk0p3): recovery complete
[    0.679677] EXT4-fs (mmcblk0p3): mounted filesystem with ordered data mode. Quota mode: disabled.
[    5.089952] mc: Linux media interface: v0.10
[    5.112891] videodev: Linux video capture interface: v2.00
[    5.130724] vc_sm_cma: module is from the staging directory, the quality is unknown, you have been warned.
[    5.131996] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
[    5.132021] [vc_sm_connected_init]: start
[    5.132572] [vc_sm_connected_init]: installed successfully
[    5.133163] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    5.148556] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[    5.485568] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
[    5.491743] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[    5.491788] bcm2835-codec bcm2835-codec: Loaded V4L2 decode
[    5.494559] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[    5.494651] bcm2835-codec bcm2835-codec: Loaded V4L2 encode
[    5.498188] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
[    5.498236] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
[    5.501016] bcm2835-codec bcm2835-codec: Device registered as /dev/video18
[    5.501056] bcm2835-codec bcm2835-codec: Loaded V4L2 image_fx
[    5.503470] bcm2835-codec bcm2835-codec: Device registered as /dev/video31
[    5.503506] bcm2835-codec bcm2835-codec: Loaded V4L2 encode_image
[    5.508755] bcm2835_isp: module is from the staging directory, the quality is unknown, you have been warned.
[    5.513109] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video13
[    5.513415] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video14
[    5.513674] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video15
[    5.513833] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video16
[    5.513852] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[    5.513865] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[    5.513875] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[    5.513885] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[    5.517913] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video20
[    5.518958] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video21
[    5.519273] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video22
[    5.519468] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video23
[    5.519492] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[    5.519505] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[    5.519515] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[    5.519524] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[    5.519644] bcm2835-isp bcm2835-isp: Loaded V4L2 bcm2835-isp
[    5.552104] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
[    5.573077] rpi-gpiomem 3f200000.gpiomem: window base 0x3f200000 size 0x00001000
[    5.573287] rpi-gpiomem 3f200000.gpiomem: initialised 1 regions as /dev/gpiomem
[    5.654753] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    5.687324] cfg80211: Loaded X.509 cert 'benh@debian.org: 577e021cb980e0e820821ba7b54b4961b8b4fadf'
[    5.689000] cfg80211: Loaded X.509 cert 'romain.perier@gmail.com: 3abbc6ec146e09d1b6016ab9d6cf71dd233f0328'
[    5.690588] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    5.692131] cfg80211: Loaded X.509 cert 'wens: 61c038651aabdcf94bd0ac7ff06c7248db18c600'
[    5.724002] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[    5.877323] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Jun 14 2023 07:27:45 version 7.45.96.s1 (gf031a129) FWID 01-70bd2af7 es7
[    5.946004] brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled
[    6.275044] dwc2 3f980000.usb: supply vusb_d not found, using dummy regulator
[    6.275198] dwc2 3f980000.usb: supply vusb_a not found, using dummy regulator
[    6.275320] dwc2 3f980000.usb: Configuration mismatch. dr_mode forced to device
[    6.378900] dwc2 3f980000.usb: EPs: 8, dedicated fifos, 4080 entries in SPRAM
[    6.379276] using random self ethernet address
[    6.379288] using random host ethernet address
[    6.379944] usb0: HOST MAC 0e:a4:cb:c5:c4:b8
[    6.379957] usb0: MAC be:8d:66:55:e1:cf
[    6.379985] using random self ethernet address
[    6.379995] using random host ethernet address
[    6.380063] g_ether gadget.0: Ethernet Gadget, version: Memorial Day 2008
[    6.380076] g_ether gadget.0: g_ether ready
[    6.380280] dwc2 3f980000.usb: bound driver g_ether
[    6.394552] input: raspberrypi-ts as /devices/platform/soc/soc:firmware/soc:firmware:touchscreen/input/input0
[   14.001643] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

Next I powered off, inserted a freshly built rpi0_2 image and tried to boot, but it just keeps looping:

[    0.447607] EXT4-fs (mmcblk0p3): VFS: Can't find ext4 filesystem

[nbtty: terminating]
[    7.401303] watchdog: watchdog0: watchdog did not stop!
[    8.419464] reboot: Restarting system
[    0.450784] EXT4-fs (mmcblk0p3): VFS: Can't find ext4 filesystem

[nbtty: terminating]
[    7.385337] watchdog: watchdog0: watchdog did not stop!
[    8.404416] reboot: Restarting system
[    0.451754] EXT4-fs (mmcblk0p3): VFS: Can't find ext4 filesystem

[nbtty: terminating]
[    7.347273] watchdog: watchdog0: watchdog did not stop!
[    8.362453] reboot: Restarting system
[    0.450839] EXT4-fs (mmcblk0p3): VFS: Can't find ext4 filesystem

And just for your gratification, here’s a photo proving that it is indeed a RPi Zero 2. The device underneath is a UPS-Lite V1.2 which contains an I2C connected MAX17040 and a connection to GPIO4.

Did you ever work this out?

I want to make a thread about the Raspberry Pi Zero 2W collecting all the lessons and experiences everybody has with this device. Maybe even add docs for it to the system upstream.

Issue

It seems like there are a lot of pitfalls when it comes to getting started on this particular Raspberry Pi, and I am experiencing similar things to what you describe here. However, I cannot confirm one way or another what it is actually getting stuck on.

I rely on it managing to establish a USB connection in order to access it, as it cannot connect to WiFi either, unless the USB connection is also there. So, it’s this all or nothing thing going on.

Since I cannot access it, and it does not look like HDMI is configured on the Nerves System RPi0 2 @ GitHub, or at least it does not work for me, I cannot debug it in any meaningful way. The LED flashes green once in a while indicating a reboot loop. It gets warm, also indicating some kind of activity, but it eventually just stops flashing. I guess that either it dies or starts to idle, not producing noticeably/any heat.

Every now and then though, it does “stabilise”, allowing me to connect over the USB. The last time it did I tried to build a firmware update that added the RamoopsLogger in an attempt to see if it could reveal anything from a previous boot attempt, but I haven’t even been able to upload it, as it died when I ran mix upload <HOST-NAME>, like this:

❯ mix upload my-app-0.local
==> nerves
==> my_app

Nerves environment
  MIX_TARGET:   rpi0_2
  MIX_ENV:      dev

Path: /.../_build/rpi0_2_dev/nerves/images/my_app.fw
UUID: 73b5d72e-435d-55ae-1cc6-81f00431bd0a


Uploading to my-app-0.local...

fwup: Upgrading partition B
  3% [=                                   ] 983.04 KB in / 1.67 MB outConnection to my-app-0.local closed by remote host.
** (Mix) Unexpected exit from ssh (:epipe)

This is known to happen when ssh interactively prompts you for a
passphrase. The following are workarounds:

1. Make sure host key verification works for the hostname
   (try `ssh hostname`). This would apply when connecting to
   the device for the first time or for the first time after
   a fresh firmware was burned.

2. Load your private key identity into the ssh agent by running
   `ssh-add`

3. Use the `upload.sh` script. Create one by running
   `mix firmware.gen.script`.

Troubleshooting

Below is a non-exhaustive list of things I have tried, or planning to try.

Nerves Systems

I’ve tried the Nerves system for the RPi0 2W @ GitHub, but I will see if the one for the RPi3a+ behaves similarly.

I forked the RPi0 2W system, as I mean to adapt the image for the use-case, but as of now it does not differ much. I have only added the iw package and experimented with settings when trying figure this out. The last attempts has been with the official RPi0 2W system.

SD-cards

I have tried the following SD-cards:

  • Samsung Pro 64
  • Samsung Evo 64
  • SanDisk Ultra 16

I also have this one, though I haven’t tried it with this device:

  • SanDisk Extreme 64

While the Samsung ones probably push 10 years old at this point, they seem to work just fine when used before and with my Raspberry Pi 4B, so I do not think it is a matter of a faulty SD-card.

Cables

I have tried more than 5 different micro-USB cables. I have also tried various USB-C cables with adapters. No difference in stability. It does not work to have a separate power supply either, as I tried various ones, including one official Raspberry Pi one with a micro-USB connector.

WiFi

Two different WiFi-networks, same rate of connection success as when the USB connection stabilises.

Raspbian

I flashed the latest Raspbian on one of the SD-cards, and that boots. It starts the whole install/setup-process, so the device seems to behave well, but I have not attempted to pair a keyboard or mouse with it to go through the rest of the setup. If I need to do that to do some debugging that Raspbian can provide, I could try.

So I just ran into this problem again with a Pi 0 2W and discovered that it was running out of RAM on boot. If your project is contains a lot of dependencies then you want to switch off the emulators embedded mode in your vm.args.eex. This will cause slower boots but it will actually boot without running out of RAM.

2 Likes

If your project is contains a lot of dependencies then you want to switch off the emulators embedded mode in your vm.args.eex .

Interesting! I had wondered whether or not the RAM usage would be something to optimise for later, as I can see that it lands around 250 MB, the few times that I could connect to it.

Branching in vm.args.eex

Is it possible to branch in this config file? I suppose one way could be Eex, as it is an .eex file, but would it also be possible to provide different files completely for different targets?

I have to intended hardware targets for the same Elixir Application, the RPi4B and the RPiZ2W.

The first will act like a server and is based on the Kiosk System RPi4, and the latter a more optimised RPiZ2W image as described earlier.

For more clarity I’d want to have separate files for them, rather than put code in it, though I will do that for now to test and see if I can get it working.

Another option would be that I have another repo/Elixir app for the Kiosk version of the app, but if possible I’d prefer to keep it in one repo and just configure two different releases, to keep testing and CI simpler.

This seems to have done it, as far as I can see! I still need to do some more testing, but it booted instantly (compared to me previous experience where it took an eternity :joy:) and so far it is possible to work with the device reliably now!

1 Like