Re: [arch-general] Disable vboxadd.service & vboxadd-service.service after guest additions included in 4.15?
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-then@.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-then@4.15.service Requires=kernel-version-less-then@4.15.service /etc/systemd/system/vboxadd-service.service.d/kerver.conf --------------------------------------------------------- [Unit] After=kernel-version-less-then@4.15.service Requires=kernel-version-less-then@4.15.service In this way, if my bash-fu is correct, the version compare will fail the kernel-version-less-then@4.15.service and vboxadd and vboxadd-service will not start Giacomo Longo
On 11 February 2018 at 13:47, Giacomo Longo via arch-general <arch-general@archlinux.org> wrote:
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-then@.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-then@4.15.service Requires=kernel-version-less-then@4.15.service
/etc/systemd/system/vboxadd-service.service.d/kerver.conf --------------------------------------------------------- [Unit] After=kernel-version-less-then@4.15.service Requires=kernel-version-less-then@4.15.service
In this way, if my bash-fu is correct, the version compare will fail the kernel-version-less-then@4.15.service and vboxadd and vboxadd-service will not start
there is ConditionKernelVersion= man systemd.unit -- damjan
You can also use ConditionKernelVersion like so /etc/systemd/system/{vboxadd,vboxadd-service}.service.d/kerver.conf ------------------------------------------------- [Unit] ConditionKernelVersion=<4.15 Giacomo Longo 2018-02-11 13:47 GMT+01:00 Giacomo Longo <gabibbo97@gmail.com>:
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-then@.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-then@4.15.service Requires=kernel-version-less-then@4.15.service
/etc/systemd/system/vboxadd-service.service.d/kerver.conf --------------------------------------------------------- [Unit] After=kernel-version-less-then@4.15.service Requires=kernel-version-less-then@4.15.service
In this way, if my bash-fu is correct, the version compare will fail the kernel-version-less-then@4.15.service and vboxadd and vboxadd-service will not start
Giacomo Longo
On 02/11/2018 08:14 AM, Giacomo Longo via arch-general wrote:
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.
participants (3)
-
Damjan Georgievski
-
David C. Rankin
-
Giacomo Longo