Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/install-any-distro.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ that stays on its distribution's kernel only needs the second and third:
| `linux-image-<rel>` / `linux-headers-<rel>` (deb), `1bit-kernel` + `1bit-kernel-devel` (rpm), `linux-1bit` + `linux-1bit-headers` (Arch) | the kernel 1bit OS boots: Linux 7.4-rc1 with this fleet's config, signed with the 1bit MOK | only if you want OUR kernel; the drivers build against yours as well |
| `amdxdna-1bit-dkms` | `amd/xdna-driver` at `526c6081` plus the engine's patch series (`third_party/patches/amdxdna/0001-0005`), as DKMS source | the NPU. **6.10+ kernels only** (measured, not inherited — see below), signed with **your** MOK |
| `ec-su-axb35-dkms` | the AXB35-02 board's embedded-controller driver (fans, EC temperature, power mode), GPL-2.0, upstream `cmetz/ec-su_axb35-linux` at `f62c2c22`, plus a DMI gate so it attaches only on an AXB35 | the fans on a Bosgame AXB35; inert on any other board |
| `1bit-npu-config` | `limits.d/99-amdnpu-memlock.conf` (unlimited memlock), `udev/rules.d/90-1bit-npu-power.rules` (NPU keep-awake), `modules-load.d/ec_su_axb35.conf`, and the public MOK certificate at `/usr/share/1bit/mok/MOK-Kernel.der` | the NPU runtime's locked command buffers, and engine#1051's suspend/resume hang |
| `1bit-npu-config` | `limits.d/90-1bit-npu-memlock.conf` (unlimited memlock — a **higher-numbered** file you keep still wins, because limits.d applies files in lexical order; the package sat at `99-` at first and a machine that had written its own `99-amdnpu-memlock.conf` by hand made `dpkg` refuse the install and a purge then deleted that file, which is why it is a namespaced `90-` now), `udev/rules.d/90-1bit-npu-power.rules` (NPU keep-awake), `modules-load.d/ec_su_axb35.conf`, and the public MOK certificate at `/usr/share/1bit/mok/MOK-Kernel.der` | the NPU runtime's locked command buffers, and engine#1051's suspend/resume hang |

