Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#583 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@Amperstrand がすでに取り組んでいます。

2026年10月7日 から。

  • #741 @Amperstrand による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
go

調査の方向性

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 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.

主要言語
Go
スター
12
フォーク
14
平均マージ
1日 6時間
マージ済み PR(30日)
217

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OpenTollGate/tollgate-module-basic-go のほかの issue

OpenTollGate/tollgate-module-basic-go の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。