Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make lxd-agent install script compatible with SUSE #14003

Merged
merged 4 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions doc/guest-os-compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,19 @@ 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

### 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

Expand Down
40 changes: 34 additions & 6 deletions lxd/instance/drivers/driver_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -2860,22 +2860,50 @@ if [ ! -e "systemd" ] || [ ! -e "lxd-agent" ]; then
exit 1
fi

if [ ! -e "/lib/systemd/system" ]; then
simondeziel marked this conversation as resolved.
Show resolved Hide resolved
# 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

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

simondeziel marked this conversation as resolved.
Show resolved Hide resolved
# 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"
tomponline marked this conversation as resolved.
Show resolved Hide resolved
fi
systemctl daemon-reload

# SELinux handling.
Expand Down
Loading