]> git.ipfire.org Git - thirdparty/lxc.git/commit
Enable systemd to create /var/lib/lxc at runtime with StateDirectory 4583/head
authorVishwas Udupa <vudupa@qti.qualcomm.com>
Wed, 17 Sep 2025 10:56:09 +0000 (03:56 -0700)
committerVishwas Udupa <vudupa@qti.qualcomm.com>
Thu, 18 Sep 2025 06:04:28 +0000 (23:04 -0700)
commitc7bd5a3576f7449040e2164b6740c94cc2f5940c
treeffc52277ba069f9978abddeab79252b0bbe3f588
parentdf8cf80e960e04847b09abe86dab7f20822cb968
Enable systemd to create /var/lib/lxc at runtime with StateDirectory

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.

Signed-off-by: Vishwas Udupa <vudupa@qti.qualcomm.com>
Co-developed-by: Raghuvarya S <raghuvar@qti.qualcomm.com>
config/init/systemd/lxc.service.in
config/init/systemd/lxc@.service.in