The three driver/config packages are the same set in all three families, and that set alone is a
complete install for a machine that keeps its distribution's kernel — proved as its own path
Expand Down Expand Up @@ -278,7 +278,7 @@ Verify (no model needed):
dkms status # amdxdna-1bit/0.18.0 and ec-su-axb35/0.1, installed for your kernel
modinfo -n amdxdna # .../updates/dkms/amdxdna.ko (Debian, Arch) or .../extra/amdxdna.ko.xz (Fedora)
modinfo -F srcversion amdxdna # EE1F36A2B9BA294CE11AD80 is the series this release ships
cat /etc/security/limits.d/99-amdnpu-memlock.conf
cat /etc/security/limits.d/90-1bit-npu-memlock.conf
```

Uninstall puts the in-tree driver back:
Expand Down Expand Up @@ -413,6 +413,7 @@ registry model, since this Lemonade version has no local-file registration):
| a weekly release tag works in all three families, and upgrades | `scripts/mk-kernel-packages.sh <out> 2026.45.0 --skip-kernel`, each family's own tool, in `fedora:latest` / `ubuntu:26.04` / `archlinux:latest` | deb `0.18.0-1 < 0.18.0-2026.45.0` (dpkg), rpm `0.18.0-1 < 0.18.0-2026.45.0` (rpmdev-vercmp), arch `vercmp` `-1`; each installs over the previous package (`rc=0`) and reports `0.18.0-2026.45.0` afterwards, with one `/usr/src/amdxdna-1bit-0.18.0` left on deb — no stale duplicate source tree |
| uninstalling really restores the in-tree driver, in all three families | `scripts/pkg-proof.sh`, each family in its container, after the purge | the in-tree module is gone from the tree while ours is installed (dkms archives it to `/var/lib/dkms/<pkg>/original_module/`), and after removal both `modprobe --show-depends amdxdna` and the file are back on the `kernel/` path: `amdxdna.ko.zst` on Ubuntu and Arch, `amdxdna.ko.xz` on Fedora. Same three containers as the install rows, `PROOF-RC=0` |
| uninstalling the kernel package leaves the machine as it found it | `scripts/pkg-proof.sh`, each family in its container, after removing the kernel package | deb `dpkg -P linux-image` rc=0, rpm `rpm -e 1bit-kernel-devel 1bit-kernel` rc=0, arch `pacman -R linux-1bit-headers linux-1bit` rc=0; `/boot/vmlinuz-7.4.0-rc1-1bit` (or `/boot/vmlinuz-1bit` on Arch) is gone and the module tree under `modules/7.4.0-rc1-1bit` has **0 files** left. deb **29/29**, rpm **27/27**, arch **27/27** rows PASS, `PROOF-RC=0` |
| a hand-written limits file does not block the install | `scripts/pkg-proof.sh`, all three families | with a pre-existing `99-amdnpu-memlock.conf` (65536, the file this fleet's own box wrote by hand on 2026-10-12) the install succeeds and both files are present, and removing the package leaves the hand-written one intact. Measured on the shipped `90-` name; at the original `99-` name the same scenario **failed** — `dpkg` rc=1 on the conffile conflict, and a purge then deleted the user's file. Cleaned up after the row, since a `99-` file legitimately overrides our `90-` and would change what the memlock rows below measure |
| the memlock file is honoured, not just present | `scripts/pkg-proof.sh`, all three families, running the container with `--cap-add=sys_resource` | a probe login with the file rewritten to `4096` came back with exactly `4096` (lowering always works, so that value can only come from the file), and with the shipped file back the same login reports `ulimit -l: unlimited`. Without `CAP_SYS_RESOURCE` — which a container's default set excludes — raising the hard limit fails and the session keeps the container's `8192`, which is the container, not the package |
| the distribution-kernel path, on its own | clean `ubuntu:26.04` container, packages built with `--skip-kernel`, `scripts/pkg-proof.sh deb` | 22 rows PASS and one `INFO no kernel packages in this dir` (the kernel rows skip themselves instead of failing): install, config, memlock reaching a login session, dkms building both modules against `7.0.0-43-generic`, `amdxdna` resolving to `updates/dkms`, uninstall, and the distribution's in-tree `amdxdna` back in place. This is the path a user on their own kernel takes |
| the engine package and this set install on the same machine | clean `ubuntu:26.04` container, `scripts/pkg-proof.sh coexist`, engine `1bit-engine_2026.11.02-1_amd64.deb` | all 26 rows PASS: the engine installs alone, this set installs **over it** with `dpkg` reporting no file conflict, `/usr/share/1bit` holds both (`lemonade-config-fragment.json` from the engine, `mok/MOK-Kernel.der` from `1bit-npu-config`) with each file attributed to its own package, the engine still runs (`1bit 0.0.1`), both dkms modules build, purging this set leaves the engine's files intact, and the engine purges last. Neither `scripts/pack-proof.sh` (the engine) nor the rows above (this set) install both, so this is the combination nobody had tried |
Expand Down
4 changes: 2 additions & 2 deletions scripts/mk-kernel-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ mkdir -p "$cfg/etc/security/limits.d" "$cfg/etc/udev/rules.d" "$cfg/etc/modules-
"$cfg/usr/share/1bit/mok" "$cfg/usr/share/doc/1bit-npu-config" "$cfg/usr/share/licenses/1bit-npu-config"
# The NPU runtime is compiled into 1bit and locks command buffers; without unlimited memlock a loaded
# model's allocations fail. The same two lines the box runs.
cat > "$cfg/etc/security/limits.d/99-amdnpu-memlock.conf" <<'EOF'
cat > "$cfg/etc/security/limits.d/90-1bit-npu-memlock.conf" <<'EOF'
* soft memlock unlimited
* hard memlock unlimited
EOF
Expand Down Expand Up @@ -152,7 +152,7 @@ The runtime configuration the 1bit NPU packages need. Configuration only: no bin

| file | why |
|---|---|
| `/etc/security/limits.d/99-amdnpu-memlock.conf` | the NPU runtime is compiled into `1bit` and locks command buffers; without unlimited memlock a loaded model's allocations fail |
| `/etc/security/limits.d/90-1bit-npu-memlock.conf` | the NPU runtime is compiled into `1bit` and locks command buffers; without unlimited memlock a loaded model's allocations fail |
| `/etc/udev/rules.d/90-1bit-npu-power.rules` | keeps the XDNA2 NPU (`1022:17f0`) out of runtime autosuspend, whose resume path loses the firmware context (engine#1051) |
| `/etc/modules-load.d/ec_su_axb35.conf` | loads the AXB35 board's EC driver (fans, EC temperature, EC power mode); the driver attaches only on an AXB35, so it is inert on other boards |
| `/usr/share/1bit/mok/MOK-Kernel.der` | the **public** certificate the 1bit kernel and its modules are signed with, for Secure Boot |
Expand Down
39 changes: 36 additions & 3 deletions scripts/pkg-proof.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,39 @@ if [ -n "$intree" ]; then row PASS "the in-tree amdxdna is present" "$intree"
else row FAIL "the in-tree amdxdna is present" "install the kernel's module tree (linux-modules-<ver> / kernel-core / linux)"; fi
depmod -a "$kv" 2>/dev/null || :

# A machine may already carry its own memlock file — this fleet's own box wrote
# /etc/security/limits.d/99-amdnpu-memlock.conf by hand on 2026-10-12, before this package existed. With
# our file at that exact path the install FAILED (dpkg rc=1, conffile conflict) and a purge then deleted
# the hand-written file. So: the hand-written file stays, ours is a namespaced neighbour, and both facts
# are asserted here rather than assumed.
if [ "$fam" != coexist ]; then
hand=/etc/security/limits.d/99-amdnpu-memlock.conf
printf '* soft memlock 65536\n* hard memlock 65536\n# hand-written before this package\n' > "$hand"
case $fam in
deb) dpkg -i "$pkgdir"/1bit-npu-config_*.deb >/tmp/re.log 2>&1 ;;
rpm) rpm -i --nosignature "$pkgdir"/1bit-npu-config-[0-9]*.rpm >/tmp/re.log 2>&1 ;;
arch) pacman -U --noconfirm "$pkgdir"/1bit-npu-config-[0-9]*.pkg.tar.zst >/tmp/re.log 2>&1 ;;
esac
if [ $? -eq 0 ] && grep -q 65536 "$hand" && [ -f /etc/security/limits.d/90-1bit-npu-memlock.conf ]; then
row PASS "a hand-written limits file does not block the install" "ours at 90-…, ours-and-yours both present"
else
row FAIL "a hand-written limits file does not block the install" "$(tail -2 /tmp/re.log)"
fi
case $fam in
deb) dpkg -P 1bit-npu-config >/tmp/rr.log 2>&1 ;;
rpm) rpm -e 1bit-npu-config >/tmp/rr.log 2>&1 ;;
arch) pacman -R --noconfirm 1bit-npu-config >/tmp/rr.log 2>&1 ;;
esac
if [ $? -eq 0 ] && grep -q 65536 "$hand"; then
row PASS "the hand-written file survives our removal" "still 65536"
else
row FAIL "the hand-written file survives our removal" "$( [ -e "$hand" ] && echo 'content changed' || echo 'deleted')"
fi
# clean up after the scenario: a 99- file sorts after our 90- and would legitimately win (later file
# wins in limits.d), which would make the memlock rows below measure the user's limit, not ours
rm -f "$hand"
fi

# ---- install the three packages --------------------------------------------------------------
case $fam in
coexist)
Expand Down Expand Up @@ -151,7 +184,7 @@ fi

# ---- 1bit-npu-config ------------------------------------------------------------------------
check "memlock limits.d" "2 lines, unlimited" \
grep -q 'memlock unlimited' /etc/security/limits.d/99-amdnpu-memlock.conf
grep -q 'memlock unlimited' /etc/security/limits.d/90-1bit-npu-memlock.conf
check "NPU keep-awake udev rule syntax" "udevadm verify" \
udevadm verify /etc/udev/rules.d/90-1bit-npu-power.rules
check "modules-load.d entry" "ec_su_axb35" \
Expand All @@ -160,14 +193,14 @@ check "public MOK certificate (kernel key)" \
"$(openssl x509 -inform DER -in /usr/share/1bit/mok/MOK-Kernel.der -noout -subject 2>/dev/null | sed 's/subject=//')" \
test -s /usr/share/1bit/mok/MOK-Kernel.der
check "config files are 0644" "not group-writable" \
bash -c '! find /etc/security/limits.d/99-amdnpu-memlock.conf /etc/udev/rules.d/90-1bit-npu-power.rules -perm /022 | grep -q .'
bash -c '! find /etc/security/limits.d/90-1bit-npu-memlock.conf /etc/udev/rules.d/90-1bit-npu-power.rules -perm /022 | grep -q .'

# Is the memlock file actually READ by the login path, or only present? The NPU runtime locks command
# buffers and fails without it, so a right-looking file at a path pam_limits does not read would be a
# confusing user-facing failure. Proof: write a distinctive finite limit into the installed file, log in
# as a fresh user, and see that value come back; then restore the shipped content and read it again.
if id kpkgprobe >/dev/null 2>&1 || useradd -m -s /bin/bash kpkgprobe >/dev/null 2>&1; then
lim=/etc/security/limits.d/99-amdnpu-memlock.conf
lim=/etc/security/limits.d/90-1bit-npu-memlock.conf
keep=$(mktemp); cp "$lim" "$keep"
# 4096, not 8192: LOWERING a limit is always permitted, so the value can only come from the file.
# (The first version of this row wrote 8192, which happened to equal the container's inherited
Expand Down
Loading