Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

preinst: bare jq + exit 1 blocks upgrades and opkg orphan-cleanup strips nodogsplash+jq on abort

Open
#814 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Amperstrand is already working on this.

Since Oct 12, 2026.

  • #901 by @Amperstrand — open

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
50/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go, shell

Research direction

Start with packaging/preinst and find the branch that runs jq to update install_time on upgrades, which is the exit 1 path. First confirm the finding still reproduces on current main, since the issue says it was not re-verified. Done means the preinst no longer aborts an upgrade over this cosmetic field, and the postinst or packaging behaviour for nodogsplash and jq is decided. An OpenWrt VM is needed to run the upgrade path.

Written by the indexing model from the issue text.

Description

Migrated from Amperstrand/tollgate-module-basic-go#93 as part of the fork retirement — OpenTollGate/tollgate-module-basic-go is the single source of truth; the fork issue carries the original discussion and any lab evidence. Retirement plan: #758.]


Found during QEMU v0.5.0→v0.6.0 upgrade emulation (PRTA campaign #113, bench in physical-router-test-automation@40d1b56 / scripts/upgrade-emulation/).

Summary

packaging/preinst hard-fails (exit 1) when it cannot update the cosmetic install_time field via bare jq — and when the upgrade aborts, opkg's orphan cleanup removes nodogsplash and jq (autoinstalled deps of the old package), leaving the captive portal broken after a "failed safe" upgrade.

Reproduction (OpenWrt 24.10.1 x86_64 VM, opkg 2024-10-16)

  1. Install v0.5.0 (deps auto-resolve: nodogsplash, jq, ...)
  2. Attempt opkg install tollgate-wrt_v0.6.0…ipk in a state where jq is absent at preinst time (in our run: a concurrent/duplicate opkg transaction's aborted cleanup had removed it):
Upgrading tollgate-wrt on root from v0.5.0 to v0.6.0-alpha2...
/tmp/opkg-XXXX/tollgate-wrt-YYYY/preinst: line 5: jq: not found
Error: Failed to update install_time using jq
Collected errors:
 * pkg_run_script: package "tollgate-wrt" preinst script returned status 1.
 * preinst_configure: Aborting installation of tollgate-wrt.
...
nodogsplash was autoinstalled and is now orphaned, removing.
jq was autoinstalled and is now orphaned, removing.
  1. Result: still v0.5.0, portal (nodogsplash) gone, jq gone.

Facts pinned by forensics

  • Maintainer-script env probe (repacked ipk with env-logging preinst): opkg passes the caller's env through; PATH=/usr/sbin:/usr/bin:/sbin:/bin, and with jq present it IS found — the abort requires jq to actually be missing at that moment (any failed earlier transaction's orphan cleanup produces exactly that state).
  • The initial install never hits the jq path (fresh /etc/tollgate/install.json is created by the echo ELSE-branch, no jq) — only upgrades with existing install.json run the jq branch.
  • With jq present, the identical artifact upgrades cleanly (verified end-to-end: config/wallet/identities sha-preserved, payments work).

Recommended fix (two independent layers)

  1. preinst should never exit 1 for an install_time cosmetic — warn and continue (exit 0).
  2. Don't rely on bare jq: use /usr/bin/jq absolute path, or replace with a BusyBox-only JSON write (the field is a single integer; sed/awk suffices), or drop preinst entirely and let the binary own install_time.

Optional hardening: postinst could opkg-flag have_installed nodogsplash jq (or list them in a metapackage) so aborted transactions can't orphan the portal.

Evidence

  • physical-router-test-automation/results/upgrade-emulation/ (local, not in git): install/upgrade logs, preinst env capture, sha snapshots across upgrade→rollback→upgrade.

Migrated 2026-10-09. Applicability to current upstream main (4614ac2, post-rc1) was not re-verified during migration — confirming whether the finding still reproduces upstream is this issue's first task.

Dominant language
Go
Stars
12
Forks
14
Avg merge
1d 6h
Merged PRs (30d)
234

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenTollGate/tollgate-module-basic-go

All issues in OpenTollGate/tollgate-module-basic-go

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.