Repository: systemd/mkosi

Issue:
Dependency /usr/lib/systemd/ukify is not available for most distros(under 255)
$ bin/mkosi
‣ Removing output files…
‣ Building default image
‣ Could not find '/usr/lib/systemd/ukify' which is required to build bootable images.
‣ (Bootable=no can be used to create a non-bootable image)
[ryx@rockylinux mkosi]$ sudo dnf install mkosi
Error: Unable to find a match: mkosi

The way to reproduce is to git clone the latest repo, and follow the instructions to execute mkosi for tag v19 ... 16


Discussion:
You can use ToolsTree=default to have mkosi build an image with ukify and other tools in it which is used to build the final image.
Thanks,  @DaanDeMeyer  

Should `ToolsTree=default` be the default setting or provide a default mkosi.conf for testing?

Saw the option is added in v17.

In addition, when I tried to build a debian using Rocky Linux, I hit the following: 

```
 $ bin/mkosi
‣ Removing output files…
‣ Removing output files…
‣ Building debian-tools image
‣  Installing Debian
env: ‘apt-get’: No such file or directory
‣ "env APT_CONFIG=/home/rockyuser/.cache/mkosi-workspacexlgwjeqw/apt.conf DEBIAN_FRONTEND=noninteractive DEBCONF_INTERACTIVE_SEEN=true INITRD=No apt-get -o APT::Architecture=amd64 -o APT::Architectures=amd64 -o APT::Immediate-Configure=off -o APT::Get::Assume-Yes=true -o APT::Get::AutomaticRemove=true -o APT::Get::Allow-Change-Held-Packages=true -o APT::Get::Allow-Remove-Essential=true -o APT::Sandbox::User=root -o Dir::Cache=/home/rockyuser/workspace/mkosi/mkosi.cache/tools/apt -o Dir::State=/home/rockyuser/.cache/mkosi-workspacexlgwjeqw/pkgmngr/var/lib/apt -o Dir::State::status=/home/rockyuser/.cache/mkosi-workspacexlgwjeqw/root/var/lib/dpkg/status -o Dir::Etc::trusted=/usr/share/keyrings/debian-archive-keyring.gpg -o Dir::Etc::trustedparts=/usr/share/keyrings -o Dir::Log=/home/rockyuser/.cache/mkosi-workspacexlgwjeqw/pkgmngr/var/log/apt -o Dir::Bin::dpkg=/usr/bin/dpkg -o Debug::NoLocking=true -o DPkg::Options::=--root=/home/rockyuser/.cache/mkosi-workspacexlgwjeqw/root -o DPkg::Options::=--log=/home/rockyuser/.cache/mkosi-workspacexlgwjeqw/pkgmngr/var/log/apt/dpkg.log -o DPkg::Options::=--force-unsafe-io -o DPkg::Options::=--force-architecture -o DPkg::Options::=--force-depends -o Dpkg::Use-Pty=false -o DPkg::Install::Recursive::Minimum=1000 -o pkgCacheGen::ForceEssential=, update" returned non-zero exit code 127.
```
I can use debootstap to build a bookworm image on the same machine. 

Does mkosi require apt-get on the host filesystem?
@bsdnet Yes we require apt-get on the host filesystem to build Debian/Ubuntu images. debootstrap is a poor reimplementation of half of apt so we use apt directly instead. Note that apt is packaged in EPEL 9 so you can just install it on Rocky.

`ToolsTree=default` should not be the default setting since for example on Arch Linux and Fedora 39 all necessary tools are available already and there's no need for `ToolsTree=default`.
> Note that apt is packaged in EPEL 9 so you can just install it on Rocky.

Thanks, let me give it a try when I am back home.

> ToolsTree=default should not be the default setting since for example on Arch Linux and Fedora 39 all necessary tools are available already and there's no need for ToolsTree=default.

Depends on how to view this issue,  if we consider most OS distributions are still using old systemd,  making `ToolsTree=default`  has the following benefits: 
- `mkosi` works out of the box on the all distros
- Make testing`mkosi` easier. More testings, mean, more stable software
- More adoption

As to Arch Linux and Fedora 39, they can package it without `ToolsTree=default` since they are using latest systemd.

Just some thoughts! 

Resolving patch:
diff --git a/mkosi/__init__.py b/mkosi/__init__.py
--- a/mkosi/__init__.py
+++ b/mkosi/__init__.py
@@ -2013,7 +2013,8 @@ def check_tools(verb: Verb, config: MkosiConfig) -> None:
                 "ukify", "/usr/lib/systemd/ukify",
                 version="254",
                 reason="build bootable images",
-                hint="Bootable=no can be used to create a non-bootable image",
+                hint="Use ToolsTree=default to download most required tools including ukify automatically or use "
+                     "Bootable=no to create a non-bootable image which doesn't require ukify",
             )
 
         if config.output_format in (OutputFormat.disk, OutputFormat.esp):


Test patch: