MT#57453 vagrant_configuration: fake systemd presence

As of git rev 6c960afee4 we're using the
virtualbox-guest-additions-iso from bookworm.

Previous versions of VBoxGuestAdditions had a simple test to check for
present of systemd, quoting from
/opt/VBoxGuestAdditions-6.1.22/routines.sh:

| use_systemd()
| {
|     test ! -f /sbin/init || test -L /sbin/init
| }

Now in more recent versions of VBoxGuestAdditions[1], the systemd check
was modified, quoting from /opt/VBoxGuestAdditions-7.0.6/routines.sh:

| use_systemd()
| {
|     # First condition is what halfway recent systemd uses itself, and the
|     # other two checks should cover everything back to v1.
|     test -e /run/systemd/system || test -e /sys/fs/cgroup/systemd || test -e /cgroup/systemd
| }

So if we're running inside a chroot as with our deployment.sh, it looks
like a non-systemd system for VBoxGuestAdditions's installer, and we end
up with installation and presence of /etc/init.d/vboxadd, leading to:

| root@spce:~# ls -lah /run/systemd/generator.late/
| total 4.0K
| drwxr-xr-x  4 root root 100 Jul 18 00:20 .
| drwxr-xr-x 23 root root 580 Jul 18 00:20 ..
| drwxr-xr-x  2 root root  60 Jul 18 00:20 graphical.target.wants
| drwxr-xr-x  2 root root  60 Jul 18 00:20 multi-user.target.wants
| -rw-r--r--  1 root root 537 Jul 18 00:20 vboxadd.service
|
| root@spce:~# systemctl cat vboxadd.service
| # /run/systemd/generator.late/vboxadd.service
| # Automatically generated by systemd-sysv-generator
|
| [Unit]
| Documentation=man:systemd-sysv-generator(8)
| SourcePath=/etc/init.d/vboxadd
| Description=LSB: VirtualBox Linux Additions kernel modules
| Before=multi-user.target
| Before=multi-user.target
| Before=multi-user.target
| Before=graphical.target
| Before=display-manager.service
|
| [Service]
| Type=forking
| Restart=no
| TimeoutSec=5min
| IgnoreSIGPIPE=no
| KillMode=process
| GuessMainPID=no
| RemainAfterExit=yes
| SuccessExitStatus=5 6
| ExecStart=/etc/init.d/vboxadd start
| ExecStop=/etc/init.d/vboxadd stop

We don't expect any init scripts to be present, as all our services must
have systemd unit files. Therefore we check for absence of systemd's
/run/systemd/generator.late in our system-tests, which started to fail
with the upgrade to VBoxGuestAdditions-v7.0.6 due to the systemd
presence detection mentioned above.

Let's fake presence of systemd before invoking VBoxGuestAdditions's
installer, to avoid ending up with unexpected vbox* init scripts.

[1] See svn rev 92682:
    https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Installer/linux/routines.sh?rev=92682
    https://www.virtualbox.org/changeset?old=92681&old_path=vbox%2Ftrunk%2Fsrc%2FVBox%2FInstaller%2Flinux%2Froutines.sh&new=92682&new_path=vbox%2Ftrunk%2Fsrc%2FVBox%2FInstaller%2Flinux%2Froutines.sh

Change-Id: Ifd11460e3a8fd4f4c1269453a9b8376065861b8e
mr11.5
Michael Prokop 2 years ago
parent 6c960afee4
commit 8601193128

@ -1099,6 +1099,11 @@ vagrant_configuration() {
FAKE_UNAME='/tmp/fake-uname.so'
fi
# if ! [ -d "${TARGET}/run/systemd/system" ] ; then
echo "Creating /run/systemd/system for systemd detection within VBoxLinuxAdditions"
mkdir -p "${TARGET}/run/systemd/system"
# fi
grml-chroot "${TARGET}" env \
UTS_RELEASE="${KERNELVERSION}" LD_PRELOAD="${FAKE_UNAME}" \
/media/cdrom/VBoxLinuxAdditions.run --nox11 || true

Loading…
Cancel
Save