VirtualBox Failed to Save Settings

I recently installed VirtualBox configured internet connection to the internet for a virtual windows 7 machine I’ve installed using Vagrant, tried to setup USB, but got the following message: “Failed to save settings – Empty or null HostOnly interface name is not valid.”. Looking at the details, I saw the following “Result Code: E_FAIL (0x80004005) Component: NetworkAdapterWrapper …”.I don’t remember when I started to get that popup message. Couldn’t find any HostOnly adapter using the VirtualBox GUI. Finding the solution in the web is too hard. and I can’t find anything in the user guide either. But, one useful thing I know: in Linux and Unix-like system, I can find configuration files. They are usually found in directories whose names begin with ‘.’. followed by the program’s name or under “${HOME}/.config’ or directories created by the software. This time, the file was found in “${HOME}/VirtualBox VMs/<machine-name>”.
In this case: “${HOME}/VirtualBox VMs/windows7_default_1563689015423_90469/”. In this directory there are files with the suffix ‘.vbox’. They are XML files. In one of them, named “windows7_default_1563689015423_90469.vbox”, I find the following element:

        <Adapter slot="1" MACAddress="08002718154D" cable="true" type="82540EM">
            <InternalNetwork name="intnet"/%gt;
            <NATNetwork name="NatNetwork"/>
          <HostOnlyInterface name="VirtualBox Host-Only Ethernet Adapter #2"/>

Comment it out.
Problem solved.

Add A New Local IP Address in FreeBSD

Before you upload an internet site, you better test it on your local machine. To do that, you should allocate an IP address known as a loopback address that does not require a modem for access. If you’ve installed Apache Httpd server, you’ll probably get an HTML page that reads “It works” upon connecting to “http://localhost” or” from the web browser. But what if you want to create another site? How to make your server recognize an IP?

In this post I will describe by example the process of adding a local IP.

Step 1: Associate an IP with a Domain Name

If you want to create a domain name such as ‘example.coq‘, add a line for it in /etc/hosts in the format:

<inet-addr>   <alias>

For example:               example.coq

Step 2: Attach the IP Address To a Network Interface

To make an address available to internet servers, attach it to a network interface.

A network interface is the identifier followed by colons at the beginning of blocks returned by the command ifconfigFor example:

In this block lo0 is an interface name.

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    inet6 ::1 prefixlen 128 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 
    inet netmask 0xff000000 

From the prefix ‘lo’ of the interface name, you can know it is a loopback interface.

You can attach an address, login as root, and run ifconfig like in the following example:

ifconfig lo0 netmask alias

This will attach IP address to the loopback interface ‘lo0’

You can make the operating system add it each type you start your computer, by adding the following line to /etc/rc.conf:

ifconfig_lo0_alias0="inet netmask"

You can learn more about virtual hosts from the section ‘11.6 Virtual Hosts” of the FreeBSD Handbook

Step 3: Start a Listening Server

Now, you can start a server that will listen on your address. You can do it by adding a virtual host in apache httpd, create a server in ‘node.js’, etc.

If you’ve installed ‘Apache24’ from the ports, you can find documentation in '/usr/local/share/doc/apache24'. In addition, you can find documentation in the httpd site.

Written with StackEdit.