Skip to content

Conversation

DaanDeMeyer
Copy link
Contributor

If PackageCacheDirectory=/var and a cache directory is not configured (like in mkosi-initrd), then we'd always sync repository metadata, regardless of the value of CacheOnly=. Let's fix that by disallowing CacheOnly=metadata|always if a cache directory is not configured and only syncing if CacheOnly=never|auto, regardless if a cache directory is configured or not.

Fixes #3946

@behrmann
Copy link
Contributor

behrmann commented Oct 9, 2025

@chriscjs can you check whether this fixes your issue?

@chriscjs
Copy link

I applied your patch and I get the following error:

sudo mkosi-initrd
[sudo] password for root:

Validating certificates and keys
‣ A cache directory must be configured in order to use CacheOnly=metadata

‣ "mkosi --force --directory= --format=cpio --output=initrd --output-directory=/tmp/tmp98orzyxo --extra-tree=/usr/lib/modules/6.17.1-arch1-1:/usr/lib/modules/6.17.1-arch1-1 --extra-tree=/usr/lib/firmware:/usr/lib/firmware '--remove-files=/usr/lib/firmware/*-ucode' --build-sources= --include=mkosi-initrd --kernel-modules=host --package-cache-dir=/var --cache-only=metadata --output-mode=600 --include /etc/mkosi-initrd --sandbox-tree=/tmp/tmpqza030tx --extra-tree /tmp/tmp98orzyxo/crypttab:/etc/crypttab --extra-tree=/etc/vconsole.conf:/etc/vconsole.conf" returned non-zero exit code 1.

CacheOnly is hardcoded on line 378 in initrd.py
--cache-only=metadata

If PackageCacheDirectory=/var and a cache directory is not configured
(like in mkosi-initrd), then we'd always sync repository metadata,
regardless of the value of CacheOnly=. Let's fix that by disallowing
CacheOnly=metadata|always if a cache directory is not configured and
only syncing if CacheOnly=never|auto, regardless if a cache directory
is configured or not.

Fixes systemd#3946
@DaanDeMeyer
Copy link
Contributor Author

@chriscjs Should work now

@chriscjs
Copy link

Thanks that one worked.

@DaanDeMeyer DaanDeMeyer merged commit 611c8b4 into systemd:main Oct 10, 2025
29 of 40 checks passed
@DaanDeMeyer DaanDeMeyer deleted the metadata-cache-fix branch October 10, 2025 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

partial system upgrades on Arch linux after commit fc2da84

3 participants