Sign local builds with mkosi -f genkey
os / os (push) Failing after 2m14s

It replaces mkosi.crt for local tests, without openssl or a
mkosi.local.conf.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Job79andClaude Opus 5.5 committed 2026-11-23 18:28:04 +00:00
1 parent d1c7c55700
commit d76d28ef8a
3 files changed
+3 -23

No files matched your search

-1
View File
@@ -1,5 +1,4 @@
mkosi.key mkosi.key
mkosi.output/ mkosi.output/
mkosi.cache/ mkosi.cache/
mkosi.local.conf
mkosi.credentials/ mkosi.credentials/
+1 -2
View File
@@ -66,14 +66,13 @@ CMD ["/sbin/init"]
END END
podman run -d --name mkosi --privileged --systemd=always -v <repo>:/repo \ podman run -d --name mkosi --privileged --systemd=always -v <repo>:/repo \
-v mkosi-cache:/root/.cache/mkosi -v mkosi-work:/var/tmp -w /repo mkosi-vm -v mkosi-cache:/root/.cache/mkosi -v mkosi-work:/var/tmp -w /repo mkosi-vm
podman exec mkosi mkosi -f genkey # Run this once. Don't commit mkosi.crt.
podman exec mkosi mkdir -p mkosi.cache podman exec mkosi mkdir -p mkosi.cache
podman exec -d -t mkosi sh -c 'mkosi -i -f --kernel-command-line-extra="\ podman exec -d -t mkosi sh -c 'mkosi -i -f --kernel-command-line-extra="\
console=ttyS0 systemd.journald.forward_to_console=1" vm -- \ console=ttyS0 systemd.journald.forward_to_console=1" vm -- \
-serial chardev:console > mkosi.output/vm.log 2>&1' -serial chardev:console > mkosi.output/vm.log 2>&1'
``` ```
- mkosi signs with the test key of `mkosi.local.conf`
([README.md](README.md#development)), with paths as the container sees them.
- To register the test VM, register on the host with - To register the test VM, register on the host with
`gitea-runner register --no-interactive --instance <url> --token <token>` `gitea-runner register --no-interactive --instance <url> --token <token>`
and pass the `.runner` it writes as a tmpfiles.extra credential: and pass the `.runner` it writes as a tmpfiles.extra credential:
+2 -20
View File
@@ -38,29 +38,11 @@ at first boot.
## Development ## Development
`mkosi build` signs with `mkosi.key`, the private key of `mkosi.crt`, which
only CI has (the `SECUREBOOT_KEY` secret). `mkosi genkey` won't replace
`mkosi.crt`, so local builds sign with a test key. Make one:
```sh ```sh
openssl req -new -x509 -newkey rsa:2048 -nodes -subj /CN=test \ mkosi -f genkey # This replaces mkosi.crt for local tests. Don't commit it.
-keyout ~/test.key -out ~/test.crt mkosi build
``` ```
and point `mkosi.local.conf` at it, which mkosi reads and git ignores:
```ini
[Validation]
SecureBootKey=~/test.key
SecureBootCertificate=~/test.crt
SignExpectedPcrKey=~/test.key
SignExpectedPcrCertificate=~/test.crt
VerityKey=~/test.key
VerityCertificate=~/test.crt
```
Then run `mkosi build`.
`mkosi.output/` then holds the disk image (`runneros_<version>.raw`) and the `mkosi.output/` then holds the disk image (`runneros_<version>.raw`) and the
UKI and /usr partitions that make up an update. To boot a test VM, see UKI and /usr partitions that make up an update. To boot a test VM, see
[AGENTS.md](AGENTS.md#testing). [AGENTS.md](AGENTS.md#testing).