Repository navigation
1bit OS: an installer - live boot onto one internal disk, same signed layout, with refusals - #539
Conversation
1bit OS boots live from a stick and there was no way to put it on a machine (the #515 image says so plainly: no installer at all). This adds the installer and proves the whole sequence in QEMU, so the owner's install is a known run of commands rather than an experiment. - os/mini/install.sh (new), shipped as /bin/1bit-install: installs onto ONE internal disk named explicitly. Before it writes anything it refuses: no --yes, a partition instead of a whole disk, a removable device, the disk this live boot runs from (the 1BIT-DATA partition's parent, via sysfs), a disk with anything mounted, a missing GPT tool. Then it prints the disk's model/size/partition table and waits 10 s. Past that: GPT with a 512 MB ESP (the live ESP copied byte for byte - the same shim, signed grub, vmlinuz, initramfs, grub.cfg, so the MOK enrolment on the machine is unchanged) and a 1BIT-DATA ext4 partition filling the disk carrying the stick's models, Lemonade backends/config/cache, the NPU kernel sets and the SSH keys, plus /data/.installed. - os/mini/init.sh: /data/.installed selects the installed mode - INSTALLED banner instead of LIVE, /etc/1bit/installed instead of /etc/1bit/live, and no stick menu (there is nothing to choose). Same initramfs and signed chain either way. Also define say() before its first use: it sat below the NPU kernel-link line, so that line died as "say: not found" on the console. - os/mini/mkimage.sh: ship install.sh and sfdisk (busybox fdisk is MBR-only; the installer lays the target out with the same sfdisk script the build uses for the stick, so a stick and an installed disk are one layout), and ship and load nvme + ahci. Without them the live system had no NVMe driver at all and could not see the disk an install target always is. - os/mini/vmtest.sh: an install pass - a sparse qcow2 virtual NVMe attached to the live VM, the refusal matrix, the install, poweroff, then a second boot from the installed disk alone with clean NVRAM and no USB attached, asserting the INSTALLED banner, /etc/1bit/installed, /data on the disk, Lemonade with its key answering a chat, and 1bit-selftest reporting INSTALLED. - os/README.md: the owner's sequence as commands, the Secure Boot/MOK note, how to get back to the live stick, and what the VM proves vs what only the real machine can. Three bugs the VM found, all invisible to a stick that never needs a second disk: the image shipped no nvme/ahci module; new_part() decided a partition's name by asking whether the node already existed (right after sfdisk it does not), so it wrote /dev/nvme0n11 on a disk whose name ends in a digit; and "mke2fs" was not mke2fs. The image shipped only busybox's applet, which is ext2-only and rejects -t, so the data partition was never created ("1bit-install: mke2fs failed"). Shipping the real e2fsprogs binary was not enough on its own: this is a busybox shell with CONFIG_FEATURE_SH_STANDALONE, so a name it knows as an applet is answered by the shell before PATH is consulted, and the real /bin/mke2fs was still skipped (measured in the guest: `type mke2fs` -> "mke2fs is mke2fs", while /bin/mke2fs printed the e2fsprogs usage). The installer now names the tools it needs by absolute path - /bin/sfdisk and /bin/mke2fs - and mkimage.sh ships the real mke2fs with its libraries and /etc/mke2fs.conf. install.sh also reads the partition table back with sfdisk, not busybox fdisk, which cannot read a GPT. Two more the same runs found. Mounting the ESP failed with EINVAL and the kernel said why: "FAT-fs (nvme0n1p1): codepage cp437 not found" - the image ships nls_cp437 but init loaded vfat and not the codepage, so no vfat mount could succeed. And the live disk was found with `findfs LABEL=1BIT-DATA`, which after an install answers with the *installed* disk, whose own partition carries that label: the installer then refused the target as "the disk this live boot runs from" (blocking every reinstall) and would have copied the wrong ESP. Both the live disk and the live ESP are now taken from what /data is actually mounted from, in /proc/mounts. Booting the installed disk and asking it (not guessing) found the last two: 1bit-selftest printed "mode: LIVE" unconditionally, so on an installed machine it contradicted the banner and the installer's own "selftest reports INSTALLED" check could never pass - it now reads /etc/1bit/installed vs /etc/1bit/live. And /etc/1bit did not exist at all on any boot, because mkimage.sh creates it after it packs the initramfs; init makes the directory itself now, so the marker is not silently lost. That ordering in mkimage.sh (/etc/1bit/libhsa and /opt/1bit-llama are also added after the pack) is pre-existing and left alone here. Co-Authored-By: Claude Fable 5.1 <[email protected]>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
The deliverable image was built from this branch before the merge, signed with the machine's enrolled MOK,
Owner's step, when the stick is at sudo dd if=1bit-os.img of=/dev/sdX bs=4M conv=fsync # then grow 1BIT-DATA to fill the stickThe |
|
The compressed artifact landed, so the loose end above is closed:
|
`os/mini` is the BusyBox image that ships today: everything in RAM, a reflash to update. `os/v2` is the same appliance - Lemonade Server by AMD on the 1bit engine, our kernel, Secure Boot through the enrolled MOK - on a minimal Ubuntu 26.04 root filesystem with systemd, where every piece we ship is a `.deb` from our own signed repository and `apt update && apt upgrade` is the update path. `os/mini` keeps shipping until v2 passes the same checks on hardware. Seven packages, built from what a release already produces (no binary is rebuilt): `1bit-engine`, `1bit-lemonade`, `1bit-kernel-image-<kver>`, `1bit-kernel-modules-<kver>`, `1bit-ryzenadj`, `1bit-appliance` and `1bit-archive-keyring`. The kernel version is in the package name, so an upgrade keeps the previous kernel installed - that is the rollback. `mkdebs.sh` refuses a stage whose EC module is unsigned or built for another kernel, and a kernel image with no signature; it localises the engine's libraries with `scripts/pack-elf.sh` (the same `pack_localize` a release tarball goes through), because a package that carries the build machine's RUNPATH is a package that does not load (#549). The live medium is the root filesystem as a squashfs with a tmpfs overlay: one initramfs-tools script (`scripts/init-bottom/0-1bit-live`) builds the overlay and hands `rootmnt` back through `/conf/param.conf`, so userspace has nothing custom at boot and a live boot cannot write the medium. `install.sh` is `1bit-install`, with the same refusal matrix as #539 and three partitions (ESP, `1BIT-ROOT`, `1BIT-DATA`) instead of a RAM image; it unpacks the squashfs, writes `fstab` by label, one grub entry per installed kernel, and leaves `/etc/1bit/live` off the installed disk so `1bit-first-boot.service` writes `/etc/1bit/installed` after making that machine's own SSH keys. Two VM tests, both judged from what the guest writes to its own disk rather than from QEMU: `vmtest-v2.sh` (the appliance, booted through OVMF so the secureboot row answers instead of failing for a QEMU choice) and `vmtest-install-v2.sh` (builds the medium with a test-only unit inside it, boots it with a target disk and a USB stick attached, runs the refusals, installs, then boots the installed disk alone). Bugs this found in the v2 path, all fixed here: the engine package could not load its own libraries (a dev-built stage carried the build tree's RUNPATH and never shipped libhrx/libloomc/libomp); `1bit` needed `libgomp1`/`libpcre2-8-0`, which minbase has not; lemond exits at once without `HOME` in a systemd unit; `ssh.service` enabled while `ssh.socket` was masked starts nothing at all on Ubuntu 26.04 (the socket is what listens, and it carries RequiredBy=ssh.service) - so the socket is what the package enables; minbase has no `sfdisk` (Ubuntu's lives in `fdisk`); `root=` in the live entry has to be the squashfs partition, or `data.mount` fights the initramfs for the data partition; and `1bit-appliance` never shipped the aggregate `/usr/share/licenses/1bit-os` that release-check reads. Known gap, named in `os/v2/README.md` rather than papered over: the ROCm userspace (HIP, rocBLAS, hipBLASLt, the HSA runtime) is the machine's, not the engine package's, and the engine's `Depends` do not name Ubuntu's packages for it yet - gfx1201 support against the distro's ROCm is a hardware question a VM cannot settle. `vmtest-v2` therefore asserts the package's own libraries resolve and lets only that set be missing, which is exactly the check that caught the first bug above. Evidence: `VMTEST-V2 PASS` (seven packages installed, banner, /data, 1bit --help, our kernel's vmlinuz and initrd in /boot, sshd on 22, apt from the repository, Lemonade 401 + GGUF + chat, release-check with no FAIL row but `sealed`, which needs a stage that carries the sealed NPU sets) and `VMTEST-V2-INSTALL PASS` (six refusals, install, installed disk boots alone: INSTALLED mode, first-boot marker and own SSH keys, /data on its own partition, Lemonade 401 + GGUF + chat, selftest INSTALLED). Transcripts: `~/wt/osapt-proto/v2-final.log` and `~/wt/osapt-proto/live-install.log`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: bong-water-water-bong <[email protected]>
1bit OS: an installer — live boot onto one internal disk, same signed layout, with refusals
Why
1bit-selftestproved the live stick, and there was no way to put the appliance on a machine (#515 saysso plainly: the image carries no installer at all). The Gantt's install row needs a known sequence rather
than an experiment, so this adds the installer and proves the whole thing in QEMU — live boot, install,
reboot from the installed disk with no stick attached — plus every refusal, so the owner's real install
is a list of commands that has already run once.
What changes
os/mini/install.sh(new)/bin/1bit-install. Installs onto ONE internal disk named explicitly: GPT with a 512 MB EFI system partition — the signed chain this boot came from (shim, signed grub,vmlinuz,initramfs,grub.cfg, copied byte for byte, so the machine's MOK enrolment is unchanged) — and a1BIT-DATAext4 partition filling the disk, carrying the stick'smodels/,lemonade/(backends, config, cache, key), the NPU kernel sets andssh/, then/data/.installed. Refuses, before writing anything: no--yes; a partition instead of a whole disk; a removable device; the disk this live boot runs from; a disk with anything mounted; a missing GPT tool. Prints the disk's model/size/partition table and waits 10 s.os/mini/init.sh/data/.installedand the same init then boots the appliance from it:INSTALLEDbanner and/etc/1bit/installedinstead ofLIVE//etc/1bit/live, and the stick's menu is skipped (there is nothing to choose). Loadsnvme/ahci(the install target is always an internal NVMe) and the vfat codepages the installer's ESP mount needs; creates/etc/1bititself;say()defined before its first use.os/mini/mkimage.shinstall.shas/bin/1bit-install, plussfdisk(busyboxfdiskis MBR-only) and the real e2fsprogsmke2fswith/etc/mke2fs.conf— the installer lays the disk out with the same sfdisk recipe the build uses for the stick. Shipsnvme,ahci,nls_cp437,nls_ascii.os/mini/selftest.sh/etc/1bit/installedvs/etc/1bit/live) instead of always printingLIVE.os/mini/vmtest.sh1bit-install, poweroff, then a second boot from the installed disk alone with clean NVRAM and no USB, asserting the INSTALLED banner,/etc/1bit/installed,/dataon the disk, the GGUF listed, 401 without the key, a chat, and1bit-selftestreporting INSTALLED.os/README.mdApache-2.0 notices on the new file;
python3 tools/copyright.py --check→ rc=0.Refusal matrix — what the VM asserts (
vmtest-install6, 23 Oct 09:53, one run)Each invocation must print
REFUSEDand exit 2, and write nothing:1bit-install /dev/nvme0n1(no--yes)REFUSED: refusing to write /dev/nvme0n1 without --yes (this destroys its contents)1bit-install --help1bit-install /dev/sda1 --yes(a partition)REFUSED: /dev/sda1 is a partition; name the whole disk (e.g. /dev/nvme0n1, not /dev/nvme0n1p1)1bit-install /dev/sda --yes(the live stick)REFUSED: /dev/sda carries this live boot's 1BIT-DATA partition; install onto a different disk1bit-install /dev/does-not-exist --yesREFUSED: /dev/does-not-exist is not a block device1bit-install /dev/nvme0n1 --yeswith its partition mountedREFUSED: /dev/nvme0n1 is in use: /dev/nvme0n1p2 is mountedA removable device is refused in the same way, but the VM has no removable target to point at (the
only removable disk in QEMU is the stick, which the live-disk rule already catches), so that refusal is
code-and-review only, and is called out here rather than claimed as tested.
Verification — labelled "90 W cap, PCM pad (23 Oct)"
os/mini/vmtest.shon strixhalo undergpu-hold -l "pi osinstall" -t 14, one full run:Paris.(llamacpp:vulkan)1bit-install /dev/nvme0n1 --yeslayout : GPT - partition 1 = 512 MB EFI system partition (1BIT-OS), the rest = ext4 (1BIT-DATA),partition 1: /dev/nvme0n1p1 512 MBthe installed disk booted on its own (no USB attached)MODE: INSTALLED - 1bit OS runs from this machine's disk; /data is /dev/nvme0n1p2./etc/1bit/installedinstead of/etc/1bit/live/etc/1bit/installed present, no live marker/datacomes from the installed disk/dev/nvme0n1p2 /data ext4401 without the key,lists the GGUF carried over to the disk: Qwen3-0.6B-Q4_K_M,chat … answered: Paris.1bit-selfteston the installed diskreports the INSTALLED modeVMTEST PASSWhat the VM proves, and what only the real machine can
NVRAM), the INSTALLED mode and marker,
/datacoming from the disk, Lemonade serving with its key anda chat answered by
llamacpp:vulkan, and the self-test reporting INSTALLED.(
/dev/accel/accel0, the placement line,RESULT-NPU: PASS), the GPU, and real Secure Boot againstthe enrolled MOK.
Six bugs the VM found (all invisible on a stick that never needs a second disk)
nvme/ahcimodule at all, so the live system could not see the disk aninstall target always is (
install: no NVMe device in the VM).sfdiskit doesnot, so the installer wrote
/dev/nvme0n11on a disk whose name ends in a digit.mke2fswas busybox's: ext2-only, no-t. Shipping the real e2fsprogs binary was not enough onits own — this is a busybox shell with
CONFIG_FEATURE_SH_STANDALONE, so an applet name is answered bythe shell before
PATH, and/bin/mke2fswas still skipped (type mke2fs→ "mke2fs is mke2fs" while/bin/mke2fsprinted the e2fsprogs usage). The installer now names the tools it needs absolutely.codepage cp437 not found, thenIO charset ascii not found— the imageshipped neither
nls_cp437nornls_ascii(this kernel'sCONFIG_NLS_DEFAULTis ascii).findfs LABEL=1BIT-DATAanswered with the target disk after an install, whose own partitioncarries that label: the installer refused the correct target as "the disk this live boot runs from",
which would have blocked every reinstall, and the ESP copy source had the same ambiguity. Both the live
disk and the live ESP now come from what
/datais actually mounted from (/proc/mounts).1bit-selftestprintedmode : LIVEunconditionally, and/etc/1bitdid not exist on any boot:mkimage.shcreates it (and writeslibhsa) after it packs the initramfs, so the marker was silentlylost. init now creates the directory itself and the self-test reads the markers. (That mkimage ordering
is pre-existing and left alone here — it also means
/etc/1bit/libhsaand/opt/1bit-llamahave neverreached a booted image; it wants its own issue.)
Owner's sequence (nothing in this PR writes a real disk — the VM did)
Secure Boot needs no change: the disk carries the same MOK-signed kernel and initramfs the stick booted,
and the machine's enrolment (
mokutil --list-enrolled) is untouched. Booting the stick again gets youback to a live system and does not touch the installed disk.
Co-Authored-By: Claude Fable 5.1 [email protected]