Repository navigation
fix: "no wallet key" says why $HEIMDALL_MNEMONIC did not count - #118
Merged
Merged
Conversation
…he documented commands pass it An operator with the mnemonic exported in their shell was told only "no wallet key … or $HEIMDALL_MNEMONIC" by `sudo -u heimdall heimdall register-spo`, exactly as the operator guide wrote the command: sudo clears the environment, and the packaged unit reads the variable only from /etc/default/heimdall, where systemd silently skips an `export` line. The resolver now reads the variable into three states and the error names the one it met — not set in this process (with the sudo and systemd causes and the fix for each), set but blank, or not valid UTF-8, which `var().ok()` used to fold into "unset". The guide's doctor, deploy-registry-ref and register-spo commands now pass the variable through `env`, and the package's dry-run example (default file, postinst, deploy README) uses systemd-run with the unit's EnvironmentFile so it sees the mnemonic the unit will.
rssh
force-pushed
the
fix/mnemonic-env-diagnosis
branch
from
September 25, 2026 11:59
6568887 to
afd590e
Compare
… command line, and the review's other findings The documented `sudo -u heimdall env HEIMDALL_MNEMONIC="$HEIMDALL_MNEMONIC" …`, in the guide's quick start and now in the "no wallet key" error, expands the seed phrase into sudo's argv, where sudo logs it and ps shows it for the whole run; every such command, and the three wallet-paying ones the first pass missed (the one-step register-spo and both deregister-spo steps), now use `sudo --preserve-env=HEIMDALL_MNEMONIC`, which also reports an unexported variable as unset rather than blank. The resolver's message is shortened to the process-level cause so preflight, which now points steps 4 and 11 back at step 1, and the reference-script lookup do not repeat it; EnvMnemonic's Debug is redacted and the phrase is moved rather than copied; an unreadable variable beside a key file is refused as two wallet keys. deploy/debian/default is restored byte for byte, since it is a conffile and any edit prompts every operator on upgrade, and the guide and README say an `export` line is logged by systemd with the phrase in it.
…and shell history, and no refusal over an unusable value `status` and `ensure-collateral` read the wallet but were still documented as bare `sudo -u heimdall`, the Docker route passed the phrase as `-e HEIMDALL_MNEMONIC="…"` on the command line, and the quick start's `export HEIMDALL_MNEMONIC="…"` wrote it into shell history; they now use --preserve-env, a pass-through `-e HEIMDALL_MNEMONIC`, and `read -rs`, and the guide says --preserve-env does not hide the environment from a JSON or logsrvd sudo log, where the systemd-run form (now with the unit's WorkingDirectory) passes nothing through sudo. In the code, a non-UTF-8 $HEIMDALL_MNEMONIC beside a key file is no longer refused as a second key, since like a blank one it derives no address; the unset hint names both halves of the sudo case; the phrase is held in Zeroizing and EnvMnemonic no longer derives Clone; the reference-script error puts the `_ref` alternative before the wallet's own error; and the README no longer claims /etc/default/heimdall is outside dpkg's conffiles.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An operator reported
ERROR Error: no wallet key: set cardano.payment_skey_path (with cardano.wallet_address), or cardano.mnemonic, or $HEIMDALL_MNEMONIC"even when $HEIMDALL_MNEMONIC is set". The resolver reads the variable itself, so it was not set in heimdall's process — and our guide led there: its setup blockexports the mnemonic, then ransudo -u heimdall heimdall register-spo …, and sudo clears the environment.The error says why.
$HEIMDALL_MNEMONICis read intoEnvMnemonic { Unset, Set, NotUnicode }and "no wallet key" ends with the state it met: not set in this process (sudo drops it unless run with--preserve-env=HEIMDALL_MNEMONIC; a service sees only what its unit or container passes), set but blank, or not valid UTF-8 — whichvar().ok()used to fold into "unset". The text is short and not Debian-specific, because preflight and the reference-script lookup carry it inside their own messages; preflight steps 4 and 11 now point back to step 1 instead of repeating it.EnvMnemonic'sDebugis redacted, the phrase is moved rather than copied, and an unreadable variable besidepayment_skey_pathis refused as two wallet keys instead of silently ignored.The documented commands pass it without leaking it. Every guide command that needs a mnemonic wallet — quick start,
doctor,deploy-registry-ref, allregister-spoandderegister-sposteps — usessudo --preserve-env=HEIMDALL_MNEMONIC -u heimdall heimdall …. The previousenv HEIMDALL_MNEMONIC="$HEIMDALL_MNEMONIC"form expanded the phrase into sudo's argv (sudo log,ps); the guide now says so, says key-file operators should not export the variable at all, and warns that systemd logs a skippedexport HEIMDALL_MNEMONIC=…line to the journal with the phrase in it. The package's dry run (postinst message,deploy/README.md, guide) issystemd-run -p User=heimdall -p EnvironmentFile=/etc/default/heimdall …, which reads the file with systemd's own parser.deploy/debian/defaultis left untouched: it is a conffile, and any edit would prompt every operator who put their mnemonic in it on the next upgrade.Checked on the roster box (sudo 1.9.15, systemd 255):
--preserve-envpasses the variable and keeps it out of sudo's argv, an unexported one arrives as unset, plainsudodrops it, and thesystemd-runform reads the file as theheimdalluser.