Skip to content

Comments

build-recipe-mkosi: fix unsupported options#1119

Open
aafeijoo-suse wants to merge 1 commit intoopenSUSE:masterfrom
aafeijoo-suse:mkosi-old-options-fix
Open

build-recipe-mkosi: fix unsupported options#1119
aafeijoo-suse wants to merge 1 commit intoopenSUSE:masterfrom
aafeijoo-suse:mkosi-old-options-fix

Conversation

@aafeijoo-suse
Copy link

With every build, we can see:

‣ --default is no longer supported
‣ --nspawn-keep-unit is no longer supported
‣ --cache is no longer supported

These warnings are present since v15 [1]. It works with the latest version of mkosi (v26), but with the next v27 from git main the build fails, specifically the --cache option has to be corrected.

--cache and --with-network=never: in [2] it was added --cache-only to remove the special value never for --with-network. The package cache of the package manager is configure with --cache-dir. Also, --with-network only affects build scripts and is false by default, so it can be removed.

--nspawn-keep-unit: obsolete and removed after moving to rootless builds [3], it can be removed.

--default: renamed to --config in v14 [4], removed in v15 [5]. It was used to load additional settings from the specified settings file, but nowdays if mkosi.conf exists, it's always parsed.

[1] systemd/mkosi@bbf7b64
[2] systemd/mkosi@a914321
[3] systemd/mkosi@fdecbf7
[4] systemd/mkosi@7b9bd98
[5] systemd/mkosi@c6290cd

With every build, we can see:

```
‣ --default is no longer supported
‣ --nspawn-keep-unit is no longer supported
‣ --cache is no longer supported
```

These warnings are present since v15 [1]. It works with the latest version of
mkosi (v26), but with the next v27 from git main the build fails, specifically
the `--cache` option has to be corrected.

`--cache` and `--with-network=never`: in [2] it was added `--cache-only` to
remove the special value `never` for `--with-network`. The package cache of the
package manager is configure with `--cache-dir`. Also, `--with-network` only
affects build scripts and is false by default, so it can be removed.

`--nspawn-keep-unit`: obsolete and removed after moving to rootless builds [3],
it can be removed.

`--default`: renamed to --config in v14 [4], removed in v15 [5]. It was used to
load additional settings from the specified settings file, but nowdays if
mkosi.conf exists, it's always parsed.

[1] systemd/mkosi@bbf7b64
[2] systemd/mkosi@a914321
[3] systemd/mkosi@fdecbf7
[4] systemd/mkosi@7b9bd98
[5] systemd/mkosi@c6290cd
@Vogtinator
Copy link
Member

--default: renamed to --config in v14 [4], removed in v15 [5]. It was used to load additional settings from the specified settings file, but nowdays if mkosi.conf exists, it's always parsed.

FWICT this basically means it's no longer possible to override the recipe name, i.e. $RECIPEFILE is completely unused.

@Vogtinator
Copy link
Member

The package cache of the package manager is configure with --cache-dir

I think --cache-dir is for incremental image build caching instead, while the package manager cache is configured with --package-cache-dir?

@aafeijoo-suse
Copy link
Author

The package cache of the package manager is configure with --cache-dir

I think --cache-dir is for incremental image build caching instead, while the package manager cache is configured with --package-cache-dir?

The problematic code added in systemd/mkosi@e6588af (implementation of the keyring method for openSUSE), led me to the following block of code (disabled without --cache-dir): https://github.com/systemd/mkosi/blob/main/mkosi/__init__.py#L4857-L4881

I tested this branching https://build.opensuse.org/package/show/home:kukuk:mkosi-images/tumbleweed-minimal together with mkosi from git, and setting the cache options in mkosi.conf, e.g.:

[Build]
CacheOnly=always
CacheDirectory=/.build.binaries/

@Vogtinator
Copy link
Member

Yep, I know that that option works (I was about to make a PR like this last week), but wasn't sure what it actually does and if it's an actual replacement.

If CacheDirectory=/.foobar also works, I'd assume that it's not quite the same.

@bluca
Copy link
Contributor

bluca commented Jan 28, 2026

This breaks building images with older versions, including those in some older debian release. The warnings should be harmless?

@Vogtinator
Copy link
Member

The warnings should be harmless?

Without --cache-dir, all openSUSE builds break because of the reason outlined in #1119 (comment)

@bluca
Copy link
Contributor

bluca commented Jan 28, 2026

ok but that sounds like a bug in mkosi? we can fix it there

@Vogtinator
Copy link
Member

ok but that sounds like a bug in mkosi? we can fix it there

Maybe. The upstream design won't work with OBS requirements ATM. IMO it should be discussed at least.

@bluca
Copy link
Contributor

bluca commented Jan 28, 2026

yeah fully offline builds totally need to be supported, the problem is we lack CI for it - but if something slips through, we definitely need to fix it

@bluca
Copy link
Contributor

bluca commented Jan 28, 2026

more specifically, anything that is related to repos/packages and attempts to do online stuff needs to check for the local-mirror option, and act accordingly - if that new change doesn't, then yeah it should definitely be fixed to take this into account

@bluca
Copy link
Contributor

bluca commented Feb 4, 2026

This alternative PR checks for support and passes the old parameters with old versions, that way nothing breaks when building older distros: #1122

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants