From a063b1ae9bb57ae2fe23ff748248f590ccc523ec Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 28 Aug 2024 14:45:55 -0400 Subject: [PATCH 1/4] lxd/instance/drivers/qemu: update how systemd is detected https://www.freedesktop.org/software/systemd/man/latest/sd_booted.html: > Internally, this function checks whether the directory /run/systemd/system/ > exists. A simple check like this can also be implemented trivially in shell > or any other language. Signed-off-by: Simon Deziel --- lxd/instance/drivers/driver_qemu.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lxd/instance/drivers/driver_qemu.go b/lxd/instance/drivers/driver_qemu.go index c96630458e8d..4217af9af2bd 100644 --- a/lxd/instance/drivers/driver_qemu.go +++ b/lxd/instance/drivers/driver_qemu.go @@ -2860,7 +2860,8 @@ if [ ! -e "systemd" ] || [ ! -e "lxd-agent" ]; then exit 1 fi -if [ ! -e "/lib/systemd/system" ]; then +# systemd systems always have /run/systemd/system/ created on boot. +if [ ! -d "/run/systemd/system/" ]; then echo "This script only works on systemd systems" exit 1 fi From 9a2f6e6939e624d8bfdf0fcfa517df18d48211c5 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 28 Aug 2024 14:50:11 -0400 Subject: [PATCH 2/4] lxd/instance/drivers/qemu: compat with SUSE paths Signed-off-by: Simon Deziel --- lxd/instance/drivers/driver_qemu.go | 37 +++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/lxd/instance/drivers/driver_qemu.go b/lxd/instance/drivers/driver_qemu.go index 4217af9af2bd..2e54f1cb0812 100644 --- a/lxd/instance/drivers/driver_qemu.go +++ b/lxd/instance/drivers/driver_qemu.go @@ -2866,17 +2866,44 @@ if [ ! -d "/run/systemd/system/" ]; then exit 1 fi +for path in "/lib/systemd" "/usr/lib/systemd"; do + [ -d "${path}/system" ] || continue + LIB_SYSTEMD="${path}" + break +done + +if [ ! -d "${LIB_SYSTEMD:-}" ]; then + echo "Could not find path to systemd" + exit 1 +fi + +for path in "/lib/udev" "/usr/lib/udev"; do + [ -d "${path}/rules.d/" ] || continue + LIB_UDEV="${path}" + break +done + +if [ ! -d "${LIB_UDEV:-}" ]; then + echo "Could not find path to udev" + exit 1 +fi + # Cleanup former units. -rm -f /lib/systemd/system/lxd-agent-9p.service \ - /lib/systemd/system/lxd-agent-virtiofs.service \ +rm -f "${LIB_SYSTEMD}/system/lxd-agent-9p.service" \ + "${LIB_SYSTEMD}/system/lxd-agent-virtiofs.service" \ /etc/systemd/system/multi-user.target.wants/lxd-agent-9p.service \ /etc/systemd/system/multi-user.target.wants/lxd-agent-virtiofs.service \ /etc/systemd/system/multi-user.target.wants/lxd-agent.service # Install the units. -cp udev/99-lxd-agent.rules /lib/udev/rules.d/ -cp systemd/lxd-agent.service /lib/systemd/system/ -cp systemd/lxd-agent-setup /lib/systemd/ +cp udev/99-lxd-agent.rules "${LIB_UDEV}/rules.d/" +cp systemd/lxd-agent-setup "${LIB_SYSTEMD}/" +if [ "/lib/systemd" = "${LIB_SYSTEMD}" ]; then + cp systemd/lxd-agent.service "${LIB_SYSTEMD}/system/" +else + # Adapt paths for systemd's lib location + sed "/=\/lib\/systemd/ s|=/lib/systemd|=${LIB_SYSTEMD}|" systemd/lxd-agent.service > "${LIB_SYSTEMD}/system/lxd-agent.service" +fi systemctl daemon-reload # SELinux handling. From 96b0f698cd1df69dd8eb134dd03db287a501345c Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Tue, 3 Sep 2024 10:39:53 -0400 Subject: [PATCH 3/4] doc/guest-os-compatibility: improve legend readability Signed-off-by: Simon Deziel --- doc/guest-os-compatibility.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/guest-os-compatibility.md b/doc/guest-os-compatibility.md index ca044597f0a0..0141ae2eae98 100644 --- a/doc/guest-os-compatibility.md +++ b/doc/guest-os-compatibility.md @@ -38,11 +38,12 @@ Windows | 11 23H2 [^5] | Supported | ➖ | ✅ [^8]: This Linux version does not use `systemd` which the LXD agent requires. [^9]: Requires the HWE kernel (`4.15`) for proper `vsock` support which is required by the LXD agent. -Legend: -✅ : recommended -🟢 : supported -➖ : not applicable -❌ : not supported +Legend | Icon +:--- | :--- +recommended | ✅ +supported | 🟢 +not applicable | ➖ +not supported | ❌ ## Notes From 6d412932f442a70859805d9c7c56e1d4f2439376 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Tue, 3 Sep 2024 10:55:06 -0400 Subject: [PATCH 4/4] doc/guest-os-compatibility: link to how to install lxd-agent manually Signed-off-by: Simon Deziel --- doc/guest-os-compatibility.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/guest-os-compatibility.md b/doc/guest-os-compatibility.md index 0141ae2eae98..5b19dd2d6a4f 100644 --- a/doc/guest-os-compatibility.md +++ b/doc/guest-os-compatibility.md @@ -50,6 +50,7 @@ not supported | ❌ ### LXD agent The LXD agent provides the ability to execute commands inside of the virtual machine guest without relying on traditional access solution like secure shell (SSH) or Remote Desktop Protocol (RDP). This agent is only supported on Linux guests using `systemd`. +See {ref}`instances-create-iso` for instructions on how to install the LXD agent manually. ### CSM/BIOS boot