- VirtualBox has always been started by systemd utilizing the old-style scripts in /etc/init.d.

These should be converted to the service files native to systemd. This issue has been forced
  as a recent update to Tumbleweed broke the startup of VB for both TW hosts and guests. This
  change starts the conversion to native systemd files. The original scripts are still used; however,
  service files are used to start and stop the VB components. In a later change, all action will
  be accomplished using systemd service files.

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=327
This commit is contained in:
Larry Finger 2017-04-29 05:52:10 +00:00 committed by Git OBS Bridge
parent c3b3915a83
commit 1ffdd9492b
4 changed files with 79 additions and 0 deletions

21
vboxadd-service.service Normal file
View File

@ -0,0 +1,21 @@
[Unit]
SourcePath=/etc/init.d/vboxadd-service
Description=Start/Stop VirtualBox Guest Linux module
After=remote-fs.target
Wants=remote-fs.target
[Service]
Type=simple
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
SuccessExitStatus=5 6
ExecStart=/etc/init.d/vboxadd-service start
ExecStop=/etc/init.d/vboxadd-service stop
[Install]
WantedBy=multi-user.target.wants

21
vboxdrv.service Normal file
View File

@ -0,0 +1,21 @@
[Unit]
Description=Start/Stop VirtualBox host kernel modules
SourcePath=/etc/init.d/vboxdrv
After=remote-fs.target
Wants=remote-fs.target
[Service]
Type=simple
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
SuccessExitStatus=5 6
ExecStart=/etc/init.d/vboxdrv start
ExecStop=/etc/init.d/vboxdrv stop
[Install]
WantedBy=multi-user.target.wants

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Sat Apr 29 04:38:33 UTC 2017 - Larry.Finger@lwfinger.net
- VirtualBox has always been started by systemd utilizing the old-style scripts in /etc/init.d.
These should be converted to the service files native to systemd. This issue has been forced
as a recent update to Tumbleweed broke the startup of VB for both TW hosts and guests. This
change starts the conversion to native systemd files. The original scripts are still used; however,
service files are used to start and stop the VB components. In a later change, all action will
be accomplished using systemd service files.
-------------------------------------------------------------------
Thu Apr 20 19:51:27 UTC 2017 - Larry.Finger@lwfinger.net

View File

