Skip to contentSkip to conversation

libvirt: Drop the deprecated workaround

PATCH Superseded Zhixiong Chi 2 participants 4 messages Apr 11 – Apr 14

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 libvirt: Drop the deprecated workaround

The workaround is not needed anymore as the systemd supporting. The libvirtd.service Type has been changed from notify to notify-reload, so the final Type will be 'forking-reload', that's invalid for systemd. Here we delete it to avoid the following output information:

Quoted 1 line

/lib/systemd/system/libvirtd.service:29: Failed to parse Type=forking-reload, ignoring: Invalid argument

---
 recipes-extended/libvirt/libvirt_git.bb | 7 -------
 1 file changed, 7 deletions(-)
recipes-extended/libvirt/libvirt_git.bb +0 -7
index 7552ed44..fbee9c5b 100644
@@ -225,13 +225,6 @@ do_install:append() {
                 mv ${D}${prefix}/lib/systemd/system/* ${D}${systemd_system_unitdir}
                 rmdir ${D}${prefix}/lib/systemd/system ${D}${prefix}/lib/systemd
             fi
-
-	    # We can't use 'notify' when we don't support 'sd_notify' dbus capabilities.
-	    # Change default LIBVIRTD_ARGS to start libvirtd in the right mode.
-	    sed -i -e 's/Type=notify/Type=forking/' \
-	           -e '/Type=forking/a PIDFile=/run/libvirtd.pid' \
-	           -e 's/\(Environment=LIBVIRTD_ARGS="--timeout 120"\)/#\1\nEnvironment=LIBVIRTD_ARGS="--listen --daemon"/' \
-		   ${D}/${systemd_system_unitdir}/libvirtd.service
 	fi
 
 	# The /run/libvirt directories created by the Makefile are 
Signature · 1 line
2.49.0
#1 lore raw

PATCH 2/2 libvirt: add secrets PACKAGECONFIG

After being upgraded to v12.1.0, the new virt-secret-init-encryption.service has been introduced, and it requires systemd to add openssl to PACKAGECONFIG. Because systemd-creds encrypt command will be executed in the service file.

Meanwhile this service was added into the dependency chain of the main service libvirtd.service.

In systemd recipe, the openssl PACKAGECONFIG is disabled at default. Finally the service file virt-secret-init-encryption.service and libvirtd will be failed.

So add secrets PACKAGECONFIG for libvirt and conditional removal the new virt-secret-init-encryption in the libvirt.service.

---
 recipes-extended/libvirt/libvirt_git.bb | 11 +++++++++++
 1 file changed, 11 insertions(+)
recipes-extended/libvirt/libvirt_git.bb +11 -0
index fbee9c5b..3075149b 100644
@@ -177,6 +177,8 @@ PACKAGECONFIG[firewalld] = "-Dfirewalld=enabled, -Dfirewalld=disabled,"
 PACKAGECONFIG[libpcap] = "-Dlibpcap=enabled, -Dlibpcap=disabled,libpcap,libpcap"
 PACKAGECONFIG[numad] = "-Dnumad=enabled, -Dnumad=disabled,"
 PACKAGECONFIG[nftables] = ""
+# Require systemd to add openssl to PACKAGECONFIG, so disable it at default.
+PACKAGECONFIG[secrets] = "-Ddriver_secrets=enabled, -Ddriver_secrets=disabled,"
 
 # Enable the Python tool support
 require libvirt-python.inc
@@ -225,6 +227,15 @@ do_install:append() {
                 mv ${D}${prefix}/lib/systemd/system/* ${D}${systemd_system_unitdir}
                 rmdir ${D}${prefix}/lib/systemd/system ${D}${prefix}/lib/systemd
             fi
+
+            if ! ${@bb.utils.contains('PACKAGECONFIG', 'secrets', 'true', 'false', d)}; then
+                sed -i \
+                    -e '/^Requires=virt-secret-init-encryption.service/d' \
+                    -e '/^After=virt-secret-init-encryption.service/d' \
+                    -e '/^Environment=SECRETS_ENCRYPTION_KEY=/d' \
+                    -e '/^LoadCredentialEncrypted=/d' \
+                    ${D}${systemd_system_unitdir}/libvirtd.service
+            fi
 	fi
 
 	# The /run/libvirt directories created by the Makefile are 
Signature · 1 line
2.49.0
#2 lore raw

Re: [meta-virtualization][PATCH 2/2] libvirt: add secrets PACKAGECONFIG

Quoted 6 lines · Zhixiong Chi via lists.yoctoproject.org

After being upgraded to v12.1.0, the new virt-secret-init-encryption.service
has been introduced, and it requires systemd to add openssl to PACKAGECONFIG.
Because systemd-creds encrypt command will be executed in the service file.

Quoted 9 lines

Meanwhile this service was added into the dependency chain of the main service
libvirtd.service.

In systemd recipe, the openssl PACKAGECONFIG is disabled at default. Finally
the service file virt-secret-init-encryption.service and libvirtd will be failed.

Considering it didn't exist before, then yes, it is disabled by default. But that
we can see from the patch.

If the new service was introduced by the uprev, is it enabled by default by libvirt itself, or is it doing some sort of build time detection ? We need to
document that in the commit message. That is what your commit message already implies, I just want it to be clearly stated.

We should also be capturing what the user would see in the system logs, on the console, or wherever if this service is enabled. Is it an error ? is it functional ?

Quoted 31 lines

So add secrets PACKAGECONFIG for libvirt and conditional removal the new virt-secret-init-encryption in the libvirt.service.

---
 recipes-extended/libvirt/libvirt_git.bb | 11 +++++++++++
 1 file changed, 11 insertions(+)
recipes-extended/libvirt/libvirt_git.bb +1 -2
index fbee9c5b..3075149b 100644
@@ -177,6 +177,8 @@ PACKAGECONFIG[firewalld] = "-Dfirewalld=enabled,
-Dfirewalld=disabled,"
 PACKAGECONFIG[libpcap] = "-Dlibpcap=enabled,
-Dlibpcap=disabled,libpcap,libpcap"
 PACKAGECONFIG[numad] = "-Dnumad=enabled, -Dnumad=disabled,"
 PACKAGECONFIG[nftables] = ""
+# Require systemd to add openssl to PACKAGECONFIG, so disable it at

default.

recipes-extended/libvirt/libvirt_git.bb +1 -1
+PACKAGECONFIG[secrets] = "-Ddriver_secrets=enabled,
-Ddriver_secrets=disabled,"
 
 # Enable the Python tool support
 require libvirt-python.inc
@@ -225,6 +227,15 @@ do_install:append() {
                 mv ${D}${prefix}/lib/systemd/system/*
 ${D}${systemd_system_unitdir}
                 rmdir ${D}${prefix}/lib/systemd/system
Quoted 4 lines

${D}${prefix}/lib/systemd
fi
+

We need a comment above those sed expressions to indicate the final result. i.e. service is completely removed.

But again, back to my first comments. If libvirt is enabling this by default, and it
isn't doing some sort of runtime/buildtime detection, is this really the only way that
libvirt has to disable it ?

Bruce

Quoted 28 lines

+ if ! ${@bb.utils.contains('PACKAGECONFIG', 'secrets', 'true',
'false', d)}; then

recipes-extended/libvirt/libvirt_git.bb +2 -0
+                sed -i \
+                    -e '/^Requires=virt-secret-init-encryption.service/d'

\

recipes-extended/libvirt/libvirt_git.bb +5 -1
+                    -e '/^After=virt-secret-init-encryption.service/d' \
+                    -e '/^Environment=SECRETS_ENCRYPTION_KEY=/d' \
+                    -e '/^LoadCredentialEncrypted=/d' \
+                    ${D}${systemd_system_unitdir}/libvirtd.service
+            fi
        fi
 
        # The /run/libvirt directories created by the Makefile are
--

2.49.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#9692):
https://lists.yoctoproject.org/g/meta-virtualization/message/9692
Mute This Topic: https://lists.yoctoproject.org/mt/118773077/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II
#3 lore raw

Re: [meta-virtualization][PATCH 2/2] libvirt: add secrets PACKAGECONFIG

Quoted 28 lines · Bruce Ashfield

**
*CAUTION: This email comes from a non Wind River email account!*
Do not click links or open attachments unless you recognize the sender and know the content is safe.

On Sat, Apr 11, 2026 at 6:18 AM Zhixiong Chi via lists.yoctoproject.org <https://urldefense.com/v3/__http://lists.yoctoproject.org__;!!AjveYdw8EvQ!Y975dNSriLr4qezC-a4SpzjKfSb321z98fJvfsD2uPXGyVgpxiwy3UgwyX7V2hTcxDpEKATrBh1p0-RmGBSG0scglZdegA$> <[email protected]> wrote:

After being upgraded to v12.1.0, the new virt-secret-init-encryption.service
has been introduced, and it requires systemd to add openssl to PACKAGECONFIG.
Because systemd-creds encrypt command will be executed in the service file.

Meanwhile this service was added into the dependency chain of the main service
libvirtd.service.

In systemd recipe, the openssl PACKAGECONFIG is disabled at default. Finally
the service file virt-secret-init-encryption.service and libvirtd will be
failed.

Considering it didn't exist before, then yes, it is disabled by default.  But that we can see from the patch.

Quoted 9 lines

If the new service was introduced by the uprev, is it enabled by default by libvirt itself, or is it doing some sort of build time detection ? We need to document that in the commit message. That is what your commit message already implies, I just want it to be clearly stated.

We should also be capturing what the user would see in the system logs, on the console, or wherever if this service is enabled. Is it an error ? is it functional ?

Updated the comments in V2 patch including the services status when secret service is enabled .

Quoted 45 lines

    So add secrets PACKAGECONFIG for libvirt and conditional removal
    the new
    virt-secret-init-encryption in the libvirt.service.

    Signed-off-by: Zhixiong Chi <[email protected]>
    ---
     recipes-extended/libvirt/libvirt_git.bb
    <https://urldefense.com/v3/__http://libvirt_git.bb__;!!AjveYdw8EvQ!Y975dNSriLr4qezC-a4SpzjKfSb321z98fJvfsD2uPXGyVgpxiwy3UgwyX7V2hTcxDpEKATrBh1p0-RmGBSG0seih9UXkA$>
    | 11 +++++++++++
     1 file changed, 11 insertions(+)

    diff --git a/recipes-extended/libvirt/libvirt_git.bb
    <https://urldefense.com/v3/__http://libvirt_git.bb__;!!AjveYdw8EvQ!Y975dNSriLr4qezC-a4SpzjKfSb321z98fJvfsD2uPXGyVgpxiwy3UgwyX7V2hTcxDpEKATrBh1p0-RmGBSG0seih9UXkA$>
    b/recipes-extended/libvirt/libvirt_git.bb
    <https://urldefense.com/v3/__http://libvirt_git.bb__;!!AjveYdw8EvQ!Y975dNSriLr4qezC-a4SpzjKfSb321z98fJvfsD2uPXGyVgpxiwy3UgwyX7V2hTcxDpEKATrBh1p0-RmGBSG0seih9UXkA$>
    index fbee9c5b..3075149b 100644
    --- a/recipes-extended/libvirt/libvirt_git.bb
    <https://urldefense.com/v3/__http://libvirt_git.bb__;!!AjveYdw8EvQ!Y975dNSriLr4qezC-a4SpzjKfSb321z98fJvfsD2uPXGyVgpxiwy3UgwyX7V2hTcxDpEKATrBh1p0-RmGBSG0seih9UXkA$>
    +++ b/recipes-extended/libvirt/libvirt_git.bb
    <https://urldefense.com/v3/__http://libvirt_git.bb__;!!AjveYdw8EvQ!Y975dNSriLr4qezC-a4SpzjKfSb321z98fJvfsD2uPXGyVgpxiwy3UgwyX7V2hTcxDpEKATrBh1p0-RmGBSG0seih9UXkA$>
    @@ -177,6 +177,8 @@ PACKAGECONFIG[firewalld] =
    "-Dfirewalld=enabled, -Dfirewalld=disabled,"
     PACKAGECONFIG[libpcap] = "-Dlibpcap=enabled,
    -Dlibpcap=disabled,libpcap,libpcap"
     PACKAGECONFIG[numad] = "-Dnumad=enabled, -Dnumad=disabled,"
     PACKAGECONFIG[nftables] = ""
    +# Require systemd to add openssl to PACKAGECONFIG, so disable it
    at default.
    +PACKAGECONFIG[secrets] = "-Ddriver_secrets=enabled,
    -Ddriver_secrets=disabled,"

     # Enable the Python tool support
     require libvirt-python.inc
    <https://urldefense.com/v3/__http://libvirt-python.inc__;!!AjveYdw8EvQ!Y975dNSriLr4qezC-a4SpzjKfSb321z98fJvfsD2uPXGyVgpxiwy3UgwyX7V2hTcxDpEKATrBh1p0-RmGBSG0scd3pMLYg$>
    @@ -225,6 +227,15 @@ do_install:append() {
                     mv ${D}${prefix}/lib/systemd/system/*
    ${D}${systemd_system_unitdir}
                     rmdir ${D}${prefix}/lib/systemd/system
    ${D}${prefix}/lib/systemd
                 fi
    +
Quoted 2 lines

We need a comment above those sed expressions to indicate the final result. i.e. service is completely removed.

Done in V2.

Quoted 4 lines

But again, back to my first comments. If libvirt is enabling this by default, and it isn't doing some sort of runtime/buildtime detection, is this really the only way that libvirt has to disable it ?

Add the benefit description about this approach in v2.
Provide the opportunity to choose the specific configurations they wish to activate, thereby avoiding potential PACKAGECONFIG conflicts between packages.

Quoted 44 lines

Bruce

    +            if ! ${@bb.utils.contains('PACKAGECONFIG', 'secrets',
    'true', 'false', d)}; then
    +                sed -i \
    +                    -e
    '/^Requires=virt-secret-init-encryption.service/d' \
    +                    -e
    '/^After=virt-secret-init-encryption.service/d' \
    +                    -e '/^Environment=SECRETS_ENCRYPTION_KEY=/d' \
    +                    -e '/^LoadCredentialEncrypted=/d' \
    + ${D}${systemd_system_unitdir}/libvirtd.service
    +            fi
            fi

            # The /run/libvirt directories created by the Makefile are
    -- 
    2.49.0


    -=-=-=-=-=-=-=-=-=-=-=-
    Links: You receive all messages sent to this group.
    View/Reply Online (#9692):
    https://lists.yoctoproject.org/g/meta-virtualization/message/9692
    <https://urldefense.com/v3/__https://lists.yoctoproject.org/g/meta-virtualization/message/9692__;!!AjveYdw8EvQ!Y975dNSriLr4qezC-a4SpzjKfSb321z98fJvfsD2uPXGyVgpxiwy3UgwyX7V2hTcxDpEKATrBh1p0-RmGBSG0seQbx4qdw$>
    Mute This Topic:
    https://lists.yoctoproject.org/mt/118773077/1050810
    <https://urldefense.com/v3/__https://lists.yoctoproject.org/mt/118773077/1050810__;!!AjveYdw8EvQ!Y975dNSriLr4qezC-a4SpzjKfSb321z98fJvfsD2uPXGyVgpxiwy3UgwyX7V2hTcxDpEKATrBh1p0-RmGBSG0sdUIwrPoQ$>
    Group Owner: [email protected]
    <mailto:meta-virtualization%[email protected]>
    Unsubscribe:
    https://lists.yoctoproject.org/g/meta-virtualization/unsub
    <https://urldefense.com/v3/__https://lists.yoctoproject.org/g/meta-virtualization/unsub__;!!AjveYdw8EvQ!Y975dNSriLr4qezC-a4SpzjKfSb321z98fJvfsD2uPXGyVgpxiwy3UgwyX7V2hTcxDpEKATrBh1p0-RmGBSG0sd8XqPZXg$>
    [[email protected]]
    -=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await 
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II