12

Using Ubuntu 16.04 and installing VirtualBox 5 according to the prescribed method here for "Debian-based Linux distributions":

https://www.virtualbox.org/wiki/Linux_Downloads

This faces a problem with the kernel in this version that is solved as such:

https://askubuntu.com/a/768310/254069

Attempting to create a host-only adapter like so fails:

$ VBoxManage hostonlyif create
0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg*)" at line 71 of file VBoxManageHostonly.cpp
TomSchober
  • 504
  • 1
  • 5
  • 15

4 Answers4

9

It turns out that the solution to the networking problem is a separate module that must be signed to allow this specific function. As stated in the signing solution here: https://askubuntu.com/a/768310/254069

VBoxManage hostonlyif create needs the following modules to also be accessible (modprobe):

openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=MOK Signing/"

sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxdrv)
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxnetflt)
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxnetadp)
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxpci)

sudo mokutil --import MOK.der

Restart and "Enroll MOK"

$ VBoxManage hostonlyif create
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interface 'vboxnet1' was successfully created
TomSchober
  • 504
  • 1
  • 5
  • 15
0

I found another simpler solution to solve this problem but it relates to VirtualBox 6.0+ . . . it might also work with 5.x but I didn't test it for that version.

The issue is because the kernel modules are not signed by default so in order to do that you need to add the public keys from Oracle.

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -

Once you add these keys, you can install VirtualBox in the normal way and it will work fine with most features (except for those that require the proprietary extension, would still need to install that for those features)

0

In Ubuntu 17 zesty, fresh install, fresh VirtualBox, host-only network don't work.

# ip a
4: vboxnet0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 0a:00:27:00:00:00 brd ff:ff:ff:ff:ff:ff
5: vboxnet1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 0a:00:27:00:00:01 brd ff:ff:ff:ff:ff:ff

the solution was:

# ip link set vboxnet0 up
# ip link set vboxnet1 up

and works !!!

hejeroaz
  • 101
  • 1
    I don't understand. Please clarify where to put/enter or what to do with these Strings. Console Command? Configuration? Host or Guest? – mondjunge May 18 '17 at 14:40
-1

Run VirtualBox in Sandbox using Firejail as below:

firejail --noprofile virtualbox
Eliah Kagan
  • 117,780