Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running a "minimal" user-friendly Debian image with mkosi v18 #1971

Closed
QagiDlaupzig opened this issue Oct 11, 2023 · 5 comments
Closed

Running a "minimal" user-friendly Debian image with mkosi v18 #1971

QagiDlaupzig opened this issue Oct 11, 2023 · 5 comments
Labels

Comments

@QagiDlaupzig
Copy link

QagiDlaupzig commented Oct 11, 2023

Hello,

I have been a happy user of mkosi since 2020.

My usecase is the following: I give lab session students, where I want to give them each access to a full system.
Sometimes they need to be root, so having them in a VM is the only way things do not go too badly. For this systemd-spawn is nice.

So I use mkosi to generate a small Debian image with a few packages, customize the image for each student (typically giving each of them a unique password), then give them the password so each can ssh into its own VM.
Plus I have the "machinectl shell" cheatcode so I can help them when needed. Plus if they mess-up a VM too badly, it is super easy to fire up a new one.

Today, I tried to update one of the labs, and realized mkosi has changed a lot recently (v18 according to --version, I use Debian testing).

My aim: make the lab work again with mkosi v18

  • First, would have been nice if mkosi.default would have been either used or I got a big warning to go read the NEWS file.
    In practice, the tool ran the with the default configuration (debian trixie) and I could not understand why it would pick the wrong Debian version. Fixed after renaming to .conf.
  • Apparently you can't have a minimal debian install anymore. Seems related to Add Packages=default #1967 ? I made a horrible "fix" using debootstrap.
  • I had an intermediate state where "mkosi summary" would only show the first extra "package" (yet "mkosi" would still downloads all of them). I did not save this state, so unfortunately no reproducer for this one.
  • Host.RuntimeSize seems broken. I understood it as a replacement for Partitions.RootSize, maybe it is not the case?
  • I could not get to use systemctl in mkosi.postinst, whereas it would work nicely previously. (Failed to connect to bus: No data available)

Here is a minimal reproducer: https://github.com/QagiDlaupzig/mkosi_dummy_debian

Run ./deploy then ./run

PS: for now, I just downgraded back to mkosi v14.

@DaanDeMeyer
Copy link
Contributor

v15 broke compatibility, this is mentioned in the release notes, please take a look at the NEWS file to see what changed.

Apparently you can't have a minimal debian install anymore. Seems related to #1967 ? I made a horrible "fix" using debootstrap.

You can have a minimal debian install, that's exactly what you get, we don't install any packages by default anymore except the essential ones, so it's not really going to get more minimal than this. You're responsible yourself for figuring out the set of packages you want installed in your image. At some point we'll add a "default" set of packages.

Host.RuntimeSize seems broken. I understood it as a replacement for Partitions.RootSize, maybe it is not the case?

It is not a replacement for RootSize=. Partition sizes are configured via systemd-repart definition files, see #1290

I could not get to use systemctl in mkosi.postinst, whereas it would work nicely previously. (Failed to connect to bus: No data available)

Scripts run on the host by default now, please see #1729. Either use --root $BUILDROOT or follow the instructions to run your script in the image.

@QagiDlaupzig
Copy link
Author

v15 broke compatibility, this is mentioned in the release notes, please take a look at the NEWS file to see what changed.

Yup, my point was it would be have been nice to get a big warning that mkosi.default was not supposed to exist anymore.

You can have a minimal debian install, that's exactly what you get, we don't install any packages by default anymore except the essential ones, so it's not really going to get more minimal than this. You're responsible yourself for figuring out the set of packages you want installed in your image. At some point we'll add a "default" set of packages.

We probably have a different notion of what "minimal" means. Let's see more that I need a "minimal but usable by a human" version, much like debootstrap minbase.

It is not a replacement for RootSize=. Partition sizes are configured via systemd-repart definition files, see #1290

Scripts run on the host by default now, please see #1729. Either use --root $BUILDROOT or follow the instructions to run your script in the image.

I'll look into these. Thanks!

~~

That said, it looks like mkosi is turning from a way to quickly build "small distro images" to building "finely-tunable pico-minimalistic images without even dbus or systemd, not meant to be ssh'd into". Having to maintain the set of base packages by myself would be a pain. While I'm sure that with some reading, I can find a way after reading the doc to make systemd-repart to the same thing, RootSize was nice and easy to use. So obviously, as I have not signed a support contract, you don't owe me anything, but keep in mind you might cut your user base by going this way. :)

@keszybz
Copy link
Member

keszybz commented Oct 13, 2023

We could emit a warning if mkosi.default exists, but we find no other config files… @DaanDeMeyer WDYT?

@DaanDeMeyer
Copy link
Contributor

We could emit a warning if mkosi.default exists, but we find no other config files… @DaanDeMeyer WDYT?

Yeah I wouldn't mind emitting a warning

That said, it looks like mkosi is turning from a way to quickly build "small distro images" to building "finely-tunable pico-minimalistic images without even dbus or systemd, not meant to be ssh'd into". Having to maintain the set of base packages by myself would be a pain.

You can build whatever image you want with mkosi, but we've decided that it's not our responsibility to decide which packages to install. Luckily, most distributions provide package groups that make installing sets of packages for a specific task or purpose very easy. e.g. for Debian you have tasksel to configure a system for a specific task. For example you can install the "task-desktop" package to configure your system to install packages required for using the image as a desktop. With the new WithRecommends= option I'm adding in #1976, you can even pull in all the recommended packages of these "task" packages if you'd like. Fedora and Arch have a similar concept of package groups that allow you to easily install related packages.

While I'm sure that with some reading, I can find a way after reading the doc to make systemd-repart to the same thing, RootSize was nice and easy to use. So obviously, as I have not signed a support contract, you don't owe me anything, but keep in mind you might cut your user base by going this way. :)

It might have been easy to use, but it was also extremely inflexible. We document the default repart definition files in the documentation, you just have to copy those to the mkosi.repart/ directory and then adapt them to your use case.

@DaanDeMeyer
Copy link
Contributor

Let's close this as there's nothing concretely actionable here, feel free to join https://matrix.to/#/#mkosi:matrix.org if you have more questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants