MT#62436 Prevent vboxadd* services to run outside of VirtualBox envs

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 e2db6df5d0)
mr13.3
Michael Prokop 1 year ago committed by Guillem Jover
parent 244b69ae55
commit 4537248a97

@ -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/"

Loading…
Cancel
Save