Skip to content

LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.

Pi kernel 6.18.57-3+lordos: cross build, switching kernels, 0.8.4 notes

Federico Pereiraee1f03f4838f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7beb77f..802525c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -35,6 +35,18 @@ of the matching [GitHub release](https://github.com/lordbasex/LordOS/releases),
- **The window menu of apps that draw their own bar.** A right click on a GTK app's own title bar
now opens the theme's window menu (Minimize, Zoom, Close; in Classic also Restore, Snap layouts
and the snap halves).
+- **Raspberry Pi 5: blocking an app now closes its open connections** (a known issue in 0.8.3),
+ as on a PC, instead of leaving them stalled until the app's own timeout. The LordOS Pi kernel is
+ rebuilt as `6.18.57-lordos.3-rpi-2712` (`6.18.57-3+lordos`): the same Raspberry Pi source and
+ options as before (Landlock, the BPF LSM, BTF, Yama) plus sock_diag socket destroy
+ (`CONFIG_INET_DIAG_DESTROY`, `CONFIG_INET_UDP_DIAG`), so `lord-netperm` closes TCP and QUIC
+ connections a new rule denies within a fraction of a second. Each kernel revision now installs
+ as its own package next to the previous one, so the previous kernel stays bootable as a fallback
+ (one line in `config.txt`, see [docs/RASPBERRY.md](docs/RASPBERRY.md#switching-kernels-on-a-board)).
+ The image build and `verify-board` check the kernel has it. On a Pi 5: TCP downloads and an idle
+ session end 0.04–0.37 s after the rule changes, an HTTP/3 (QUIC) download 0.08 s.
+- **`build-kernel.sh` cross-compiles** the Pi kernel on an x86-64 Debian 13 (the arm64 Debian
+ packages, no arm64 build dependencies needed).
## [0.8.3-beta] - 2026-10-19
diff --git a/docs/RASPBERRY.md b/docs/RASPBERRY.md
index 7e10b70..36a5f77 100644
--- a/docs/RASPBERRY.md
+++ b/docs/RASPBERRY.md
@@ -22,8 +22,9 @@ This document gathers what's needed to build the image, write it, develop on the
> **`6.18.57-lordos.3-rpi-2712`** (`6.18.57-3+lordos`): the same source and options plus sock_diag
> `SOCK_DESTROY` (`INET_DIAG_DESTROY`, `INET_UDP_DIAG`), so the firewall closes the connections a new
> rule denies instead of leaving them stalled. Each kernel revision now has its own release, so the
-> previous one stays installed and bootable. **Not built yet:** the first attempt on the board (in a
-> tmpfs, see below) left the Pi unreachable; it needs a power cycle and enough free disk.
+> previous one stays installed and bootable (see "Switching kernels on a board"). Cross-compiled on
+> VM 116, installed on the Pi 5 and verified there: `verify-board`, the firewall cut test (15/15,
+> TCP and QUIC closed in 0.04–0.37 s) and `make -C server test`.
## Models
@@ -122,14 +123,25 @@ what LordOS needs:
```sh
# on the Pi (arm64 Debian 13): about 75 min per flavour on a Pi 5 (4 cores, SD card), ~10 GB free
-# on disk (not in a tmpfs: on the 16 GB board a 10 GB tmpfs for the build folder plus the final link
-# with full DWARF left it unreachable, 2026-10-19)
sudo apt-get install -y --no-install-recommends build-essential bc bison flex libssl-dev libelf-dev \
libdw-dev dwarves cpio kmod rsync dpkg-dev debhelper git
tools/rpi/build-kernel.sh /var/tmp/lordos-kernel all # 2712 (Pi 5), v8 (Pi 4), or all
# → /var/tmp/lordos-kernel/out/linux-image-6.18.57-lordos.3-rpi-2712_6.18.57-3+lordos_arm64.deb, …
+
+# or cross-compiled on an x86-64 Debian 13 (VM 116: 4 vCPU, 4 GB RAM; 67 min for 2712), the same
+# packages plus the cross compiler and the arm64 libc headers (for the headers package's tools)
+sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross
+RPI_KERNEL_REF=234188315037848e5b07d65b85d38edc64095caa tools/rpi/build-kernel.sh /var/tmp/pik-kernel 2712
```
+The script cross-compiles by itself when the host isn't arm64 (`CROSS_COMPILE=aarch64-linux-gnu-`,
+and `DPKG_FLAGS=-d`: `dpkg-buildpackage` would otherwise ask for arm64 build dependencies the kernel
+doesn't use). The 0.8.4 packages were built that way: same commit, same `.config` (the diff
+against the defconfig is identical to a native build's apart from the release name), same package
+size as the native `-2` (43 MB). With 4 GB of RAM a temporary 4 GB swap file was added for the
+final link; the work folder peaked at about 16 GB. Don't build on the Pi in a tmpfs or with less
+than 10 GB free on its SD card.
+
- **Source:** `github.com/raspberrypi/linux`, branch `rpi-6.18.y` (`RPI_KERNEL_BRANCH`;
`RPI_KERNEL_REF=<commit>` pins one). The first build (2026-10-18) used commit `234188315037`,
kernel **6.18.57**; the archive shipped 6.18.50 at the time. The 0.8.1 rebuild (`-2+lordos`, BPF
@@ -226,6 +238,42 @@ tools/rpi/build-kernel.sh /var/tmp/lordos-kernel all # 2712 (Pi 5), v8 (Pi 4
- **Per flavour:** if only the 2712 kernel was built, the Pi 4 kernel comes from the archive (with
a warning, and without the pin).
+### Switching kernels on a board
+
+The firmware reads `config.txt` on `bootfs`; `os_prefix=<folder>/` makes it take the kernel,
+initramfs, `cmdline.txt`, device trees and overlays from that folder instead of the top level. On
+an installed system the top level is always what the packages put there: the newest LordOS kernel
+(`raspi-firmware`'s hook copies it on every install). The previous kernel stays installed (its own
+`/lib/modules`) and its boot files go in a folder, `lordos-prev/`:
+
+```sh
+# keep the running kernel's boot files before installing a new one (once per revision)
+K=$(uname -r); D=/boot/firmware/lordos-prev
+sudo mkdir -p $D/overlays && sudo cp /boot/vmlinuz-$K $D/kernel_2712.img && sudo cp /boot/initrd.img-$K $D/initramfs_2712
+sudo cp /boot/firmware/cmdline.txt $D/ && sudo cp /usr/lib/linux-image-$K/broadcom/bcm27*.dtb $D/
+sudo cp /usr/lib/linux-image-$K/overlays/* $D/overlays/
+sudo dpkg -i linux-image-6.18.57-lordos.3-rpi-2712_6.18.57-3+lordos_arm64.deb # the hook: top level = new
+# first boot of the new kernel only once: tryboot.txt = config.txt without os_prefix
+sudo reboot "0 tryboot" # if it doesn't come up, any reset boots config.txt again
+```
+
+- **Use the new kernel:** `config.txt` without `os_prefix` (the image's default).
+- **Back to the previous kernel:** add, at the end of `config.txt` (it's on the FAT partition, so
+ any computer with a card reader can edit it if the board doesn't boot):
+
+ ```
+ [all]
+ os_prefix=lordos-prev/
+ ```
+
+ Removing those two lines boots the new kernel again. To try the previous one **once** without
+ editing `config.txt`, put that line in `tryboot.txt` (a copy of `config.txt`) and
+ `sudo reboot "0 tryboot"`; the next reset is back on the top level.
+- `uname -r` tells them apart: `6.18.57-lordos.3-rpi-2712` (0.8.4) or `6.18.57-lordos-rpi-2712`
+ (0.8.1–0.8.3's `-2+lordos`).
+- The Pi 5 used for development (2026-10-19) has exactly this: the top level is `-3`,
+ `lordos-prev/` is `-2`, and `tryboot.txt` boots `lordos-prev/` once. Both were booted and checked.
+
### Packages to build it
On a Debian 13 (x86-64 or arm64):
diff --git a/docs/VM-SETUP.md b/docs/VM-SETUP.md
index aea3b4d..bb05a04 100644
--- a/docs/VM-SETUP.md
+++ b/docs/VM-SETUP.md
@@ -1371,3 +1371,37 @@ in `~/LordOS-csd`, built there (`make -C server`, `make -C server build/deco-cli
`master_preferences` and `settings.json` restored, the themes, the schemas package, `session.conf`,
the profiles, the tree, the script and the backup removed, `lordos.service` restarted to the login
screen. No network or Proxmox setting was touched.
+
+## Step 39 — 0.8.4: the Pi kernel with socket destroy (VM 116 and the Raspberry Pi, October 19)
+
+See `RASPBERRY.md` ("The LordOS kernel", "Switching kernels on a board") and `FIREWALL.md`
+("Existing connections are cut").
+
+- **VM 116 (172.17.0.52), cross build:** installed `gcc-aarch64-linux-gnu` and
+ `libc6-dev-arm64-cross` (with their dependencies: `binutils-aarch64-linux-gnu`, the arm64 cross
+ libraries) and the kernel build packages it lacked: `bison`, `flex`, `libelf-dev`, `libdw-dev`,
+ `dwarves`, `rsync`, `debhelper`. They stay, for the next cross build. Work folder
+ `/var/tmp/imager-scratch/pik-kernel` (the 24 GB scratch disk; about 16 GB at the peak) with a
+ temporary 4 GB swap file; `RPI_KERNEL_REF=234188315037… tools/rpi/build-kernel.sh … 2712`, 67 min.
+ The swap file and the work folder were removed afterwards; the `.debs` were copied out first.
+- **Raspberry Pi 5 (172.17.0.24):** a first attempt to build natively (in a tmpfs, the SD card being
+ 86 % full) ended when the card was removed; nothing of it is left. Then:
+ - `/var/tmp/lordos-kernel/out/`: the `-3` image and headers `.debs` and their config added
+ (`SHA256SUMS` regenerated), where `build-img.sh` takes them from.
+ - `dpkg -i linux-image-6.18.57-lordos.3-rpi-2712_6.18.57-3+lordos_arm64.deb`: the hooks put it at
+ the top level of `/boot/firmware` (over Raspberry Pi's 6.18.50 copy there, which is still
+ installed; the October 18 backup is in `/var/tmp/lordos-kernel/bootbak-20261018`). `-2` stays
+ installed.
+ - `/boot/firmware/lordos/` (the `-2` boot files) renamed `lordos-prev/`; `config.txt` lost its
+ `os_prefix=lordos/` lines (a comment explains how to go back); `tryboot.txt` now boots
+ `lordos-prev/` once. Before the change: `/var/tmp/lordos-pik/config.txt.before` and
+ `tryboot.txt.before`. First boot of `-3` through `tryboot`, then a normal boot, a `tryboot` into
+ `-2` (69 modules loaded, everything active) and back.
+ - `lord-netperm` was still the 0.8.2 binary (not restarted by the 0.8.3 upgrade): restarted.
+ - Tests in `/var/tmp/lordos-pik` (tree copy in `src/`, logs): `netperm_cut.sh` as root with a
+ hand-made `lordos-session-0` cgroup (gone at the reboot; `/root/.config/lordos` removed), before
+ (12/15, the stall) and after (15/15); `verify-board`; `lord-fand` `FORCE 1`/`FORCE off`;
+ `make -C server test`.
+ - Not changed: the network configuration, the `lordbasex` account, the partitions, `cmdline.txt`
+ (this board's lacks `cgroup_enable=memory`, so `verify-board` reports the memory controller as
+ FAIL; the image's has it).
diff --git a/tools/rpi/build-kernel.sh b/tools/rpi/build-kernel.sh
index 4dd9fd4..565491c 100644
--- a/tools/rpi/build-kernel.sh
+++ b/tools/rpi/build-kernel.sh
@@ -3,8 +3,9 @@
# plus what LordOS needs that it lacks (Landlock, the BPF LSM and BTF). See docs/RASPBERRY.md,
# "The LordOS kernel".
#
-# Usage (on an arm64 Debian 13, ideally the Pi itself; about 75 min per flavour on a Pi 5, and
-# ~10 GB free in the work folder while one flavour builds: BTF needs the DWARF debug info):
+# Usage (on an arm64 Debian 13, e.g. the Pi itself, about 75 min per flavour on a Pi 5; or cross on
+# an x86-64 Debian 13 with gcc-aarch64-linux-gnu; ~10 GB free in the work folder while one flavour
+# builds: BTF needs the DWARF debug info):
# tools/rpi/build-kernel.sh [work folder] [2712|v8|all] # default /var/tmp/lordos-kernel 2712
#
# Result: <work>/out/linux-image-<release>_<version>_arm64.deb (+ linux-headers-…), where
@@ -41,7 +42,12 @@ case "$(uname -m)" in
aarch64|arm64) CROSS="" ;;
*) command -v aarch64-linux-gnu-gcc >/dev/null || {
echo "build-kernel.sh: not arm64 and no aarch64-linux-gnu-gcc (gcc-aarch64-linux-gnu)" >&2; exit 1; }
- CROSS="CROSS_COMPILE=aarch64-linux-gnu-" ;;
+ # the headers package builds its host tools (fixdep, …) for arm64: needs the arm64 libc headers
+ [ -f /usr/aarch64-linux-gnu/include/sys/types.h ] || {
+ echo "build-kernel.sh: no arm64 libc headers (libc6-dev-arm64-cross)" >&2; exit 1; }
+ # cross build (x86-64 Debian 13, e.g. VM 116): dpkg-buildpackage would ask for the arm64
+ # build dependencies (libssl-dev:arm64, …); the kernel only needs the native ones, so -d
+ CROSS="CROSS_COMPILE=aarch64-linux-gnu- DPKG_FLAGS=-d" ;;
esac
for t in git make gcc bc bison flex dpkg-deb dpkg-buildpackage dh rsync cpio pahole readelf; do
command -v "$t" >/dev/null || { echo "build-kernel.sh: missing $t" >&2; exit 1; }