LWN: Comments on "The mkosi OS generation tool" https://lwn.net/Articles/726655/ This is a special feed containing comments posted to the individual LWN article titled "The mkosi OS generation tool". en-us Sat, 18 Oct 2025 04:39:42 +0000 Sat, 18 Oct 2025 04:39:42 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Use cases https://lwn.net/Articles/866511/ https://lwn.net/Articles/866511/ GNUtoo <div class="FormattedComment"> Hi,<br> <p> I&#x27;ve been looking for some software with the abstraction of mkosi for a long time.<br> <p> The first thing that came to my mind are things like vagrant[1] and packer[2] to<br> create system images in a variety of formats, but they seem better adapted at<br> modifying existing base images than creating them from scratch.<br> <p> So to build an image with vagrand and/or packer you could either:<br> <p> - Use one of the images made by hashicorp (the company behind packer and<br> vagrant), or the community of its users[3][4] as a base. The issue here<br> is that it might not be possible to trust these images in the same way<br> than images that are part of official distribution releases. This is<br> because the vagrant repositories and the distributions have different<br> policies.<br> <p> - Use official VM images or cloud images from distributions as a base.<br> The issue here is that not all the distributions have such images, and<br> you might also want to build types of images that aren&#x27;t released by your<br> distribution (like add integrity checking, or use the latest packages<br> instead of the ones from the last release).<br> <p> - Build base images from official distributions installers. The issue here<br> is that, even if it can work, sending keystrokes once the installer is<br> booted doesn&#x27;t seem like the right abstraction to me[5].<br> <p> - Like Tails, you could also write yourself the code to generate that base<br> image[6], but the limitation here is that it might not work for all the<br> images types, and it would probably be better to have some common project<br> to do something like that instead.<br> <p> Guix[7] (and probably Nix as well) already solved this issue as you can package<br> the same software in several way (in a VM[8], in a disk image[8], in a debian<br> package[9], in a docker container[9], etc). And in some cases where it produces<br> a booting system (like with the VM, disk image, or docker container) there is<br> also an API that takes care of the configuration of some applications like Nginx.<br> <p> The issue is that not everyone wants to use Guix, so having some of these<br> features available for other distributions is a good idea I think.<br> <p> And here mkosi has the ability to build base images using the bootstrap tools<br> like debootstrap, pacstrap, and so on to build images. So that looks useful<br> even if it&#x27;s not going to enable users to install any distribution from any<br> distribution, but work inside distributions and bootstrap tools could be done<br> to imrpove the situation.<br> <p> The big limitation in the case of mkosi seems to be that it took the decision<br> to be legacy free (its manual states &quot;mkosi - Build Legacy-Free OS Images&quot;).<br> <p> Unfortunately the &quot;legacy free&quot; seems to limit a lot the use cases:<br> - Some distributions are still supporting computers with i686 processors, so<br> using mkosi to create official installer or VM images won&#x27;t work here.<br> - Many ARM computers have system on a chip that can boot on block devices and<br> that load the bootloader from either an offset on the block device, or in<br> a FAT MBR partition. The later cannot be supported with mkosi.<br> - Some modern computers running Libreboot or Coreboot, and some VMs use<br> SeaBIOS for simplicity. Here again it can&#x27;t produce images with MBR.<br> <p> I&#x27;ll also try to look at alternatives of mkosi that have the same abstraction level as that abstraction level really seem to fit many of the use cases I have.<br> <p> References:<br> -----------------<br> [1]<a rel="nofollow" href="https://www.vagrantup.com">https://www.vagrantup.com</a><br> [2]<a rel="nofollow" href="https://www.packer.io">https://www.packer.io</a><br> [3]<a rel="nofollow" href="https://www.vagrantup.com/vagrant-cloud/boxes#vagrant-box-catalog-and-discovery">https://www.vagrantup.com/vagrant-cloud/boxes#vagrant-box...</a><br> [4]<a rel="nofollow" href="https://www.vagrantup.com/vagrant-cloud/boxes/catalog">https://www.vagrantup.com/vagrant-cloud/boxes/catalog</a><br> [5]<a rel="nofollow" href="https://www.packer.io/docs/builders/virtualbox/ovf#boot-configuration">https://www.packer.io/docs/builders/virtualbox/ovf#boot-c...</a><br> [6]<a rel="nofollow" href="https://gitlab.tails.boum.org/tails/tails/-/raw/master/vagrant/definitions/tails-builder/generate-tails-builder-box.sh">https://gitlab.tails.boum.org/tails/tails/-/raw/master/va...</a><br> [7]<a rel="nofollow" href="https://guix.gnu.org/">https://guix.gnu.org/</a><br> [8]with guix system image<br> [9]with guix pack<br> <p> Denis.<br> </div> Tue, 17 Aug 2021 00:13:30 +0000 The mkosi OS generation tool https://lwn.net/Articles/802717/ https://lwn.net/Articles/802717/ dexit well I for one did look at KIWI but it supports a rather limited set of hosts and target OS-images. Then again, mkosi fails for all targets save Debian, of course. A clear lose-lose situation. Sun, 20 Oct 2019 15:16:16 +0000 The mkosi OS generation tool https://lwn.net/Articles/802716/ https://lwn.net/Articles/802716/ dexit <div class="FormattedComment"> <p> On Manjaro in Oct. 2019, only the Debian image gets created successfully. <br> <p> Arch, Fedora, Centos, ClearLinux, Ubuntu, Mageia, OpenSUSE all fail for one reason or another. However sometimes its just that the packager tools such as zypper for SUSE do not build from AUR or anyhow. <br> <p> In other cases the python error suggests some mkosi problem. btw: Arch pacstrap is here: <a rel="nofollow" href="https://projects.archlinux.org/arch-install-scripts.git/tree/pacstrap.in">https://projects.archlinux.org/arch-install-scripts.git/t...</a><br> </div> Sun, 20 Oct 2019 14:45:54 +0000 The mkosi OS generation tool https://lwn.net/Articles/727233/ https://lwn.net/Articles/727233/ nix <div class="FormattedComment"> Yeah. I wish there was a faster way to share existing host filesystems than NFS over localhost, but there doesn't seem to be one... (and NFSv4 is pretty nippy, actually. It's only if you're stuck on v3 or God forbid v2 that it starts to bite hard.)<br> </div> Wed, 05 Jul 2017 23:23:47 +0000 lxd on Fedora https://lwn.net/Articles/726990/ https://lwn.net/Articles/726990/ iainn <div class="FormattedComment"> Ah. I had been considering a COPR repo (similar to a PPA) to install LXD on Fedora. The LXD package from the COPR doesn't support SELinux unfortunately.<br> <p> But thanks, that's good to know. I hadn't considered a Snap package. Nor had I seen the recent news that snaps work on Fedora with SELinux.<br> <p> <p> </div> Mon, 03 Jul 2017 09:41:58 +0000 The mkosi OS generation tool https://lwn.net/Articles/726982/ https://lwn.net/Articles/726982/ rahulsundaram <div class="FormattedComment"> <font class="QuotedText">&gt;A full time paid employee that did it? </font><br> <p> That is a really weak rationale to think that this is done under some organizational direction. systemd itself was written by Lennart on his own time originally.<br> </div> Sun, 02 Jul 2017 21:46:06 +0000 The mkosi OS generation tool https://lwn.net/Articles/726981/ https://lwn.net/Articles/726981/ jospoortvliet <div class="FormattedComment"> A full time paid employee that did it? Who is working in and around this stack? I know rh doesn't work that black and white and I know lennart well enough to know he was most likely not told to do this but it isn't a crazy assumption...<br> </div> Sun, 02 Jul 2017 21:15:51 +0000 The mkosi OS generation tool https://lwn.net/Articles/726971/ https://lwn.net/Articles/726971/ rahulsundaram <div class="FormattedComment"> <font class="QuotedText">&gt; Seems to me another NIH here by RH. </font><br> <p> What makes you think Red Hat is deciding this?<br> </div> Sun, 02 Jul 2017 15:02:48 +0000 The mkosi OS generation tool https://lwn.net/Articles/726963/ https://lwn.net/Articles/726963/ mrdocs <div class="FormattedComment"> I'm wondering why no one looked at <a rel="nofollow" href="https://github.com/SUSE/kiwi">https://github.com/SUSE/kiwi</a> It also builds for RH and Debian, as well as many output formats, ISO, docker images, cloud images etc. <br> <p> Seems to me another NIH here by RH. <br> </div> Sun, 02 Jul 2017 03:39:14 +0000 The mkosi OS generation tool https://lwn.net/Articles/726958/ https://lwn.net/Articles/726958/ sbaugh <div class="FormattedComment"> 9P shouldn't be used to boot a container with QEMU/KVM in production, though. It's too slow and quite insecure. So building GPT disk images is still very useful.<br> </div> Sun, 02 Jul 2017 01:33:42 +0000 The mkosi OS generation tool https://lwn.net/Articles/726905/ https://lwn.net/Articles/726905/ stgraber <div class="FormattedComment"> Hmm, I'm the LXD project leader and we do run automated tests on Fedora 25 using LXD installed through snapd on systems that have SELinux in enforced mode, so you shouldn't have to turn it off.<br> <p> sudo dnf install snapd<br> sudo snap install lxd<br> sudo lxd init<br> </div> Fri, 30 Jun 2017 16:57:57 +0000 The mkosi OS generation tool https://lwn.net/Articles/726845/ https://lwn.net/Articles/726845/ gdamjan <div class="FormattedComment"> that's only practical now with the support for multi-stage builds (perhaps, I haven't looked too deeply into it)<br> </div> Fri, 30 Jun 2017 08:30:46 +0000 The mkosi OS generation tool https://lwn.net/Articles/726802/ https://lwn.net/Articles/726802/ iainn <div class="FormattedComment"> It's a useful tool, which coincidentally I discovered this week.<br> <p> I wanted an easy way of spinning up another distro. My first thought was to check if LXD were suitable, but to use LXD on Fedora you have to disable SELinux. My second thought was Docker, but it wasn't suitable because I wanted to persist state changes.<br> <p> I found mkosi + systemd-nspawn slightly easier, and hopefully provide better isolation, than setting up a chroot.<br> </div> Thu, 29 Jun 2017 17:37:43 +0000 The mkosi OS generation tool https://lwn.net/Articles/726799/ https://lwn.net/Articles/726799/ zlynx <div class="FormattedComment"> If it gets complicated you pull in a layer that has an actual script in it. Then call that instead of trying to duplicate Puppet or whatever in Dockerfile.<br> </div> Thu, 29 Jun 2017 17:05:41 +0000 The mkosi OS generation tool https://lwn.net/Articles/726747/ https://lwn.net/Articles/726747/ gdamjan <div class="FormattedComment"> the fs layers are a good idea in docker (if inefficient)<br> <p> The docker file itself, is just awful. It's like a worse shell script<br> </div> Thu, 29 Jun 2017 13:16:00 +0000 The mkosi OS generation tool https://lwn.net/Articles/726719/ https://lwn.net/Articles/726719/ rahulsundaram <div class="FormattedComment"> A lot of tools listed in that page seem pretty Debian specific though.<br> </div> Thu, 29 Jun 2017 02:11:24 +0000 The mkosi OS generation tool https://lwn.net/Articles/726718/ https://lwn.net/Articles/726718/ pabs <div class="FormattedComment"> The proliferation of tools in this space is incredible:<br> <p> <a href="https://wiki.debian.org/SystemBuildTools">https://wiki.debian.org/SystemBuildTools</a><br> </div> Thu, 29 Jun 2017 01:29:30 +0000 The mkosi OS generation tool https://lwn.net/Articles/726667/ https://lwn.net/Articles/726667/ jgg <div class="FormattedComment"> Sure docker can, I've done it a few times. You start with the default dockerhub image for the OS and the install a few packages (eg grub, a kernel, etc) and a few other small modifications. Trivially embodied in a dockerfile and the result is something that can boot containerised systemd as pid 1 or be poured into a disk image and booted on bare metal. The same kind of basic steps you need to do anyhow if you used debbootstrap.. Docker just caches it and makes the initial image available no matter what the host OS is.<br> <p> In the mainstream container world the popular way to run a container under kvm is with 9pfs (eg in rkt), this is what I mean by 'unique'. This is actually where I ended up after trying mkosi for systemd. Instead, I built systemd using a building container (with a script similar to the one I linked), then 'make installed' it into a temporary running container and directly ran kvm and 9pfs exporting the containers / as rootfs to run the build. Much faster than building an image, and I get more trivial points to customise things I need, like using my own kernel build or modifying the FS before booting to test the stuff I needed..<br> <p> For mkosi it was the initial package extracting/install that failed for me, and it didn't cache the download step before that, so the entire thing was a PITA to debug. It also seemed like it wanted to run various loop devices and other things on the host when it was building the image, which I'd honestly rather it do inside a privileged container.. I also gave up trying to build a Fedora boot image from my Ubuntu box (again, needs too many host dependencies).<br> <p> IMHO, the thing about docker, is it has one really good idea - dockerfile, with the overlayfs based caching layers and downloadable seed - and a bunch of not so good, out dated execution around that good idea. systemd has good execution in systemd-nspawnd, rkt provides most of the orchestration piece on top of that, but that entire world lacks a refined equivalent to dockerfile to make the images in the first place..<br> <p> You are right, I used something between v1-v2 (dec 16 github TOT) in an attempt to do some work with systemd 232.<br> </div> Wed, 28 Jun 2017 21:05:23 +0000 The mkosi OS generation tool https://lwn.net/Articles/726665/ https://lwn.net/Articles/726665/ mezcalero <div class="FormattedComment"> hmm, Docker cannot generate images that you can boot on bare-metal, can it?<br> <p> "unique disk image format"? Do you mean the raw GPT disk images mkosi can generate with that? I don't find that particularly "unique", it's probably one of the most universally understood disk format these days, as any Windows, any ChromeOS and pretty much everything recent uses GPT. <br> <p> And to clarify, after the initial packages have been extracted (i.e. right after the initial debootstrap or dnf --rootinstall), everything relevant we run runs inside an nspawn container.<br> <p> mkosi is currently at version number 3, hence I don't think you can have tested mkosi 232 ;-). "232" sounds more like a systemd release version.<br> <p> Lennart<br> </div> Wed, 28 Jun 2017 19:24:02 +0000 The mkosi OS generation tool https://lwn.net/Articles/726660/ https://lwn.net/Articles/726660/ jgg <div class="FormattedComment"> To me, the idea is good, but, there is a lot of mature stuff out there that does this, and arguably does the sub-steps better (eg docker). Lots of people have per-project wrapper scripts to make this work right, eg rdma-core has a docker based tool to build the source under various containerised distributions images and produce .rpm/.deb files. <br> <p> <a rel="nofollow" href="https://github.com/linux-rdma/rdma-core/blob/master/buildlib/cbuild">https://github.com/linux-rdma/rdma-core/blob/master/build...</a><br> <p> Which was inspired by other tools and customised to run smoothly with the source tree it is embedded in.<br> <p> mkosi is basically the same idea but for systemd. It doesn't really do anything particularly special, expect that it exports the container into a unique disk image format. Other tools like rkt can already do this, but their images are for running in kvm, not bare metal.<br> <p> The last time I tried to use mkosi (232) it just failed. The main trouble seems to be that it does a lot of work in the host, so it is quiet sensitive to the host configuration, which to my mind, largely defeats the entire purpose.. It was also bonkers slow, but maybe I didn't get far enough to have the caching turn on, or that version didn't have sane caching yet.. Plus it wanted to run as root on the host and do all sorts of strange things - again not the kind of safety I want from a containerised build tool.<br> </div> Wed, 28 Jun 2017 18:57:11 +0000