Repository navigation
os image: the two bugs that stopped it booting on real hardware (PID 1 panic, 20s mount window) - #516
Closed
bong-water-water-bong wants to merge 4 commits into
Closed
bong-water-water-bong wants to merge 4 commits into
bong-water-water-bong wants to merge 4 commits into
Conversation
added 2 commits
October 22, 2026 12:49
1bit OS already ran entirely from RAM and never mounted an internal disk, but nothing said so on screen, and there was no way to prove the engine answers from a given boot without hand-typing a wget. Both are now part of the image. init.sh prints a LIVE banner (RAM only, nothing installed, internal disks never mounted), drops /etc/1bit/live, and points at the new command. 1bit-selftest (os/mini/selftest.sh, installed as /bin/1bit-selftest) reports mode, kernel, GPU/NPU devices, NPU firmware, the USB4/Thunderbolt module, the model list from Lemonade, then asks the local lemond one question and prints the answer and decode rate, appending everything to /data/selftest.log so the evidence outlives the live boot. It exits non-zero on failure, so it works in a script or in CI's 1bit.check path. Verified by booting the signed image in QEMU and reading the graphical console: the banner is on screen and 1bit-selftest reports PASS - model Qwen3-0.6B-Q4_K_M, answer "NPU OK", decode ~125 tok/s (CPU/llamacpp: a VM has no NPU). Two defects it caught in itself are fixed here: a stray "/d" line left by an earlier sed whose pattern contained n/a, and a model-id parse that silently returned ""; the parse now tries id then model_name and fails loudly when no model is present.
It boots now, on strixhalo, from the USB stick: menu on screen, /data mounted, dropbear
up with the baked key, Lemonade serving, and 1bit-selftest reporting PASS.
Bug 1 - PID 1 exited, so the kernel panicked. init.sh ended with `exec setsid cttyhack sh`;
on real hardware nothing attaches to that tty, the shell exits, and the kernel does exactly
what it must when init dies: "Kernel panic - not syncing: Attempted to kill init!
exitcode=0x00000000 PID: 1 Comm: sh", Kernel Offset banner, reboot. That panic was the
whole "hangs before userspace" story. The console shell is now a background job and init
ends in `while :; do sleep 3600; done`, so PID 1 can never exit.
Bug 2 - the data partition was never mounted: init waited 20 s for LABEL=1BIT-DATA, but this
machine only presents the USB 2.0 stick at t=46.4 s ("sd 1:0:0:0: [sda]" in the box log), so
the window always expired. No /data meant no keys, no dropbear, no boot.log - which is why
every earlier attempt looked like a silent pre-userspace hang. The wait is 90 s now, with
progress lines at t=30 and t=60.
Also in here, found on the way: the wired NIC's PHY driver (realtek) missing from the
initramfs, which failed r8169 with -49 ("no dedicated PHY driver found for PHY ID
0x001cc840") and left the machine with no network; the USB4/Thunderbolt and Typec modules
were in the image but nothing loaded them; amdgpu/amdxdna are no longer loaded at boot; the
live-mode menu and numbered progress; 1bit-selftest; and a diagnostic stub init plus a
hugepage-friendly panic=600 so a failure holds on screen instead of rebooting in 10 s.
Verified on strixhalo from the stick: boot.log shows "stick mounted at /dev/sda2", the
console menu renders, SSH works with the baked key, and 1bit-selftest answers "NPU OK" at
169-171 tok/s. Note what that number is: the GPU/NPU drivers are deliberately not loaded, so
that is Lemonade's CPU llamacpp backend. Asking the engine for the NPU route from the image
resets the machine - the stock amdxdna does not match the private 1bit build, and that is
the next thing to fix, not this.
PR Reviewer Guide 🔍(Review updated until commit 86f3165)Here are some key observations to aid the review process:
|
bong-water-water-bong
pushed a commit
that referenced
this pull request
Oct 23, 2026
…ry the licence header The auditor's point is fair: the done criterion says the self-test must report the NPU placement, and it only ever asked Lemonade for a GGUF (CPU llamacpp). 1bit-selftest now finds a .q4nx model directory (/data/models/*/ or /tmp/npu2, since --device npu correctly refuses a .gguf), starts the engine on the NPU route with the sealed sets beside it, asks one question, and records the answer, the rate and the "on the private route dx" placement line in /data/selftest.log - the evidence outliving the live boot. It also no longer bails out before that section when the Lemonade chat fails, and prefers a servable model for the Lemonade check instead of a "<name>-1bit" entry that needs a GPU/NPU backend. Both new scripts also get the Apache-2.0 header every other file in os/mini carries: the CI "Copyright notice on every file" step was failing #516 and #517 on exactly these two files. Verified by running it on the booted stick (see the PR for the log).
…ry the licence header The auditor's point is fair: the done criterion says the self-test must report the NPU placement, and it only ever asked Lemonade for a GGUF (CPU llamacpp). 1bit-selftest now finds a .q4nx model directory (/data/models/*/ or /tmp/npu2, since --device npu correctly refuses a .gguf), starts the engine on the NPU route with the sealed sets beside it, asks one question, and records the answer, the rate and the "on the private route dx" placement line in /data/selftest.log - the evidence outliving the live boot. It also no longer bails out before that section when the Lemonade chat fails, and prefers a servable model for the Lemonade check instead of a "<name>-1bit" entry that needs a GPU/NPU backend. Both new scripts also get the Apache-2.0 header every other file in os/mini carries: the CI "Copyright notice on every file" step was failing #516 and #517 on exactly these two files. Verified by running it on the booted stick (see the PR for the log).
|
Persistent review updated to latest commit ea9fed7 |
…he self-test proves it
The image shipped a model entry the engine could not use. init.sh registered every NPU model
directory as `recipe: onebit` but never said `onebit_backend: npu`, so Lemonade sent it down the
CPU path - `hrx/llama/bin/llama-server` - which this image does not carry: "Failed to execute:
hrx/llama/bin/llama-server", then "1bit serve failed to start", then HTTP 500 on
/api/v1/chat/completions. One field was the whole difference.
Three fixes:
* init.sh registers an NPU model directory with onebit_backend=npu, so Lemonade's onebit
backend runs `1bit serve --device npu` - the engine embedded in Lemonade is the NPU engine.
* selftest.sh no longer exits when the Lemonade chat fails, and falls back to any model rather
than only a "<name>-1bit" entry, so the NPU section always runs and the placement line is
always recorded.
* mkimage.sh accepts a model DIRECTORY and dereferences it: a FastFlowLM model set is a
directory of SYMLINKS into ~/.config/flm, and cp -a put 16 KB of links on the stick instead of
683 MB, leaving a dangling model.q4nx that init skipped - which is why user_models.json was
never created at all.
Cold boot of the written stick, nothing staged by hand: /data/models/Qwen3-0.6B (663 MB, real
file), user_models.json written at boot with onebit_backend=npu, `1bit-selftest` -> "Lemonade:
answers; testing model 'Qwen3-0.6B-1bit'; answer: NPU OK.; decode 94.9 tok/s; RESULT: PASS",
then "NPU model: /data/models/Qwen3-0.6B/; placement: on the private route dx: dense Qwen3 on the
dx kernels, one design per layer; RESULT-NPU: PASS; evidence appended to /data/selftest.log".
|
Persistent review updated to latest commit 86f3165 |
bong-water-water-bong
added a commit
that referenced
this pull request
Oct 23, 2026
… source build) (#517) * os image: make live mode explicit and give it a self-test 1bit OS already ran entirely from RAM and never mounted an internal disk, but nothing said so on screen, and there was no way to prove the engine answers from a given boot without hand-typing a wget. Both are now part of the image. init.sh prints a LIVE banner (RAM only, nothing installed, internal disks never mounted), drops /etc/1bit/live, and points at the new command. 1bit-selftest (os/mini/selftest.sh, installed as /bin/1bit-selftest) reports mode, kernel, GPU/NPU devices, NPU firmware, the USB4/Thunderbolt module, the model list from Lemonade, then asks the local lemond one question and prints the answer and decode rate, appending everything to /data/selftest.log so the evidence outlives the live boot. It exits non-zero on failure, so it works in a script or in CI's 1bit.check path. Verified by booting the signed image in QEMU and reading the graphical console: the banner is on screen and 1bit-selftest reports PASS - model Qwen3-0.6B-Q4_K_M, answer "NPU OK", decode ~125 tok/s (CPU/llamacpp: a VM has no NPU). Two defects it caught in itself are fixed here: a stray "/d" line left by an earlier sed whose pattern contained n/a, and a model-id parse that silently returned ""; the parse now tries id then model_name and fails loudly when no model is present. * os image: the two bugs that stopped it booting on real hardware It boots now, on strixhalo, from the USB stick: menu on screen, /data mounted, dropbear up with the baked key, Lemonade serving, and 1bit-selftest reporting PASS. Bug 1 - PID 1 exited, so the kernel panicked. init.sh ended with `exec setsid cttyhack sh`; on real hardware nothing attaches to that tty, the shell exits, and the kernel does exactly what it must when init dies: "Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000 PID: 1 Comm: sh", Kernel Offset banner, reboot. That panic was the whole "hangs before userspace" story. The console shell is now a background job and init ends in `while :; do sleep 3600; done`, so PID 1 can never exit. Bug 2 - the data partition was never mounted: init waited 20 s for LABEL=1BIT-DATA, but this machine only presents the USB 2.0 stick at t=46.4 s ("sd 1:0:0:0: [sda]" in the box log), so the window always expired. No /data meant no keys, no dropbear, no boot.log - which is why every earlier attempt looked like a silent pre-userspace hang. The wait is 90 s now, with progress lines at t=30 and t=60. Also in here, found on the way: the wired NIC's PHY driver (realtek) missing from the initramfs, which failed r8169 with -49 ("no dedicated PHY driver found for PHY ID 0x001cc840") and left the machine with no network; the USB4/Thunderbolt and Typec modules were in the image but nothing loaded them; amdgpu/amdxdna are no longer loaded at boot; the live-mode menu and numbered progress; 1bit-selftest; and a diagnostic stub init plus a hugepage-friendly panic=600 so a failure holds on screen instead of rebooting in 10 s. Verified on strixhalo from the stick: boot.log shows "stick mounted at /dev/sda2", the console menu renders, SSH works with the baked key, and 1bit-selftest answers "NPU OK" at 169-171 tok/s. Note what that number is: the GPU/NPU drivers are deliberately not loaded, so that is Lemonade's CPU llamacpp backend. Asking the engine for the NPU route from the image resets the machine - the stock amdxdna does not match the private 1bit build, and that is the next thing to fix, not this. * os image: amd_pmf for the NPU's sensors, and prove the NPU from the image amd_pmf goes in the image and loads before amdgpu/amdxdna: amdxdna's hwmon needs it, and without it the appliance logs "amdxdna_hwmon_init: No HWMON support due to missing PMF sensor support" and shows no temperatures or fan readings. init.sh now also prints the hwmon names it found, so a live boot says whether the sensor stack came up. With this in the image and the right kernel key compiled in, the NPU answers from the booted stick on strixhalo, not from a build tree: 1bit unified: loading /tmp/npu2 on the NPU dx: kernel set serves up to 4096 cached tokens (128 attention blocks) 1bit unified: on the private route dx: dense Qwen3 on the dx kernels, one design per layer 1bit unified: npu2 ready in 563 ms -> {"content":"NPU OK.","predicted_per_second":95.78,"prompt_ms":363.5} The set it loaded is the sealed one on the stick (/data/npu/kernels/1024x3072x16x8), so the sealed delivery works end to end from the release image. The engine in that image is our own source build (sha256 db132baf, 4 NPU-lane strings), not a borrowed binary. One thing this needs that lives outside this repo: the engine must embed the SAME key the sets were sealed with. It had been built with a different one (embedded 5646..., sealing 145c5f...), which showed up only as "kcrypt: signature verification failed (tampered with, or signed by another key)" at load. Copying ~/.config/1bit-npu-key/npu.inc over nk/addons/kcrypt/kcrypt_key.inc before building fixes it; that is a build-input alignment, not a code change. * os image: 1bit-selftest proves the NPU route, and the new scripts carry the licence header The auditor's point is fair: the done criterion says the self-test must report the NPU placement, and it only ever asked Lemonade for a GGUF (CPU llamacpp). 1bit-selftest now finds a .q4nx model directory (/data/models/*/ or /tmp/npu2, since --device npu correctly refuses a .gguf), starts the engine on the NPU route with the sealed sets beside it, asks one question, and records the answer, the rate and the "on the private route dx" placement line in /data/selftest.log - the evidence outliving the live boot. It also no longer bails out before that section when the Lemonade chat fails, and prefers a servable model for the Lemonade check instead of a "<name>-1bit" entry that needs a GPU/NPU backend. Both new scripts also get the Apache-2.0 header every other file in os/mini carries: the CI "Copyright notice on every file" step was failing #516 and #517 on exactly these two files. Verified by running it on the booted stick (see the PR for the log). * os image: Lemonade runs the engine on the NPU from a cold boot, and the self-test proves it The image shipped a model entry the engine could not use. init.sh registered every NPU model directory as `recipe: onebit` but never said `onebit_backend: npu`, so Lemonade sent it down the CPU path - `hrx/llama/bin/llama-server` - which this image does not carry: "Failed to execute: hrx/llama/bin/llama-server", then "1bit serve failed to start", then HTTP 500 on /api/v1/chat/completions. One field was the whole difference. Three fixes: * init.sh registers an NPU model directory with onebit_backend=npu, so Lemonade's onebit backend runs `1bit serve --device npu` - the engine embedded in Lemonade is the NPU engine. * selftest.sh no longer exits when the Lemonade chat fails, and falls back to any model rather than only a "<name>-1bit" entry, so the NPU section always runs and the placement line is always recorded. * mkimage.sh accepts a model DIRECTORY and dereferences it: a FastFlowLM model set is a directory of SYMLINKS into ~/.config/flm, and cp -a put 16 KB of links on the stick instead of 683 MB, leaving a dangling model.q4nx that init skipped - which is why user_models.json was never created at all. Cold boot of the written stick, nothing staged by hand: /data/models/Qwen3-0.6B (663 MB, real file), user_models.json written at boot with onebit_backend=npu, `1bit-selftest` -> "Lemonade: answers; testing model 'Qwen3-0.6B-1bit'; answer: NPU OK.; decode 94.9 tok/s; RESULT: PASS", then "NPU model: /data/models/Qwen3-0.6B/; placement: on the private route dx: dense Qwen3 on the dx kernels, one design per layer; RESULT-NPU: PASS; evidence appended to /data/selftest.log". * os image: log in on the screen, and reach Lemonade from the network The owner could not log in to the appliance he had just booted. Two reasons, both fixed here. 1. No usable console login. init.sh gave /dev/console a non-interactive shell, and once fbcon takes the DRM framebuffer /dev/console stops being what is painted, so the screen went blank while the box was serving. tty1 now gets an interactive login (banner, then "BusyBox ... (ash)" and a / # prompt), and every init message is written to tty1 as well as /dev/console. cttyhack is what an initramfs usually uses but here it exits at once - measured on the box - so the login uses "setsid -c" (which makes tty1 the controlling terminal, so Ctrl-C works) inside a respawn loop. The menu's "root shell" choice no longer execs (that replaced PID 1; exiting it panicked the machine) - it starts the same login. 2. Lemonade was locked to loopback. config.json now binds 0.0.0.0:13305, so Lemonade Mobile and any other client can reach it, and Lemonade's UDP beacon follows the LAN host. That means it must not be open, so init.sh mints a LEMONADE_API_KEY once (kept on the stick) and the login banner prints the URL and where the key is. Measured from another machine: 401 without the key, "NPU OK." at 96.6 tok/s with it. Also fixed here, all found by running it on the hardware rather than assuming: * the self-test sent its /api/v1/models request before it assigned AUTH, so it got 401 and reported "Lemonade: no answer" while lemond was healthy - AUTH is now set where KEY is read. * the NPU takes ONE engine context and does not hand it back: after the self-test's engine exited, the device refused the next call ("npu runtime: invalid call (code 614): state 8") and Lemonade's own engine could not load a model until a reboot. The self-test now waits for its engine to exit, unloads what Lemonade holds, reloads amdxdna, and then proves the handoff by asking Lemonade a question: "device: NPU handed back - Lemonade answered 'NPU OK.' on it after the test". Cold boot of the written stick, nothing staged by hand: / # prompt on tty1, 1bit-selftest -> RESULT: PASS, RESULT-NPU: PASS (96.7 tok/s), "NPU handed back - Lemonade answered 'NPU OK.'", and from another machine over the LAN the same model answers at 96.6 tok/s. SSH with the baked key still works. * os image: every init message on the visible VT, and stop the self-test from poisoning the NPU Two corrections to the login/Lemonade work, both found by using the box rather than reading the diff. 1. The menu and its "choice:" prompt still wrote to /dev/console only. say() was mirrored to tty1 but the menu block was not, so "everything reaches the screen" was not actually true - and /dev/console is exactly the device that stops being painted once fbcon takes the DRM framebuffer. The menu, its prompt and its trailing newline now go through mc(), which writes to both. 2. The self-test's NPU section started a SECOND engine (`1bit serve -m ... --device npu --port 18001`) and then tried to hand the device back by reloading amdxdna. Measured on the hardware: the NPU takes one engine context at a time, and after that second engine exits Lemonade's own engine gets "npu runtime: invalid call (code 614): state 8" - and a module reload only buys ONE more request, then it breaks again. So the fix is not a reset, it is not starting a second engine: Lemonade runs the engine as its onebit backend, and the engine already says where it put the model. The self-test now reads the engine's own log lines ("1bit unified: loading <model> on the NPU", "on the private route dx: ...") and reports them. Same proof, through the path the owner actually uses, and nothing left to poison. Measured on a cold boot of the written stick: / # prompt on tty1, 1bit-selftest -> RESULT: PASS (94.1 tok/s) and RESULT-NPU: PASS with "NPU model: /data/models/Qwen3-0.6B on the NPU" + the placement line, then THREE consecutive chats from another machine over the LAN: NPU OK. at 95.5, 96.4 and 94.8 tok/s. Before this change the second request always failed with state 8. --------- Co-authored-by: agent <agent@local>
Collaborator
Author
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.
It boots on real hardware now. On strixhalo, from the USB stick: menu on screen,
/datamounted, dropbear up with the baked key, Lemonade serving, and1bit-selftestreporting PASS — "NPU OK", 169–171 tok/s.Two bugs, both mine, both one-liners in effect.
Bug 1 — PID 1 exited, so the kernel panicked
init.shended withexec setsid cttyhack sh. On a real machine nothing attaches to that tty, the shell exits, and the kernel does what it must when init dies:That panic was the entire "dies before userspace" story. The console shell is now a background job and init ends in
while :; do sleep 3600; done, so PID 1 can never exit.Bug 2 — the data partition never mounted
init waited 20 s for
LABEL=1BIT-DATA, but this machine only presents the USB 2.0 stick at t = 46.4 s (sd 1:0:0:0: [sda], thenEXT4-fs (sda2): mounted filesystemat t = 46.7 s). The window always expired, so there was no/data— no keys, no dropbear, noboot.log. That is why every earlier attempt looked like a silent pre-userspace hang. The wait is 90 s now with progress lines at t=30 and t=60.Also found on the way
realtekmissing from the initramfs — the wired NIC's PHY driver.r8169failed with-49(no dedicated PHY driver found for PHY ID 0x001cc840) and the machine came up with no network at all. Loaded beforer8169now.amdgpu/amdxdnaare no longer loaded at boot; the engine loads what it needs.1bit-selftest; a diagnostic stub init; andpanic=600 oops=panicso a failure holds on screen instead of rebooting in 10 s.What this does not prove
The 169–171 tok/s answer is Lemonade's CPU
llamacppbackend — the GPU/NPU drivers are deliberately not loaded. Asking the engine for the NPU route from the image (1bit serve -m <model.q4nx dir> --device npu) resets the machine: the stockamdxdnadoes not match the private 1bit build. That is the next problem, and it is separate from booting.