Wallet never initializes on jffs2-overlay devices (squashfs NOR targets): bbolt requires shared mmap; silent degraded mode + misleading "no reachable mints"
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 38/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- go
- 領域
- backend, embedded-iot
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Go
- スター
- 12
- フォーク
- 14
- 平均マージ
- 1日 6時間
- マージ済み PR(30日)
- 217
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
OpenTollGate/tollgate-module-basic-go のほかの issue
-
go-battery needs an ndsctl on PATH: TestPurchaseSessionGuardHoldsThroughTheOutcomeUnknownWindow fails on bare hosts (passes with stub)対応中かも @Amperstrand が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OpenTollGate/tollgate-module-basic-go#726 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
rebrand-literal-gutter: uhttpd section-vocabulary check trips on a COMMENT (uhttpd.luci in 92-tollgate-admin-setup:178)対応中かも @Amperstrand が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OpenTollGate/tollgate-module-basic-go#723 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
OpenTollGate/tollgate-module-basic-go#768 ·
メンテナーはふだん 1 日以内に返信
-
Four drift fences for tests/contract/ (+ test.yml clean-container lane + pre-commit wiring)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
OpenTollGate/tollgate-module-basic-go#767 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
OpenTollGate/tollgate-module-basic-go#763 ·
メンテナーはふだん 1 日以内に返信
OpenTollGate/tollgate-module-basic-go の issue をすべて見る
似ている issue
-
Discriminator mapping keys are listed in a random order対応中かも @reuvenharrison が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Idle compaction monitors LIST the replica every tick when the newest destination file spans more than one TXID対応中かも @pishuv が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
benbjohnson/litestream#1563 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
agent-research agent-review-finding chore
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
jordansmall/spindrift#4922 ·
メンテナーはふだん 1 日以内に返信
-
gcsartifact: deleting a missing version returns an error対応中かも @ktsoator が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信