Monday, 19 October 2015

Fedora 22 vagrant 1.7.2 - virtualbox machine in gurumeditation state

Description of the problem

Today I've started my vagrant with as usual, but it hanged after writing the message "configuring network interfaces". I cancelled the machine booting by Ctrl+C and tried to restart the VM by vagrant halt, vagrant up. Unfortunately my machine ended in a gurumeditation error (thanks Virtualbox, I've learned something about Amiga on wikipedia ;)

virtualbox guru meditation error

Fixing

I found a lot of results via google about this problem. Mostly it were bugs in Virtualbox, problems with drivers, kernels incompatibility issues. Sometimes it helped somebody to disable nested paging or hardware virtualization.
It didn't help to me.

Fixed

Finally I've solved my issue by uninstalling Virtualbox 4.3.30, installing Virtualbox 5 and uninstalling Vagrant 1.7.2 and installing Vagrant 1.7.4

Virtualbox 5 was already in my oficial Fedora repo so sudo dnf install VirtualBox-5.0 did the trick. For Vagrant 1.7.4 I had to download the rmp package from vagrantup.com because there is only 1.7.2 version in the official repo at the moment.


Saturday, 10 October 2015

Virtualbox interface vboxnet0 blocked by firewall on Fedora 22

Fedora 22 and firewall zones

On Fedora 22 the firewall has so called zones. It's quite a nice feature. You can have different configurations of firewall for each zone and you can simply assign network interfaces and network connections into the zones.
You can for example assign your wifi connection at home into to zone "home" and when you are on a public wifi, you will assign that connection to the "public" zone which will be probably more strict.

My configuration for virtualbox (vagrant)

On my notebook I got zone "internal" and in this zone I have enabled services for NFS server (mountd, rpc-bind, nfs) which I use from the virtual machine as a client.
In this zone I got only network interfaces which are created by virtualbox for the virtual machines. They are named "vboxnet0", "vboxnet1".

In the past when I started the virtual machine (vagrant up) the network interface vboxnet0 appeared in the firewall configuration gui (firewall-config) and after I assigned it once into the internal zone it remained there.

Vagrant mounting of NFS folder

After one recent update of Fedora22 packages it happened that the vboxnet0 and vboxnet1 disappeared from the firewall configuration and therefore mounting of NFS folder stucked.
It stucked after "vagrant up;vagrant ssh", the terminal looked like this:
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Exporting NFS shared folders...
...
...
==> default: Mounting NFS shared folders...


Because I already had some troubles with the firewall in the past, the first thing which I did was that I've stopped the firewall for a minute and as the mounting continued I knew that the problem is in the firewall.

Fixing the firewall configuration

After opening the firewall configuration GUI (firewall-cmd) I saw that the vboxnet0 interface is not in the internal zone and unfortunately was not there at all and I was not able to create it (in the past it was always there)

Luckily the firewall got also command line tool for configuration - firewall-cmd.
In the  man pages you can find commands for listing interfaces and zones and also other useful commands for firewall configuration including the command adding an interface into a zone.

So simply with the commands
sudo firewall-cmd --zone=internal --add-interface=vboxnet0
sudo firewall-cmd --zone=internal --add-interface=vboxnet1
 
I've added both virtualbox interfaces into the the internal zone. And the NFS mount command continued. Great, it's so simple :)

But, there is one more thing, which the firewall experienced guys probably suspect...

After I restarted my computer the NFS mount was hanging again. And by
sudo firewall-cmd --zone=internal --list-interfaces command I find out that the interfaces are not in the internal zone again. I told to myself - "I need to make those firewall settings permanent somehow". And what do you think... there is a "permament" parameter ;)

sudo firewall-cmd --permanent --zone=internal --add-interface=vboxnet0

So simple. Lesson learned - command line tools overpower the graphic ones ;)


Monday, 5 October 2015

Virtualbox NFS troubles with freezing box - I have not solved this yet

I use vagrant for developement environment

For data sharing between host and box (synced folder) the best option seems to be NFS (regarding the performance).

My setup:
  Host: Fedora 22 / Ubuntu 14.10
  Box: CentOS release 6.7

Unfortunately even though NFS gives the best performance, I have troubles when reading or writing big files from/into the directory which is mounted by NFS protocol.
The vagrant box simply stops responding sometimes - got fronzen - and I have to restart it


After some digging I improved the freezing a little bit by switching the network adapter type of Virtualbox machine to "virtio-net" - Paravirtualized network.

After switching the virtualbox to the paravirtualized network adapter type the freezing stopped for smaller files.

Unfortunately it helped only for a file about 500MB, when I tried to copy bigger file (> 4GB), the box frozen again :-/


If you got any idea how to solve this, I would love to hear it in the comments, thanks ;)