From 4537248a978ed1f493d8fe112254b71d9c142071 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 5 May 2025 18:08:04 +0200 Subject: [PATCH] MT#62436 Prevent vboxadd* services to run outside of VirtualBox envs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We get failing ngcp-status on our trunk systems, due to: | root@spce:~# systemctl --failed | UNIT LOAD ACTIVE SUB DESCRIPTION | ● vboxadd-service.service loaded failed failed VirtualBox Guest Additions Services Daemon | ● vboxadd.service loaded failed failed vboxadd.service While we're not even running inside a VirtualBox environment: | root@spce:~# systemd-detect-virt | kvm We install /etc/systemd/system/vboxadd-service.service.d/override.conf and /etc/systemd/system/vboxadd-service.service.d/override.conf with `ConditionVirtualization=oracle` through our templates (see its git rev a2521b609300965e5f8dfdeee63c5961f2d6a559) to address this. But this is too late to the party, as the vboxadd* services are started *before* our overrides get relevant. So ensure we place the overrides already *before* even installing the VBoxGuestAdditions.iso and executing its VBoxLinuxAdditions.run. This then prevents the execution inside our Proxmox VMs, and not reporting failing vboxadd-service + vboxadd services then: | systemd[1]: vboxadd.service was skipped because of an unmet condition check (ConditionVirtualization=oracle). Change-Id: I1a3a04bdc5d92d3fc79b336018ac5f588266c59b (cherry picked from commit e2db6df5d08bffa58cfbe9376b3b7057b3f7f5ab) --- templates/scripts/includes/deployment.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/templates/scripts/includes/deployment.sh b/templates/scripts/includes/deployment.sh index 5f3ba77..1c8463e 100755 --- a/templates/scripts/includes/deployment.sh +++ b/templates/scripts/includes/deployment.sh @@ -1065,6 +1065,23 @@ EOF fi } +vbox_adjust_vboxadd_service() { + mkdir -p "${TARGET}"/etc/systemd/system/vboxadd.service.d + mkdir -p "${TARGET}"/etc/systemd/system/vboxadd-service.service.d + + cat > "${TARGET}"/etc/systemd/system/vboxadd.service.d/override.conf << EOF +# deployed via deployment-iso's deployment.sh +[Unit] +ConditionVirtualization=oracle +EOF + + cat > "${TARGET}"/etc/systemd/system/vboxadd-service.service.d/override.conf << EOF +# deployed via deployment-iso's deployment.sh +[Unit] +ConditionVirtualization=oracle +EOF +} + vagrant_configuration() { # bzip2, linux-headers-amd64 and make are required for VirtualBox Guest Additions installer # less + sudo are required for Vagrant itself @@ -1136,6 +1153,9 @@ vagrant_configuration() { die "Error: could not find $vbox_isofile" fi + # ensure we don't try to run vbox* services outside of VirtualBox environments + vbox_adjust_vboxadd_service + mkdir -p "${TARGET}/media/cdrom" mountpoint "${TARGET}/media/cdrom" >/dev/null && umount "${TARGET}/media/cdrom" mount -t iso9660 "${vbox_isofile}" "${TARGET}/media/cdrom/"