@ -47,6 +47,8 @@ Source11: %{name}-60-vboxdrv.rules
# init script to start virtual boxes during boot, to be configured via /etc/sysconfig/vbox bnc#582398
Source12: %{name}-vboxes
Source13: %{name}-sysconfig.vbox
Source14: vboxdrv.service
Source15: vboxadd-service.service
Source98: %{name}-rpmlintrc
Source99: %{name}-patch-source.sh
#rework init scripts to fit suse needs
@ -100,6 +102,7 @@ BuildRequires: SDL-devel
BuildRequires: acpica
BuildRequires: alsa-devel
BuildRequires: bin86
BuildRequires: systemd-rpm-macros
%if 0%{?suse_version} > 1325
BuildRequires: libboost_headers-devel
%else
@ -181,6 +184,7 @@ BuildRequires: xorg-x11-libXext-devel-32bit
BuildRequires: xorg-x11-libXmu-devel-32bit
BuildRequires: xorg-x11-libXt-devel-32bit
%endif
%{?systemd_requires}
%description
VirtualBox is an extremely feature rich, high performance product
@ -461,6 +465,8 @@ install -d -m 755 %{buildroot}%{_libdir}/xorg/modules/drivers
install -d -m 755 %{buildroot}%{_libdir}/xorg/modules/input
install -d -m 755 %{buildroot}%{_sysconfdir}/default
install -d -m 755 %{buildroot}%{_sysconfdir}/init.d
install -d %{buildroot}%{_unitdir}
install -d %{buildroot}%{_unitdir}/multi-user.target.wants
install -d -m 755 %{buildroot}%{_sysconfdir}/vbox
install -d -m 755 %{buildroot}%{_udevrulesdir}
install -d -m 755 %{buildroot}%{_sysconfdir}/X11/xinit/xinitrc.d
@ -580,6 +586,11 @@ sed -i "s|%{NOLSB}%|yes|g;s|%{DEBIAN}%||g;s|%{PACKAGE}%|virtualbox|g" \
src/VBox/Installer/linux/vboxdrv.sh
install -m 744 src/VBox/Installer/linux/vboxdrv.sh %{buildroot}%{_sysconfdir}/init.d/vboxdrv
ln -s %{_sysconfdir}/init.d/vboxdrv %{buildroot}%{_sbindir}/rcvboxdrv
# Service files to load kernel modules on boot
install -m 0644 %{SOURCE14} %{buildroot}%{_unitdir}/vboxdrv.service
install -m 0644 %{SOURCE14} %{buildroot}%{_unitdir}/multi-user.target.wants/vboxdrv.service
install -m 0644 %{SOURCE15} %{buildroot}%{_unitdir}/vboxadd-service.service
install -m 0644 %{SOURCE15} %{buildroot}%{_unitdir}/multi-user.target.wants/vboxadd-service.service
# Init script to start virtual boxes during boot
install -m 755 %{SOURCE12} %{buildroot}%{_sysconfdir}/init.d/vboxes
ln -s %{_sysconfdir}/init.d/vboxes %{buildroot}%{_sbindir}/rcvboxes
@ -656,11 +667,13 @@ popd
%pre
getent group vboxusers >/dev/null || groupadd -r vboxusers
%service_add_pre vboxdrv.service
%pre guest-tools
# Add groups for seamless mode and shared folders:
getent group vboxguest >/dev/null || groupadd -r vboxguest
getent group vboxsf >/dev/null || groupadd -r vboxsf
%service_add_pre vboadd.service
#######################################################
# scriptlets - post
@ -676,6 +689,7 @@ getent group vboxsf >/dev/null || groupadd -r vboxsf
%set_permissions %{_vbox_instdir}/VBoxNetAdpCtl
%set_permissions %{_vbox_instdir}/VBoxHeadless
%set_permissions %{_vbox_instdir}/VBoxSDL
%service_add_post vboxdrv.service
%post qt
%set_permissions %{_vbox_instdir}/VirtualBox
@ -692,6 +706,7 @@ getent group vboxsf >/dev/null || groupadd -r vboxsf
%post guest-tools
%fillup_and_insserv -f -y vboxadd
%fillup_and_insserv -f -y vboxadd-service
%service_add_post vboxadd-service.service
%post websrv
%fillup_and_insserv -f -y vboxweb-service
@ -701,11 +716,13 @@ getent group vboxsf >/dev/null || groupadd -r vboxsf
%preun
%stop_on_removal vboxdrv
%service_del_preun vboxdrv.service
exit 0
%preun guest-tools
%stop_on_removal vboxadd-service
%stop_on_removal vboxadd
%service_del_preun vboxadd-service.service
exit 0
%preun websrv
@ -720,11 +737,15 @@ exit 0
/sbin/ldconfig
%restart_on_update vboxdrv
%insserv_cleanup
# immediately restarting virtualbox may not work. As such wait for the next reboot to restart
export DISABLE_RESTART_ON_UPDATE=yes
%service_del_postun vboxdrv.service
%postun guest-tools
%restart_on_update vboxadd
%restart_on_update vboxadd-service
%insserv_cleanup
%service_del_postun vboxadd-service.service
%postun websrv
%restart_on_update vboxweb-service
@ -794,6 +815,10 @@ exit 0
%dir %{_datadir}/virtualbox
%config %{_sysconfdir}/default/virtualbox
%config %{_sysconfdir}/init.d/vboxdrv
%dir %{_unitdir}
%dir %{_unitdir}/multi-user.target.wants
%{_unitdir}/vboxdrv.service
%{_unitdir}/multi-user.target.wants/vboxdrv.service
%dir %{_sysconfdir}/vbox
%config %{_sysconfdir}/vbox/vbox.cfg
%{_sysconfdir}/init.d/vboxes
@ -843,6 +868,8 @@ exit 0
%{_udevrulesdir}/60-vboxguest.rules
%config %{_sysconfdir}/init.d/vboxadd
%config %{_sysconfdir}/init.d/vboxadd-service
%{_unitdir}/vboxadd-service.service
%{_unitdir}/multi-user.target.wants/vboxadd-service.service
%{_sbindir}/rcvboxadd
%{_sbindir}/rcvboxadd-service
%if 0%{?suse_version} > 1310