Wallet never initializes on jffs2-overlay devices (squashfs NOR targets): bbolt requires shared mmap; silent degraded mode + misleading "no reachable mints"
I maintainer di solito rispondono entro 1 giorno
@Amperstrand ci sta già lavorando.
Dal 11/10/2026.
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
- Ambito
- backend, embedded-iot
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 argumenton 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)
- Keep the wallet on an mmap-capable filesystem: a small ext4 image mounted via
losetup, with/etc/tollgate/wallet.dbsymlinked into it (bolt follows symlinks; the mmap then lands on the ext4 inode). Persistent across boots; needskmod-loopand a boot-time mount. - Symlink
wallet.dbinto tmpfs — works instantly but loses funds on reboot (contradicts the fund-safety invariants, only acceptable for throwaway test money).
Suggested directions
- Document the storage requirement (needs a shared-mmap-capable overlay: ext4/f2fs/ubifs; not jffs2) in README/operator-guide.
- Fail loudly and specifically: detect
InitStorageEINVAL-class failures and surface "wallet storage filesystem does not support shared mmap (jffs2)" at startup instead of the generic degraded-mode banner and the misleadingno reachable mintsat fund time. - Long-term: a storage engine without a shared-mmap requirement — which is already the documented CDK-migration direction (the
cdk_walletlane uses a*.sqlitedatabase; 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
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di OpenTollGate/tollgate-module-basic-go
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OpenTollGate/tollgate-module-basic-go#1027 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
OpenTollGate/tollgate-module-basic-go#1026 ·
I maintainer di solito rispondono entro 1 giorno
-
Session event emits the customer's MAC address in the p tag — spec-invalid value on every payment responseForse già presa @Amperstrand l’ha presa 6 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
OpenTollGate/tollgate-module-basic-go#949 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
OpenTollGate/tollgate-module-basic-go#833 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
OpenTollGate/tollgate-module-basic-go#813 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di OpenTollGate/tollgate-module-basic-go
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
Mend: dependency security vulnerability
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
kube-tarian/sigrun#202 ·
-
good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
eugenioenko/ttt#1085 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
fullsend-ai/fullsend#8688 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
question raised-by:verifier
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
medici-finance/assay#4013 ·
I maintainer di solito rispondono entro 1 giorno