VirtualBox not working after switching to systemd [Solved]

If you are new to Linux or new to Sabayon Linux and just not sure where to post, here ya go. Post without fear of being told to RTFM :-)

Moderator: Moderators

VirtualBox not working after switching to systemd [Solved]

Postby gocool » Sun Aug 25, 2013 19:00

Hi,
Can anyone help me with this

I switched to systemd and now my virtualbox doesnt bootup my virtual machines.

The following error messages are displayed

Image

Image
Last edited by gocool on Mon Aug 26, 2013 17:45, edited 1 time in total.
gocool
Growing Hen
 
Posts: 139
Joined: Wed Aug 06, 2008 13:37

Re: VirtualBox not working after switching to systemd

Postby gocool » Sun Aug 25, 2013 19:33

I assume all the startup services related to VirtualBox are in initd and now after the systemd upgrade they are not valid.

So I tried to do something like this but nothing worked.

Just to let keep a proper record on what steps I have taken, I am jotting it down below.

I created a service file
Code: Select all
vim /etc/systemd/system/vboxvmservice@.service


And in there I wrote the following
Code: Select all
[Unit]
Description=VBox Virtual Machine %i Service
Requires=systemd-modules-load.service
After=systemd-modules-load.service

[Service]
User='''user'''
Group=vboxusers
ExecStart=/usr/bin/VBoxHeadless -s %i
ExecStop=/usr/bin/VBoxManage controlvm %i savestate

[Install]
WantedBy=multi-user.target


I am not sure what it is, I copied it from here.

And then I enabled and started the service as follows:

Code: Select all
# systemctl enable vboxvmservice@WinXp-80gb
# systemctl start vboxvmservice@WinXp-80gb


Please note that WinXp-80gb is the name of my virtual machine.

Can anyone help me what I did wrong or how to get my virtual machine back up and running.
gocool
Growing Hen
 
Posts: 139
Joined: Wed Aug 06, 2008 13:37

Re: VirtualBox not working after switching to systemd

Postby linuxfluesterer » Sun Aug 25, 2013 21:35

Long time, I guessed, why my vbox... modules were not loaded automatically after changing to systemd.
Then I assumed the answer in systemd procedure.
In systemd protocol, additional modules to be loaded at boot time must be placed in
Code: Select all
/etc/modules-load.d/
insgesamt 16
drwxr-xr-x   2 0 0   59 15. Jul 09:36 .
drwxr-xr-x 152 0 0 8192 15. Jul 05:53 ..
-rw-r--r--   1 0 0    0 26. Jun 14:45 .keep_sys-apps_systemd-0
-rw-r--r--   1 0 0   96 15. Jul 09:36 Virtualbox.conf

Regard the files to be loaded must have .conf extension. In my case for Virtualbox.conf it looks like this:
Code: Select all
cat /etc/modules-load.d/Virtualbox.conf
# Module fuer virtualBox, mit Systemd geladen
# Stand: 15/07/2013
vboxdrv
vboxnetadp
vboxnetflt

Then, in case the systemd-modules-load.service is not started, you'll need to do then as root with:
Code: Select all
systemctl enable systemd-modules-load.service

Hint: I have found most systemd services for Sabayon in /usr/lib/systemd/system
Then after reboot, all modules in /etc/modules-load.d directory with ext .conf will be loaded at boot time.
For a closer look, watch this:
Code: Select all
http://www.freedesktop.org/software/systemd/man/modules-load.d.html

I am using VirtualBox with systemd now, and it is working fine with automatically loaded vbox... modules while booting. I haven't seen any hint of a .conf file in your description.

Hope I could inspire you to try this way. Anyway, try to load your vbox...modules manually. They must be loaded without error! If there is an error, then you have another problem...

-Linuxfluesterer (I love KDE ...)
TTIP is NOT YET stopped. Especially consider NHS and ISDS topics. Talk to your local politician to open eyes for danger to democracy because of TTIP
User avatar
linuxfluesterer
Old Dear Hen
 
Posts: 699
Joined: Thu Sep 20, 2012 19:47
Location: Germany

Re: VirtualBox not working after switching to systemd

Postby gocool » Mon Aug 26, 2013 2:04

Thanx linuxfluesterer for the detailed explanation.

But something is not right ...

In my machine, I see the directory /etc/modules-load.d/

But I don't see Virtualbox.conf

So I created a Virtualbox.conf and copy-pasted with the contents which you have

Code: Select all
cat /etc/modules-load.d/Virtualbox.conf
# Module fuer virtualBox, mit Systemd geladen
# Stand: 15/07/2013
vboxdrv
vboxnetadp
vboxnetflt



...then as root I attempted to start the systemd-modules-load.service, but I get the following error

Code: Select all
 # systemctl enable systemd-modules-load.service
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).


Do you think I may have to load some modules or package specific for systemd purposes??
gocool
Growing Hen
 
Posts: 139
Joined: Wed Aug 06, 2008 13:37

Re: VirtualBox not working after switching to systemd

Postby linuxfluesterer » Mon Aug 26, 2013 9:58

Honestly, I can only guess now. I have checked some websites for service files and there is shown a chapter 'Install'.
So, I would try this: Add th following lines as root at the end of your systemd-modules-load.service file:

Code: Select all
[Install]
WantedBy=multi-user.target

The location is here:
Code: Select all
/usr/lib/systemd/system/systemd-modules-load.services

After change the .service file, execute:
Code: Select all
systemctl enable systemd-modules-load.service

Hope to help you.

-Linuxfluesterer (I love KDE ...)
TTIP is NOT YET stopped. Especially consider NHS and ISDS topics. Talk to your local politician to open eyes for danger to democracy because of TTIP
User avatar
linuxfluesterer
Old Dear Hen
 
Posts: 699
Joined: Thu Sep 20, 2012 19:47
Location: Germany

Re: VirtualBox not working after switching to systemd

Postby gocool » Mon Aug 26, 2013 15:38

Thank you linuxfluesterer. But it gave me the same error.

So this is what I did.

I went ahead and created the Virtualbox.conf (which I deleted since it did not work)

And then added the following to systemd-modules-load.service file
Code: Select all
[Install]
WantedBy=multi-user.target


So this is how my systemd-modules-load.service file look
Code: Select all
# cat /usr/lib/systemd/system/systemd-modules-load.service

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

[Unit]
Description=Load Kernel Modules
Documentation=man:systemd-modules-load.service(8) man:modules-load.d(5)
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service
Before=sysinit.target shutdown.target
ConditionCapability=CAP_SYS_MODULE
ConditionDirectoryNotEmpty=|/lib/modules-load.d
ConditionDirectoryNotEmpty=|/usr/lib/modules-load.d
ConditionDirectoryNotEmpty=|/usr/local/lib/modules-load.d
ConditionDirectoryNotEmpty=|/etc/modules-load.d
ConditionDirectoryNotEmpty=|/run/modules-load.d
ConditionKernelCommandLine=|modules-load
ConditionKernelCommandLine=|rd.modules-load

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/systemd/systemd-modules-load

[Install]
WantedBy=multi-user.target


And when I tried to enable the service all I see is that it created a soft link as shown below

Code: Select all
sabayon modules-load.d # systemctl enable systemd-modules-load.service

ln -s '/usr/lib/systemd/system/systemd-modules-load.service' '/etc/systemd/system/multi-user.target.wants/systemd-modules-load.service'


And when I tried to open virtualbox I get the same error. Is there anything else I need to do like start up a service or create a service for each virtual machine?

reinstall the kernel module by executing
/etc/init.d/vboxdrv setup
as root. If its available in this distribution install the DKMS package first.

And I have no clue what the DKMS package is

And the other thing I noticed is I am not seeing this vboxdrv in the system at all.
gocool
Growing Hen
 
Posts: 139
Joined: Wed Aug 06, 2008 13:37

Re: VirtualBox not working after switching to systemd

Postby linuxfluesterer » Mon Aug 26, 2013 16:00

Did you install the VirtualBox modules? Maybe they don't match to your kernel.
This:
/etc/init.d/vboxdrv setup

does not work in Sabayon because Sabayon is not prepared to create modules on your running system. Therefore, you must install the missing modules from repository:
So, open a console pls. Then you must be root (with su). Then install the virtualbox-modules matching to your kernel with:
Code: Select all
equo install virtualbox-modules#$(uname -r)

Do it exactly this way, only then the correct modules will be installed.
After installing, make a test with:
Code: Select all
modprobe vboxdrv
modprobe vboxnetadp
modprobe vboxnetflt

Only then, when there is NO error, the modules are installed and match to exactly your kernel.
You could start VirtualBox as normal user (not as root!) then, when your modules are loaded.
Rigo has problems to determine the correct kernel sometimes. But the value of -> uname -r in a console tells equo to install the modules matching to the actual kernel.

Hope to help you.

-Linuxfluesterer (I love KDE ...)
TTIP is NOT YET stopped. Especially consider NHS and ISDS topics. Talk to your local politician to open eyes for danger to democracy because of TTIP
User avatar
linuxfluesterer
Old Dear Hen
 
Posts: 699
Joined: Thu Sep 20, 2012 19:47
Location: Germany

Re: VirtualBox not working after switching to systemd

Postby gocool » Mon Aug 26, 2013 17:45

Thank you linuxfluesterer. No words to describe my gratitude for your time energy and knowledge spent on me.

Yes it worked now.

Additionally I uninstalled and reinstalled the virtualbox and also the modules like you mentioned. And it worked like a charm.
gocool
Growing Hen
 
Posts: 139
Joined: Wed Aug 06, 2008 13:37

Re: VirtualBox not working after switching to systemd [Solve

Postby eor2004 » Wed Sep 18, 2013 20:05

@ Linuxfluesterer:

equo install virtualbox-modules#$(uname -r)

Thank you, this command fixed my virtualbox! :salut:
Sabayon Linux MATE 64-bit
Gigabyte G41M-ES2L-->2gb ram
Intel Pentium Dual Core 2.60ghz-->E5300
WD-6400AAKS-Caviar-SE16-640gb-->XFS filesystem
User avatar
eor2004
Simple Hen
 
Posts: 85
Joined: Thu Jul 12, 2012 15:46
Location: Puerto Rico


Return to Beginners|Newbies Area

Who is online

Users browsing this forum: No registered users and 1 guest