Discussion:
[arch-general] Disable vboxadd.service & vboxadd-service.service after guest additions included in 4.15?
David C. Rankin
2018-02-10 04:55:20 UTC
Permalink
All,

I use vitrualbox-bin (AUR) along with ext-oracle extension pack referenced
in https://wiki.archlinux.org/index.php/VirtualBox#Extension_pack. I have
followed the addition of the guest-addition kernel modules to the 4.15 kernel,
but I do not know how to handle that addition regarding what changes are
needed in my arch guests.

Specifically, since the guest additions are included in 4.15, but not in
LTS, how do I disable the load the guest additions modules when booting the VM
on 4.15, but not when booting LTS?

Currently on boot with 4.15, errors are generated when vboxadd attempts to
load the guest addition modules since, presumably, they are already in the
kernel, e.g.

22:23 vl1:~> sc status vboxadd-service
● vboxadd-service.service
Loaded: loaded (/opt/VBoxGuestAdditions-5.2.6/init/vboxadd-service;
enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2018-02-09 22:16:33 CST; 7min ago
Process: 1056 ExecStart=/opt/VBoxGuestAdditions-5.2.6/init/vboxadd-service
start (code=exited, status=1/FAILURE)

Feb 09 22:16:33 vl1 systemd[1]: Starting vboxadd-service.service...
Feb 09 22:16:33 vl1 vboxadd-service[1056]: vboxadd-service.sh: Starting
VirtualBox Guest Addition service.
Feb 09 22:16:33 vl1 vboxadd-service.sh[1059]: Starting VirtualBox Guest
Addition service.
Feb 09 22:16:33 vl1 vboxadd-service[1056]: VirtualBox Additions module not loaded!
Feb 09 22:16:33 vl1 systemd[1]: vboxadd-service.service: Control process
exited, code=exited status=1
Feb 09 22:16:33 vl1 systemd[1]: vboxadd-service.service: Failed with result
'exit-code'.
Feb 09 22:16:33 vl1 systemd[1]: Failed to start vboxadd-service.service.
22:24 vl1:~> sc status vboxadd
● vboxadd.service
Loaded: loaded (/opt/VBoxGuestAdditions-5.2.6/init/vboxadd; enabled; vendor
preset: disabled)
Active: failed (Result: exit-code) since Fri 2018-02-09 22:16:33 CST; 7min ago
Process: 288 ExecStart=/opt/VBoxGuestAdditions-5.2.6/init/vboxadd start
(code=exited, status=1/FAILURE)
Main PID: 288 (code=exited, status=1/FAILURE)

Feb 09 22:16:23 vl1 vboxadd[288]: VirtualBox Guest Additions: Building the
VirtualBox Guest Additions kernel modules.
Feb 09 22:16:33 vl1 vboxadd[288]: VirtualBox Guest Additions: Look at
/var/log/vboxadd-setup.log to find out what went w
Feb 09 22:16:33 vl1 useradd[1042]: failed adding user 'vboxadd', data deleted
Feb 09 22:16:33 vl1 useradd[1043]: failed adding user 'vboxadd', data deleted
Feb 09 22:16:33 vl1 vboxadd[288]: groupadd: group 'vboxadd' already exists
Feb 09 22:16:33 vl1 vboxadd[288]: modprobe vboxguest failed
Feb 09 22:16:33 vl1 vboxadd[288]: The log file /var/log/vboxadd-setup.log may
contain further information.
Feb 09 22:16:33 vl1 systemd[1]: vboxadd.service: Main process exited,
code=exited, status=1/FAILURE
Feb 09 22:16:33 vl1 systemd[1]: vboxadd.service: Failed with result 'exit-code'.
Feb 09 22:16:33 vl1 systemd[1]: Failed to start vboxadd.service.

The guest additions in the 4.15 kernel work fine, so my first thought was to
disable both vboxadd.service and vboxadd-service.service, but then what do I
do for LTS?

I've checked the wiki and there are no notes related to handling this issue.
Any suggestions?
--
David C. Rankin, J.D.,P.E.
Giacomo Longo via arch-general
2018-02-11 12:47:22 UTC
Permalink
So you want to have

vboxadd-service and vboxadd systemd services not starting on Linux kernel
versions 4.15 and above?

You can manage this by creating a template systemd unit

/etc/systemd/system/kernel-version-less-***@.service
-----------------------------------
[Unit]
Description=Check if currently installed kernel version is less than target

[Service]
Type=oneshot
ExecStart=/usr/bin/sh -c '[[ "$(/usr/bin/vercmp %i %v)" = "1" ]]'
Restart=no
CollectMode=inactive-or-failed

[Install]
WantedBy=multi-user.target

Then create the directories

/etc/systemd/system/vboxadd.service.d/
/etc/systemd/system/vboxadd-service.service.d/

Then for each service


/etc/systemd/system/vboxadd.service.d/kerver.conf
-------------------------------------------------
[Unit]
After=kernel-version-less-***@4.15.service
Requires=kernel-version-less-***@4.15.service

/etc/systemd/system/vboxadd-service.service.d/kerver.conf
---------------------------------------------------------
[Unit]
After=kernel-version-less-***@4.15.service
Requires=kernel-version-less-***@4.15.service

In this way, if my bash-fu is correct, the version compare will fail the
kernel-version-less-***@4.15.service and vboxadd and vboxadd-service will
not start

Giacomo Longo
Damjan Georgievski via arch-general
2018-02-11 14:04:28 UTC
Permalink
On 11 February 2018 at 13:47, Giacomo Longo via arch-general
Post by Giacomo Longo via arch-general
So you want to have
vboxadd-service and vboxadd systemd services not starting on Linux kernel
versions 4.15 and above?
You can manage this by creating a template systemd unit
-----------------------------------
[Unit]
Description=Check if currently installed kernel version is less than target
[Service]
Type=oneshot
ExecStart=/usr/bin/sh -c '[[ "$(/usr/bin/vercmp %i %v)" = "1" ]]'
Restart=no
CollectMode=inactive-or-failed
[Install]
WantedBy=multi-user.target
Then create the directories
/etc/systemd/system/vboxadd.service.d/
/etc/systemd/system/vboxadd-service.service.d/
Then for each service
/etc/systemd/system/vboxadd.service.d/kerver.conf
-------------------------------------------------
[Unit]
/etc/systemd/system/vboxadd-service.service.d/kerver.conf
---------------------------------------------------------
[Unit]
In this way, if my bash-fu is correct, the version compare will fail the
not start
there is ConditionKernelVersion=
man systemd.unit
--
damjan
Giacomo Longo via arch-general
2018-02-11 14:14:36 UTC
Permalink
You can also use ConditionKernelVersion like so

/etc/systemd/system/{vboxadd,vboxadd-service}.service.d/kerver.conf
-------------------------------------------------
[Unit]
ConditionKernelVersion=<4.15


Giacomo Longo
Post by Giacomo Longo via arch-general
So you want to have
vboxadd-service and vboxadd systemd services not starting on Linux kernel
versions 4.15 and above?
You can manage this by creating a template systemd unit
-----------------------------------
[Unit]
Description=Check if currently installed kernel version is less than target
[Service]
Type=oneshot
ExecStart=/usr/bin/sh -c '[[ "$(/usr/bin/vercmp %i %v)" = "1" ]]'
Restart=no
CollectMode=inactive-or-failed
[Install]
WantedBy=multi-user.target
Then create the directories
/etc/systemd/system/vboxadd.service.d/
/etc/systemd/system/vboxadd-service.service.d/
Then for each service
/etc/systemd/system/vboxadd.service.d/kerver.conf
-------------------------------------------------
[Unit]
/etc/systemd/system/vboxadd-service.service.d/kerver.conf
---------------------------------------------------------
[Unit]
In this way, if my bash-fu is correct, the version compare will fail the
will not start
Giacomo Longo
David C. Rankin
2018-02-11 22:26:14 UTC
Permalink
Post by Giacomo Longo via arch-general
You can also use ConditionKernelVersion like so
/etc/systemd/system/{vboxadd,vboxadd-service}.service.d/kerver.conf
-------------------------------------------------
[Unit]
ConditionKernelVersion=<4.15
Giacomo Longo
Yes! Thank you Giacomo and Damjan.

This is exactly what I was looking for but knew not what it was or where it
lived in systemd. This should allows an if (kernelver < 4.15) load the
vboxguest modules.
--
David C. Rankin, J.D.,P.E.
David C. Rankin
2018-02-18 08:57:22 UTC
Permalink
Post by David C. Rankin
The guest additions in the 4.15 kernel work fine, so my first thought was to
disable both vboxadd.service and vboxadd-service.service, but then what do I
do for LTS?
And that indeed is the answer (from the #vbox IRC tonight). If you run a Arch
guest with 4.15+, you can just disable the systemd vboxadd and vboxadd-service
services (or install the vbox guest additions altogether) and auto
capture/release of the mouse, X, etc.. continues to work fine. I'd add this to
the wiki, but it would just be removed...
--
David C. Rankin, J.D.,P.E.
mar77i via arch-general
2018-02-18 09:28:59 UTC
Permalink
-------- Original Message --------
... I'd add this to the wiki, but it would just be removed...
You must be fun at parties.

cheers!
mar77i


Sent with ProtonMail Secure Email.

Loading...