All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bruce Ashfield <bruce.ashfield@gmail.com>
To: vudupa@qti.qualcomm.com
Cc: meta-virtualization@lists.yoctoproject.org, anuj.mittal@oss.qualcomm.com
Subject: Re: [meta-virtualization] [PATCH] lxc: backport patch to enable systemd StateDirectory for lxc
Date: Mon, 1 Dec 2025 22:46:24 -0500	[thread overview]
Message-ID: <aS5hEMxiPcWdQHxK@gmail.com> (raw)
In-Reply-To: <20251120132310.3500656-1-vudupa@qti.qualcomm.com>

It looks like the stable-6.0 branch has picked up this change, so
I've done another lxc bump and have moved master-next to master.

I held master-next for longer than I'd like as I was working on
some issues in the stack. I finally have some of that sorted out,
so I'm now starting to introduce a bit of changes into the layer
as I finish that up.

Bruce

In message: [meta-virtualization] [PATCH] lxc: backport patch to enable systemd StateDirectory for lxc
on 20/11/2025 Vishwas Udupa via lists.yoctoproject.org wrote:

> Backport upstream patch to make sure lxc systemd service
> defines a StateDirectory to ensure that the /var/lib/lxc
> directory is automatically created and managed by systemd
> during service startup.
> Do not create lxc directory at build time for systemd.
> 
> Signed-off-by: Vishwas Udupa <vudupa@qti.qualcomm.com>
> ---
>  ...nable-systemd-StateDirectory-for-lxc.patch | 55 +++++++++++++++++++
>  recipes-containers/lxc/lxc_git.bb             |  3 +-
>  2 files changed, 57 insertions(+), 1 deletion(-)
>  create mode 100644 recipes-containers/lxc/files/0001-enable-systemd-StateDirectory-for-lxc.patch
> 
> diff --git a/recipes-containers/lxc/files/0001-enable-systemd-StateDirectory-for-lxc.patch b/recipes-containers/lxc/files/0001-enable-systemd-StateDirectory-for-lxc.patch
> new file mode 100644
> index 00000000..2d60798a
> --- /dev/null
> +++ b/recipes-containers/lxc/files/0001-enable-systemd-StateDirectory-for-lxc.patch
> @@ -0,0 +1,55 @@
> +From c7bd5a3576f7449040e2164b6740c94cc2f5940c Mon Sep 17 00:00:00 2001
> +From: Vishwas Udupa <vudupa@qti.qualcomm.com>
> +Date: Wed, 17 Sep 2025 03:56:09 -0700
> +Subject: [PATCH] Enable systemd to create /var/lib/lxc at runtime
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +Upstream-Status: Backport [https://github.com/lxc/lxc/commit/c7bd5a3]
> +Signed-off-by: Vishwas Udupa <vudupa@qti.qualcomm.com>
> +Co-developed-by: Raghuvarya S <raghuvar@qti.qualcomm.com>
> +
> +This change adds the StateDirectory= directive in the systemd
> +unit file to ensure that the /var/lib/lxc directory is
> +automatically created and managed by systemd during service startup.
> +
> +The StateDirectory= option instructs systemd to create a persistent
> +state directory under /var/lib/. This is particularly useful in
> +scenarios where the directory may be missing at first boot — such as
> +on OSTree-based Linux distributions, which typically ship with
> +empty /var directory as part of their immutable root filesystem.
> +
> +By adding StateDirectory=lxc, systemd will handle the creation of
> +/var/lib/lxc on first boot, ensuring that the service can start
> +reliably even when the directory is not present initially.
> +
> +---
> + config/init/systemd/lxc.service.in  | 1 +
> + config/init/systemd/lxc@.service.in | 1 +
> + 2 files changed, 2 insertions(+)
> +
> +diff --git a/config/init/systemd/lxc.service.in b/config/init/systemd/lxc.service.in
> +index 397a6c4d04..7142656178 100644
> +--- a/config/init/systemd/lxc.service.in
> ++++ b/config/init/systemd/lxc.service.in
> +@@ -13,6 +13,7 @@ ExecStop=@LIBEXECDIR@/lxc/lxc-containers stop
> + ExecReload=@LIBEXECDIR@/lxc/lxc-apparmor-load
> + # Environment=BOOTUP=serial
> + # Environment=CONSOLETYPE=serial
> ++StateDirectory=lxc
> + Delegate=yes
> + 
> + [Install]
> +diff --git a/config/init/systemd/lxc@.service.in b/config/init/systemd/lxc@.service.in
> +index 21ce64aefe..44e5b14dd2 100644
> +--- a/config/init/systemd/lxc@.service.in
> ++++ b/config/init/systemd/lxc@.service.in
> +@@ -13,6 +13,7 @@ ExecStart=@BINDIR@/lxc-start -F -n %i
> + ExecStop=@BINDIR@/lxc-stop -n %i
> + # Environment=BOOTUP=serial
> + # Environment=CONSOLETYPE=serial
> ++StateDirectory=lxc
> + Delegate=yes
> + 
> + [Install]
> diff --git a/recipes-containers/lxc/lxc_git.bb b/recipes-containers/lxc/lxc_git.bb
> index 2f0e8e74..97896280 100644
> --- a/recipes-containers/lxc/lxc_git.bb
> +++ b/recipes-containers/lxc/lxc_git.bb
> @@ -45,6 +45,7 @@ SRC_URI = "git://github.com/lxc/lxc.git;branch=stable-6.0;protocol=https \
>  	file://0001-download-don-t-try-compatbility-index.patch \
>  	file://tests-our-init-is-not-busybox.patch \
>  	file://0001-template-if-busybox-contains-init-use-it-in-containe.patch \
> +	file://0001-enable-systemd-StateDirectory-for-lxc.patch \
>  	file://dnsmasq.conf \
>  	file://lxc-net \
>  	"
> @@ -140,7 +141,7 @@ do_install:append() {
>  
>  	if "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}"; then
>  	    # nothing special for systemd at the moment
> -	    true
> +	    (cd ${D}${localstatedir}; [ -d lib/lxc ] && rmdir -v --parents lib/lxc)
>  	else
>  	    # with meson, these aren't built unless sysvinit is the enabled
>  	    # init system.
> -- 
> 2.25.1
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#9453): https://lists.yoctoproject.org/g/meta-virtualization/message/9453
> Mute This Topic: https://lists.yoctoproject.org/mt/116390300/1050810
> Group Owner: meta-virtualization+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [bruce.ashfield@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 



      reply	other threads:[~2025-12-02  3:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-20 13:23 [PATCH] lxc: backport patch to enable systemd StateDirectory for lxc Vishwas Udupa
2025-12-02  3:46 ` Bruce Ashfield [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aS5hEMxiPcWdQHxK@gmail.com \
    --to=bruce.ashfield@gmail.com \
    --cc=anuj.mittal@oss.qualcomm.com \
    --cc=meta-virtualization@lists.yoctoproject.org \
    --cc=vudupa@qti.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.