From 310e3534e34ebfd205c2ecce7f8d679ca4ccd3b9 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 10 May 2026 08:29:20 +0200 Subject: [PATCH 1/5] Created the base for mkosi --- .../mkarchiso/build_iso.sh | 0 test_tooling/mkosi/mkosi.conf | 49 +++++++++++++++++++ .../getty@tty1.service.d/autologin.conf | 3 ++ test_tooling/mkosi/mkosi.postinst.chroot | 3 ++ test_tooling/mkosi/mkosi.profiles/archinstall | 43 ++++++++++++++++ 5 files changed, 98 insertions(+) rename build_iso.sh => test_tooling/mkarchiso/build_iso.sh (100%) create mode 100644 test_tooling/mkosi/mkosi.conf create mode 100644 test_tooling/mkosi/mkosi.extra/etc/systemd/system/getty@tty1.service.d/autologin.conf create mode 100644 test_tooling/mkosi/mkosi.postinst.chroot create mode 100644 test_tooling/mkosi/mkosi.profiles/archinstall diff --git a/build_iso.sh b/test_tooling/mkarchiso/build_iso.sh similarity index 100% rename from build_iso.sh rename to test_tooling/mkarchiso/build_iso.sh diff --git a/test_tooling/mkosi/mkosi.conf b/test_tooling/mkosi/mkosi.conf new file mode 100644 index 0000000000..814652fca0 --- /dev/null +++ b/test_tooling/mkosi/mkosi.conf @@ -0,0 +1,49 @@ +[Distribution] +Distribution=arch +# LocalMirror=file:///var/lib/localmirror + +[Output] +Format=uki +# Format=disk + +[Include] +Include=mkosi-vm + +[Validation] +SecureBoot=false +SecureBootAutoEnroll=false +Sign=false +# Signing artifacts (hashsums etc) using a GPG key: +# Key=D4B58E897A929F2E +# Signing secure boot using PIV on yubikey: +# SecureBoot=true +# SecureBootKey=pkcs11: +# SecureBootCertificate=secureboot.crt + +[Content] +Packages= + pacman + archlinux-keyring + amd-ucode + intel-ucode +# tpm2-tss +# libfido2 +# libp11-kit +WithDocs=false +RootPassword=toor +Timezone=Europe/Stockholm +Keymap=sv-latin1 +InitrdProfiles=network + +[Config] +Profiles=archinstall + +[Build] +Incremental=true +ToolsTree=default +ToolsTreeProfiles=devel,misc,package-manager,runtime,gui + +[Runtime] +Console=gui +CPUs=4 +RAM=8G diff --git a/test_tooling/mkosi/mkosi.extra/etc/systemd/system/getty@tty1.service.d/autologin.conf b/test_tooling/mkosi/mkosi.extra/etc/systemd/system/getty@tty1.service.d/autologin.conf new file mode 100644 index 0000000000..161d4952ef --- /dev/null +++ b/test_tooling/mkosi/mkosi.extra/etc/systemd/system/getty@tty1.service.d/autologin.conf @@ -0,0 +1,3 @@ +[Service] +ExecStart= +ExecStart=-/usr/bin/agetty --noreset --noclear --autologin root - ${TERM} \ No newline at end of file diff --git a/test_tooling/mkosi/mkosi.postinst.chroot b/test_tooling/mkosi/mkosi.postinst.chroot new file mode 100644 index 0000000000..88809b6a9f --- /dev/null +++ b/test_tooling/mkosi/mkosi.postinst.chroot @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +git clone https://github.com/archlinux/archinstall.git /root/archinstall \ No newline at end of file diff --git a/test_tooling/mkosi/mkosi.profiles/archinstall b/test_tooling/mkosi/mkosi.profiles/archinstall new file mode 100644 index 0000000000..644fe388ff --- /dev/null +++ b/test_tooling/mkosi/mkosi.profiles/archinstall @@ -0,0 +1,43 @@ +[Content] +Packages= + acpid + intel-media-driver + linux-firmware + linux-firmware-intel + ca-certificates-mozilla + ca-certificates-utils + nano + gvfs + noto-fonts + cantarell-fonts + ttf-dejavu + polkit + bash + bzip2 + coreutils + file + filesystem + findutils + gawk + gcc-libs + gettext + glibc + grep + gzip + iproute2 + iputils + licenses + pciutils + procps-ng + psmisc + sed + tar + linux + diffutils + less + strace + util-linux + xz + git +WithDocs=false +KernelCommandLine=quiet splash \ No newline at end of file From f98352fcd5031c742abac9adac964b44ad92c482 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 10 May 2026 20:37:05 +0200 Subject: [PATCH 2/5] Added final packages for testing archinstall --- .gitignore | 4 ++++ test_tooling/mkosi/mkosi.cache/.gitkeep | 0 test_tooling/mkosi/mkosi.conf | 1 + test_tooling/mkosi/mkosi.extra/root/.profile | 5 +++++ test_tooling/mkosi/mkosi.postinst.chroot | 5 ++++- test_tooling/mkosi/mkosi.profiles/archinstall | 10 ++++++++++ test_tooling/mkosi/mkosi.version | 1 + 7 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 test_tooling/mkosi/mkosi.cache/.gitkeep create mode 100644 test_tooling/mkosi/mkosi.extra/root/.profile mode change 100644 => 100755 test_tooling/mkosi/mkosi.postinst.chroot create mode 100644 test_tooling/mkosi/mkosi.version diff --git a/.gitignore b/.gitignore index 376bdbd535..ac85706287 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,7 @@ requirements.txt /cmd_output.txt node_modules/ uv.lock +test_tooling/mkosi/*image* +test_tooling/mkosi/mkosi.cache/** +test_tooling/mkosi/mkosi.tools/** +test_tooling/mkosi/mkosi.tools.manifest diff --git a/test_tooling/mkosi/mkosi.cache/.gitkeep b/test_tooling/mkosi/mkosi.cache/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test_tooling/mkosi/mkosi.conf b/test_tooling/mkosi/mkosi.conf index 814652fca0..fdc366132d 100644 --- a/test_tooling/mkosi/mkosi.conf +++ b/test_tooling/mkosi/mkosi.conf @@ -42,6 +42,7 @@ Profiles=archinstall Incremental=true ToolsTree=default ToolsTreeProfiles=devel,misc,package-manager,runtime,gui +WithNetwork=yes [Runtime] Console=gui diff --git a/test_tooling/mkosi/mkosi.extra/root/.profile b/test_tooling/mkosi/mkosi.extra/root/.profile new file mode 100644 index 0000000000..c8d1791bdd --- /dev/null +++ b/test_tooling/mkosi/mkosi.extra/root/.profile @@ -0,0 +1,5 @@ +cd archinstall-git +rm -rf dist + +uv build --no-build-isolation --wheel +uv pip install dist/*.whl --break-system-packages --system --no-build --no-deps \ No newline at end of file diff --git a/test_tooling/mkosi/mkosi.postinst.chroot b/test_tooling/mkosi/mkosi.postinst.chroot old mode 100644 new mode 100755 index 88809b6a9f..c49c7a7fa3 --- a/test_tooling/mkosi/mkosi.postinst.chroot +++ b/test_tooling/mkosi/mkosi.postinst.chroot @@ -1,3 +1,6 @@ #!/usr/bin/env bash -git clone https://github.com/archlinux/archinstall.git /root/archinstall \ No newline at end of file +git clone https://github.com/archlinux/archinstall.git /root/archinstall-git +curl -s "https://archlinux.org/mirrorlist/?country=SE&protocol=https&use_mirror_status=on" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 5 - > /etc/pacman.d/mirrorlist + +# TODO: Set geo-mirrors statically instead \ No newline at end of file diff --git a/test_tooling/mkosi/mkosi.profiles/archinstall b/test_tooling/mkosi/mkosi.profiles/archinstall index 644fe388ff..055e000f9b 100644 --- a/test_tooling/mkosi/mkosi.profiles/archinstall +++ b/test_tooling/mkosi/mkosi.profiles/archinstall @@ -38,6 +38,16 @@ Packages= strace util-linux xz + pacman-contrib + gcc git + pkgconfig + python + python-pip + python-uv + python-setuptools + python-pyparted + python-pydantic + python-textual WithDocs=false KernelCommandLine=quiet splash \ No newline at end of file diff --git a/test_tooling/mkosi/mkosi.version b/test_tooling/mkosi/mkosi.version new file mode 100644 index 0000000000..62f9457511 --- /dev/null +++ b/test_tooling/mkosi/mkosi.version @@ -0,0 +1 @@ +6 \ No newline at end of file From a145ba5d8115ca18fc58615e5ce98b6133e9bcdf Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 10 May 2026 22:15:51 +0200 Subject: [PATCH 3/5] Added a mkosi.output/ folder to tidy things up --- test_tooling/mkosi/mkosi.output/.gitkeep | 0 test_tooling/mkosi/mkosi.version | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 test_tooling/mkosi/mkosi.output/.gitkeep diff --git a/test_tooling/mkosi/mkosi.output/.gitkeep b/test_tooling/mkosi/mkosi.output/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test_tooling/mkosi/mkosi.version b/test_tooling/mkosi/mkosi.version index 62f9457511..c7930257df 100644 --- a/test_tooling/mkosi/mkosi.version +++ b/test_tooling/mkosi/mkosi.version @@ -1 +1 @@ -6 \ No newline at end of file +7 \ No newline at end of file From 9a44ea0014e115f1c903c9d8d2ceacce966da852 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 12 May 2026 20:35:13 +0200 Subject: [PATCH 4/5] Added missing packages for archinstall to work (more might be needed, if different disk filesystems are used. --- .gitignore | 2 +- test_tooling/mkosi/mkosi.postinst.chroot | 6 +++++- test_tooling/mkosi/mkosi.profiles/archinstall | 3 +++ test_tooling/mkosi/mkosi.version | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index ac85706287..54c865e011 100644 --- a/.gitignore +++ b/.gitignore @@ -41,7 +41,7 @@ requirements.txt /cmd_output.txt node_modules/ uv.lock -test_tooling/mkosi/*image* +test_tooling/mkosi/mkosi.output/*image* test_tooling/mkosi/mkosi.cache/** test_tooling/mkosi/mkosi.tools/** test_tooling/mkosi/mkosi.tools.manifest diff --git a/test_tooling/mkosi/mkosi.postinst.chroot b/test_tooling/mkosi/mkosi.postinst.chroot index c49c7a7fa3..096857e8ee 100755 --- a/test_tooling/mkosi/mkosi.postinst.chroot +++ b/test_tooling/mkosi/mkosi.postinst.chroot @@ -1,6 +1,10 @@ #!/usr/bin/env bash git clone https://github.com/archlinux/archinstall.git /root/archinstall-git +(cd /root/archinstall-git && git checkout master) + +# TODO: Set geo-mirrors statically instead curl -s "https://archlinux.org/mirrorlist/?country=SE&protocol=https&use_mirror_status=on" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 5 - > /etc/pacman.d/mirrorlist -# TODO: Set geo-mirrors statically instead \ No newline at end of file +pacman-key --init +pacman-key --populate archlinux \ No newline at end of file diff --git a/test_tooling/mkosi/mkosi.profiles/archinstall b/test_tooling/mkosi/mkosi.profiles/archinstall index 055e000f9b..75628b6154 100644 --- a/test_tooling/mkosi/mkosi.profiles/archinstall +++ b/test_tooling/mkosi/mkosi.profiles/archinstall @@ -49,5 +49,8 @@ Packages= python-pyparted python-pydantic python-textual + dosfstools + btrfs-progs + arch-install-scripts WithDocs=false KernelCommandLine=quiet splash \ No newline at end of file diff --git a/test_tooling/mkosi/mkosi.version b/test_tooling/mkosi/mkosi.version index c7930257df..3cacc0b93c 100644 --- a/test_tooling/mkosi/mkosi.version +++ b/test_tooling/mkosi/mkosi.version @@ -1 +1 @@ -7 \ No newline at end of file +12 \ No newline at end of file From 57fa3ce562320c2383602d1a3aea205277c6977c Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 12 May 2026 20:57:43 +0200 Subject: [PATCH 5/5] Added a small readme on how to use mkosi with archinstall --- test_tooling/mkosi/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test_tooling/mkosi/README.md diff --git a/test_tooling/mkosi/README.md b/test_tooling/mkosi/README.md new file mode 100644 index 0000000000..d26d0d9fee --- /dev/null +++ b/test_tooling/mkosi/README.md @@ -0,0 +1,12 @@ +# To build + + mkosi build -B + +# To run + + mkosi qemu \ + --drive=archinstall_small:25G \ + -- \ + -device nvme,serial=archinstall_small,drive=archinstall_small + +*note: in order to boot the installation, we need to disable UKI being added to -kernel. I don't know of a way to do this yet, unless we tinker with mkosi/qemu.py - https://github.com/Torxed/mkosi/commit/6f3c20802bd73f88b672cc96ef0db1e542084316 - in which case we could do: `mkosi qemu --drive=archinstall_small:25G -- -device nvme,serial=archinstall_small,drive=archinstall_small,bootindex=0 -kernel none` but it still won't boot properly.* \ No newline at end of file