summaryrefslogtreecommitdiffstats
path: root/recipes-extended
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2026-06-05 20:10:42 +0000
committerBruce Ashfield <bruce.ashfield@gmail.com>2026-06-12 02:58:55 +0000
commitbeb966e84df011f8039df61f24d941345164a2a3 (patch)
tree9b56c602d22335664e3d131a2cbc9f209a55be74 /recipes-extended
parent2964385cc6a2b015e4bf9710e998e3bfab3274d9 (diff)
downloadmeta-virtualization-beb966e84df011f8039df61f24d941345164a2a3.tar.gz
libvirt: disable secrets encryption for embedded environments
Libvirt v12 added encrypted secrets storage using systemd-creds. The build-time virt-secret-init-encryption.service generates an encrypted credential via 'systemd-creds encrypt' tied to the build host's TPM or machine key. At runtime in a QEMU VM (or any different machine), the credential cannot be decrypted, causing libvirtd to fail with "Invalid encryption key for the secret" and refuse to start. Set encrypt_data = 0 in secret.conf and remove the stale build-time encrypted key file. Embedded and QEMU-based environments do not have persistent machine credentials needed for this feature. Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'recipes-extended')
-rw-r--r--recipes-extended/libvirt/libvirt_git.bb10
1 files changed, 10 insertions, 0 deletions
diff --git a/recipes-extended/libvirt/libvirt_git.bb b/recipes-extended/libvirt/libvirt_git.bb
index f2fa7321..40b3f31a 100644
--- a/recipes-extended/libvirt/libvirt_git.bb
+++ b/recipes-extended/libvirt/libvirt_git.bb
@@ -217,6 +217,16 @@ do_install:append() {
217 install -m 0644 ${UNPACKDIR}/libvirtd.conf ${D}/etc/libvirt/libvirtd.conf 217 install -m 0644 ${UNPACKDIR}/libvirtd.conf ${D}/etc/libvirt/libvirtd.conf
218 install -m 0644 ${UNPACKDIR}/libvirt-qemu.conf ${D}${nonarch_libdir}/sysusers.d/libvirt-qemu.conf 218 install -m 0644 ${UNPACKDIR}/libvirt-qemu.conf ${D}${nonarch_libdir}/sysusers.d/libvirt-qemu.conf
219 219
220 # Disable secrets encryption — requires systemd-creds with TPM or
221 # persistent host key that embedded/QEMU environments do not have.
222 # The encrypted credential generated at build time cannot be decrypted
223 # at runtime on a different machine, causing libvirtd to fail with
224 # "Invalid encryption key for the secret".
225 sed -i 's/^#encrypt_data = 1/encrypt_data = 0/' ${D}${sysconfdir}/libvirt/secret.conf
226 # Remove the stale build-time encrypted key so the init service
227 # does not skip regeneration on first boot
228 rm -f ${D}${localstatedir}/lib/libvirt/secrets/secrets-encryption-key
229
220 if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then 230 if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
221 # This will wind up in the libvirtd package, but will NOT be invoked by default. 231 # This will wind up in the libvirtd package, but will NOT be invoked by default.
222 # 232 #