Thinking Out Loud

March 25, 2017

Vagrant was unable to mount VirtualBox shared folders – Solved

Filed under: Vagrant,VirtualBox — mdinh @ 5:14 pm

My starting point of installing Vagrant on Windows:
https://www.sitepoint.com/getting-started-vagrant-windows/
http://tech.osteel.me/posts/2015/01/25/how-to-use-vagrant-on-windows.html

If you are attempting to use Vagrant with VirtualBox, you may encountered issues with mounting shared folders.

Update VirtualBox to 5.1.18r114002

E:\Vagrant\sitepoint>vagrant version

Installed Version: 1.9.3
Latest Version: 1.9.3

You're running an up-to-date version of Vagrant!

E:\Vagrant\sitepoint>vagrant init ubuntu/trusty64

A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

E:\Vagrant\sitepoint>vagrant up

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/trusty64'
    default: URL: https://atlas.hashicorp.com/ubuntu/trusty64
==> default: Adding box 'ubuntu/trusty64' (v20170313.0.7) for provider: virtualbox
    default: Downloading: https://atlas.hashicorp.com/ubuntu/boxes/trusty64/versions/20170313.0.7/providers/virtualbox.box
==> default: Successfully added box 'ubuntu/trusty64' (v20170313.0.7) for 'virtualbox'!
..........
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 4.3.36
    default: VirtualBox Version: 5.1
==> default: Mounting shared folders...
    default: /vagrant => E:/Vagrant/sitepoint
Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:

mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant

The error output from the command was:

: No such file or directory

E:\Vagrant\sitepoint>vboxmanage –version

5.1.16r113841

E:\Vagrant\sitepoint>vboxmanage list runningvms

"sitepoint_default_1490457189188_6052" {b176bb95-09ff-44d8-863f-def329afb003}

E:\Vagrant\sitepoint>vboxmanage showvminfo b176bb95-09ff-44d8-863f-def329afb003

Name:            sitepoint_default_1490457189188_6052
Groups:          /
Guest OS:        Ubuntu (64-bit)

Shared folders:
Name: 'vagrant', Host path: '\\?\E:\Vagrant\sitepoint' (machine mapping), writable

E:\Vagrant\sitepoint>vagrant plugin install vagrant-vbguest

Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Fetching: micromachine-2.0.0.gem (100%)
Fetching: vagrant-vbguest-0.13.0.gem (100%)
Installed the plugin 'vagrant-vbguest (0.13.0)'!

E:\Vagrant\sitepoint>vboxmanage controlvm sitepoint_default_1490457189188_6052 poweroff

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

E:\Vagrant\sitepoint>vboxmanage unregistervm sitepoint_default_1490457189188_6052 –delete

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

Update VirtualBox and Try Again

This time, create new directory: E:\Vagrant\ubuntu

E:\Vagrant\ubuntu>vboxmanage –version

5.1.18r114002

E:\Vagrant\ubuntu>vagrant init ubuntu/trusty64

A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

E:\Vagrant\ubuntu>vagrant up

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/trusty64'
    default: URL: https://atlas.hashicorp.com/ubuntu/trusty64
==> default: Adding box 'ubuntu/trusty64' (v20170313.0.7) for provider: virtualbox
    default: Downloading: https://atlas.hashicorp.com/ubuntu/boxes/trusty64/versions/20170313.0.7/providers/virtualbox.box
    default: Progress: 100% (Rate: 1519k/s, Estimated time remaining: --:--:--)
==> default: Successfully added box 'ubuntu/trusty64' (v20170313.0.7) for 'virtualbox'!
..........
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 4.3.36
    default: VirtualBox Version: 5.1
==> default: Mounting shared folders...
    default: /vagrant => E:/Vagrant/ubuntu

E:\Vagrant\ubuntu>

Config Public and Private Keys

E:\Vagrant\ubuntu>vagrant ssh-config

Host default
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile E:/Vagrant/ubuntu/.vagrant/machines/default/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL

Connect to server: with passwordless auto login using PuTTY

Using username "vagrant".
Authenticating with public key "imported-openssh-key"
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-113-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Sat Mar 25 17:23:22 UTC 2017

  System load:  0.0               Processes:           74
  Usage of /:   3.6% of 39.34GB   Users logged in:     0
  Memory usage: 25%               IP address for eth0: 10.0.2.15
  Swap usage:   0%

  Graph this data and manage this system at:
    https://landscape.canonical.com/

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.

New release '16.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


Last login: Sat Mar 25 17:23:22 2017 from 10.0.2.2
vagrant@vagrant-ubuntu-trusty-64:~$

E:\Vagrant\ubuntu>vagrant ssh

Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-113-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Sat Mar 25 17:36:01 UTC 2017

  System load:  0.0               Processes:           77
  Usage of /:   3.6% of 39.34GB   Users logged in:     1
  Memory usage: 25%               IP address for eth0: 10.0.2.15
  Swap usage:   0%

  Graph this data and manage this system at:
    https://landscape.canonical.com/

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.

New release '16.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


Last login: Sat Mar 25 17:36:01 2017 from 10.0.2.2
vagrant@vagrant-ubuntu-trusty-64:~$
Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: