Monarch
Monarch is an Arch-based server distribution for KVM hosts. You install it from a browser: the live ISO serves a web installer on your LAN, and you finish the setup from a laptop or phone.
-
Base: Arch core/extra plus the CachyOS generic x86-64 repo only. There are no v3/v4 packages, because those need AVX2, which older Xeons such as the E5-2680 v2 lack. Also:
linux-ltswith headers, Intel and AMD microcode, ext4 root, and GRUB for BIOS and UEFI (including the removable fallback path). -
Preinstalled:
yay(yay-bin),monarch-daemon(always enabled), optionallymonarch-panel,btop,zshwith oh-my-zsh as every user's shell,fastfetchwith a Monarch butterfly logo,git,sudo,openssh,pacman-contrib,wireguard-tools, andnetclientv1.7.0 (pinned by checksum). -
Virtualization: exactly
qemu-full qemu-img libvirt virt-install edk2-ovmf dnsmasq swtpm.qemu.confruns QEMU aslibvirt-qemu:libvirt-qemu./home/QEMU/{ISO,QCOW}are owned by libvirt-qemu and set up as the autostarted poolsISOandQCOW.- The admin user is in
wheel libvirt libvirt-qemu kvm. - Nested KVM and IOMMU (
intel_iommu=on iommu=pt) are optional.
-
Network: systemd-networkd and resolved.
- The bridge
virtbr0sits on top of the chosen NIC and carries the NIC's MAC address, so DHCP reservations keep working. - The address is fixed or DHCP.
- The libvirt network
lan(bridge mode) is the default for new VMs. NATdefaultstays.
- The bridge
-
Storage: an ext4 system disk plus optional LVM data volumes:
- single disk, linear, RAID 1/5/6/10 (LVM raid)
- an optional SSD cache (dm-cache, writethrough by default)
- one SSD can serve several caches, and can be shared with the system disk.
A cache guard checks the cache SSDs' SMART health every 10 minutes. On a failing SSD it switches a writeback cache to writethrough, which flushes the dirty blocks. It also reports the problem to the Monarch panel.
-
/etc/os-releasesaysNAME="Monarch"(ID=monarch,ID_LIKE=arch). pacman keeps it on updates (NoUpgrade).
Build
On an Arch or CachyOS machine:
sudo pacman -S --needed archiso base-devel git nodejs npm dotnet-sdk librsvg ttf-dejavu jq
The build has two or three steps. The script never runs sudo itself: a step that needs root says
so and prints the exact command.
./build.sh packages # as your user: AUR packages, netclient, web installer, branding
sudo ./build.sh offline # optional: include every package, for installs without internet
sudo ./build.sh iso # mkarchiso -> out/monarch-0.1.0-x86_64.iso
packages:- Builds
yay-bin, the Temurin JDKs andclyocloudfrom the AUR andmonarch-daemon,monarch-panelfrom their repos withmakepkg.generic.conf(-march=x86-64,GOAMD64=v1) into the ISO's local repo[monarch]. - Downloads netclient and refuses it unless the SHA-256 matches the pinned value in
build.sh. - Runs the installer's tests, builds it (
installer/.output), and copies it to/usr/local/lib/monarch/installerin the ISO. - Renders the GRUB and syslinux backgrounds from
branding/*.svg.
- Builds
offline: downloads every package the installed system can need (the planner's package list plus the panel) with all its dependencies into the repo, then marks the repoOFFLINE. The ISO grows by several GB. The installer then uses only that repo../build.sh cleanremoves the marker; deleteprofile/airootfs/usr/local/share/monarch/repoto also drop the downloaded packages.iso: checks that everything is present, including the netclient checksum, then runsmkarchiso.
To update netclient, change NETCLIENT_VERSION and NETCLIENT_SHA256 together. GitHub shows the
SHA-256 as the release asset's digest.
Build on the CI server (OneDev)
The jobs in .onedev-buildspec.yml: Installer tests on every push, Build ISO on tag creation or "Run job",
Build ISO (offline) by "Run job". The ISO and SHA256SUMS are published as build artifacts.
The CI runner stays an unprivileged user (onedev). mkarchiso needs root, so ci/build-iso.sh hands over to a
small root helper that onedev may run through sudo, and nothing else. One-time setup on the build server:
sudo pacman -Syu --needed archiso base-devel git nodejs npm dotnet-sdk librsvg ttf-dejavu jq curl
sudo pacman-key --recv-keys F3B607488DB35A47 --keyserver hkps://keyserver.ubuntu.com && sudo pacman-key --lsign-key F3B607488DB35A47
sudo useradd --system --create-home --home-dir /var/lib/monarch-build --shell /usr/bin/nologin monarch-build
echo 'monarch-build ALL=(root) NOPASSWD: /usr/bin/pacman' | sudo tee /etc/sudoers.d/90-monarch-build
curl -fsSL https://code.weexnes.dev/monarch/linux/~raw/main/ci/monarch-build-iso | sudo install -o root -g root -m 0755 /dev/stdin /usr/local/sbin/monarch-build-iso
echo 'onedev ALL=(root) NOPASSWD: /usr/local/sbin/monarch-build-iso' | sudo tee /etc/sudoers.d/91-monarch-ci
sudo chmod 0440 /etc/sudoers.d/9*-monarch-* && sudo visudo -c
The packages are built as monarch-build (makepkg refuses root), with clones cached in /var/lib/monarch-build.
Note: whoever can push to this repository can run code as root on the build server through this job, as with any
CI that builds images as root.
Boot
Write the ISO to a USB stick. Replace /dev/sdX with the stick; everything on it is erased:
sudo dd if=out/monarch-0.1.0-x86_64.iso of=/dev/sdX bs=4M oflag=direct status=progress conv=fsync
Or mount it virtually via IPMI or iDRAC. It boots in both legacy BIOS (syslinux) and UEFI
(systemd-boot), and "copy to RAM" frees the stick after boot. The server needs a wired network with
DHCP, and internet access unless the ISO was built with offline.
Install from the browser
The server's first console (tty1, also visible over IPMI) shows:
https://<address>/for every LAN address, plus a QR code for the first one- a one-time access code
- the SHA-256 fingerprint of the installer's self-signed certificate
Steps:
- Open the URL on a computer or phone on the same network.
- The browser warns about the certificate. Compare its SHA-256 fingerprint with the one on the console before you continue.
- Enter the access code. It gives you a session cookie for 12 hours.
The installer only answers on private addresses (RFC 1918, CGNAT, link-local, ULA). nftables on the live system drops everything else; there is no SSH on the live system.
The wizard steps are Hardware, System, Users, Storage, Network, Virtualization, Fleet, Review and
Install. Nothing touches a disk until you type ERASE on the Review page.
-
Storage: give every disk a role by dragging it, or with its "Use as…" menu on a phone:
- System: the whole disk or a fixed size. The rest of an SSD can hold caches.
- Data volume: single, linear or RAID 1/5/6/10, mounted where you like (for example
/home/QEMU). - Cache: an SSD partition in front of one data volume. One SSD can hold several. Writethrough is the default; writeback needs an explicit risk confirmation.
- Unused: never touched.
The layout diagram shows disk → partition → VG → LV → cache → mount, with the usable capacity.
-
Network: pick the NIC for the bridge and a fixed or DHCP address. The exact
systemd-networkdand libvirt files are previewed. -
Fleet:
- Run the Monarch panel here (the local daemon joins it automatically), or join a panel on another machine with a join token and fingerprint on first boot.
- Optionally add a Netmaker enrollment token.
- The tokens are deleted after they are used.
-
Review: a summary, the list of disks that will be erased, and the dry run: every command and every generated file, exactly as the installer will run them, with passwords and tokens hidden.
-
Install: live progress over a WebSocket. When it finishes, remove the stick and reboot.
The install log is /run/monarch/install.log on the live system and /var/log/monarch-install.log
on the installed one.
First boot
monarch-firstboot.service runs once. It installs netclient's service and joins Netmaker if a token
was given, joins the remote Monarch panel if configured, and starts the ISO/QCOW pools and
the lan network. With the panel on the server, open https://<server>:4382.
Updates
Everything on an installed Monarch updates the normal Arch way: yay -Syu.
- Arch and CachyOS packages come from their repos.
/etc/os-releasestays Monarch's (NoUpgradeinpacman.conf). monarch-panel,monarch-daemon,clyocloud,yay-binand the Temurin JDKs come from the AUR. The ISO contains builds of exactly these AUR packages, soyaytreats them as AUR packages afterwards. Each project's CI publishes new versions to the AUR on release.- ClyoCloud is the unmodified AUR package. Monarch's integration lives only in files no package owns, so updates
never undo it:
/etc/systemd/system/clyocloud.service.d/zz-monarch.conf: runs as theclyoclouduser, loads the settings below, sandboxed, waits for the data volume. Namedzz-so it always wins over the package's ownoverride.conf./etc/clyocloud/clyocloud.env(data paths, port) and/etc/clyocloud/secret.env(session secret)./etc/sysusers.d/monarch-clyocloud.conf,/etc/tmpfiles.d/monarch-clyocloud.conf(user and folders).
Recovery
-
On the live system: Alt+F2 opens a root shell (no password; console access only). Useful commands:
journalctl -u monarch-installerlsblk,lvs -a,smartctl -a /dev/sdXcat /run/monarch/access-codesystemctl restart monarch-installer(this gives a new access code)
-
Failed install: the error and log are shown in the browser. Fix the cause, go back to Review, and install again. The disks may be partly written; the installer releases (unmounts and deactivates) them again on the next run.
-
Installed system won't boot: boot the ISO, switch to tty2, then:
mount /dev/<disk>3 /mnt && mount /dev/<disk>2 /mnt/boot/efi arch-chroot /mnt grub-install --target=x86_64-efi --efi-directory=/boot/efi --removable grub-install --target=i386-pc /dev/<disk> grub-mkconfig -o /boot/grub/grub.cfgData volumes are
/dev/vg_<name>/data; runvgchange -ayfirst. -
Cache SSD failing:
- The cache guard switches writeback to writethrough and logs to the journal
(
journalctl -t monarch-cache-guard). - The Monarch panel shows the problem in the node's Storage tab and can notify you (Settings → Notifications → "Cache SSD failing").
- Remove the cache in the Storage tab (or
lvconvert --uncache vg_<name>/data), replace the SSD, and add a cache again.
- The cache guard switches writeback to writethrough and logs to the journal
(
Layout of this repository
| Path | What |
|---|---|
profile/ |
archiso profile: packages, boot menus, live system overlay (airootfs/) |
profile/airootfs/usr/local/share/monarch/assets/ |
installed onto the target: first boot, cache guard, issue (the GRUB theme is rendered at build time) |
installer/ |
Nuxt 4 web installer. shared/utils/plan.ts turns the wizard's config into the exact list of operations (also the dry run); server/utils/runner.ts runs them. No shell: every command is an argv array, and secrets go through stdin. |
branding/ |
logo, GRUB theme and boot splash sources |
build.sh |
the build |
Tests: cd installer && npx vitest run (storage scenarios, validation, secrets never in the dry run).