Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Wallet never initializes on jffs2-overlay devices (squashfs NOR targets): bbolt requires shared mmap; silent degraded mode + misleading "no reachable mints"

Aperta
#583 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Amperstrand ci sta già lavorando.

Dal 11/10/2026.

  • #741 di @Amperstrand — chiusa senza merge
  • #869 di @Amperstrand — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go

Direzione di ricerca

First clarify which suggested direction is in scope: documenting the filesystem requirement, reporting storage failures clearly, or changing the storage engine. For the documentation option, start with the README or operator guide; for the runtime options, trace wallet initialization and the degraded-mode and funding error paths, then run the relevant tests. Done should mean the chosen scope is addressed without conflating a storage failure with unreachable mints.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

The wallet cannot initialize on any OpenWrt device whose overlay lives on jffs2 (squashfs-combo NOR-flash targets: ipq40xx, ath79, ramips mt76x8 class). bbolt requires a shared mmap of its database file; jffs2 has never supported shared mappings, so bolt.Open fails with EINVAL. The failure is silent at every level short of the wallet: the service boots, writes config, serves :2121, drives nodogsplash, broadcasts SSIDs — then the merchant runs in degraded mode forever, and the first wallet operation reports a misleading "wallet not initialized: no reachable mints" even while every configured mint probes 200 OK.

Observed on

  • Package: tollgate-wrt v0.6.0-alpha4 (.ipk)
  • Device: Extreme Networks WS-AP3915i (ipq40xx/generic, arm_cortex-a7_neon-vfpv4)
  • Firmware: OpenWrt 24.10.8 r29233 (stock squashfs sysupgrade)
  • Filesystem: /dev/mtdblock10 on /overlay type jffs2; / = overlayfs over it

Symptoms

Everything except the wallet works (config manager wrote config.json v0.0.8, HTTP server on :2121, CLI socket, guest SSID up, nodogsplash running, mints probed ok=true):

mint probe: url=http://192.168.105.2:8383/v1/keysets status=200 keysets=1 ok=true
Degraded mode: offline wallet load failed (first boot or no cached data): failed to create wallet: InitStorage: error setting bolt db: invalid argument
WARN Merchant started in degraded mode — wallet will initialize when a mint becomes reachable
...
ERRO Failed to fund wallet via merchant  error="wallet not initialized: no reachable mints"

/etc/tollgate/wallet.db is even created (16 KiB) — the file opens, the mmap fails, so every subsequent boot repeats the cycle.

Root cause

bbolt's I/O layer maps the db with mmap(PROT_READ|PROT_WRITE, MAP_SHARED) — the B+tree pages are the shared page cache; this is core to its design and the upstream maintainers consider jffs2 support out of scope:

  • etcd-io/bbolt#258 — bbolt on OpenWrt (mipsel_24kc), identical invalid argument on open
  • boltdb/bolt#592 — jffs2 reproducer: MAP_SHARED → EINVAL, MAP_PRIVATE → works; maintainer: "The mmap is pretty core to Bolt's implementation"
  • boltdb/bolt#272 — strace of the exact failing call: mmap(NULL, 32768, PROT_READ, MAP_SHARED, 3, 0) = -1 EINVAL
  • Historical precedent: BerkeleyDB/rpmdb on jffs2, same mmap: Invalid argument

jffs2 (log-structured, compressed, erase-block-aligned raw NOR flash) cannot provide page-cache-coherent shared mappings — only private (COW) mappings.

Blast radius

Affected: every squashfs + jffs2-overlay target class — including the mips_24kc / mipsle lanes in the release matrix (ath79/ramips small-flash NOR devices are exactly this layout).

Not affected: mediatek-filogic (NAND + UBI; overlay is ubifs/f2fs — both mmap-capable; verified on GL-MT3000 boot log: ubi0: attached mtd6, squashfs root on ubiblock), bcm27xx (ext4 on SD), x86 (ext4).

The trap is that the affected devices pass every smoke-level check — config, portal, gating, SSID — so the gap is invisible until the first wallet-touching operation (fund/receive/payout).

Workarounds (device-side, no code change)

  1. Keep the wallet on an mmap-capable filesystem: a small ext4 image mounted via losetup, with /etc/tollgate/wallet.db symlinked into it (bolt follows symlinks; the mmap then lands on the ext4 inode). Persistent across boots; needs kmod-loop and a boot-time mount.
  2. Symlink wallet.db into tmpfs — works instantly but loses funds on reboot (contradicts the fund-safety invariants, only acceptable for throwaway test money).

Suggested directions

  1. Document the storage requirement (needs a shared-mmap-capable overlay: ext4/f2fs/ubifs; not jffs2) in README/operator-guide.
  2. Fail loudly and specifically: detect InitStorage EINVAL-class failures and surface "wallet storage filesystem does not support shared mmap (jffs2)" at startup instead of the generic degraded-mode banner and the misleading no reachable mints at fund time.
  3. Long-term: a storage engine without a shared-mmap requirement — which is already the documented CDK-migration direction (the cdk_wallet lane uses a *.sqlite database; sqlite has no MAP_SHARED dependency).

Happy to provide the ext4-loop bring-up script and boot logs from the AP3915i if useful.

Lingua principale
Go
Stelle
12
Fork
14
Merge medio
1g 5h
PR unite (30g)
228

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenTollGate/tollgate-module-basic-go

Tutte le issue di OpenTollGate/tollgate-module-basic-go

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.