VirtualBox: mount.vboxsf: mounting failed with the error: No such device [closed]
Asked Answered
G

21

190

I'm using VirtualBox with OS X as host and CentOS on the guest VM.

In OS X I created folder myfolder, added it as shared folder to the VM, turned on the VM, in CentOS created folder /home/user/myfolder and typing:

sudo mount -t vboxsf myfolder /home/user/myfolder

and have output:

/sbin/mount.vboxsf: mounting failed with the error: No such device

What I'm doing wrong?

UPDATED:

Guest Additions installed.

Glee answered 4/2, 2015 at 18:32 Comment(6)
Make sure Guest Additions is installed properly, you might have to sudo apt-get upgrade ;sudo apt-get install build-essential module-assistant; sudo m-a prepare; You need to see the Guest Aditions module being built...Aglet
To the random internet surfer who's having this problem: Do yourself a favour and look at the second answer.Skivvy
a tip - sudo mount -t vboxsf sf_folder /home/user/folder, here the sf_folder and folder MUST be different namesGlee
@Skivvy Which one is the "second answer"? Sorting can change. Click on share in the answer to get the permalink.Ldopa
@Glee Ok, that is the REAL answer. I literally spent hours trying to figure out why this wasn't working. Yes, need to have the folder namd and share name be different or the mount command does not work. FOLKS THIS IS THE REAL SOLUTION!Teazel
The second answer jrhashath is referring to is this: https://mcmap.net/q/134726/-virtualbox-mount-vboxsf-mounting-failed-with-the-error-no-such-device-closed by @kenorb And cnaize's above comment about names is also relevant.Capable
G
10

This was resolved by:

yum install gcc kernel-devel make

workaround is here: https://gist.github.com/larsar/1687725

Glee answered 5/2, 2015 at 18:9 Comment(9)
Ran all updates no luck at all. Sorry, the answer with 13 up-votes did work betterDysphemism
I'm using a Windows 7 host with RHEL 7 and this resolved it for me (including the info from the gist link) - Thank you!Statfarad
On Ubuntu, this worked: sudo apt-get install build-essential linux-headers-uname -r dkmsBernal
Fedora: kernels-headers was not enough, but kernel-devel helped! @cstroe: uname -r should be in $( ) - see @Dispraise answer.Bane
@AndrewShatnyy "answer with 13 up-votes" is ambiguous. Please post the permalink to the answer you are referring to (click share under the answer)Ldopa
@Ldopa you right sorry. https://mcmap.net/q/134726/-virtualbox-mount-vboxsf-mounting-failed-with-the-error-no-such-device-closed worked two times alreadyDysphemism
Hmmm, I didn't need to install "make," but I found the other two independently. This worked for me.Pentyl
On Ubuntu, I had success with sudo apt-get -y install dkms build-essential linux-headers-3.13.0-36-generic (uname -a to get the right version number)Bianka
This solution no longer works if your headers don't match the OS. For example 3.10.0-862 is no longer available. You must update to *-957Orcinol
S
190

My shared folder/clipboard stopped to work for some reason (probably due to a patch installation on my virtual machine).

sudo mount -t vboxsf Shared_Folder ~/SF/

Gave following result:

VirtualBox: mount.vboxsf: mounting failed with the error: No such device

The solution for me was to stop vboxadd and do a setup after that:

cd /opt/VBoxGuestAdditions-*/init  
sudo ./vboxadd setup
Spongy answered 5/4, 2015 at 9:56 Comment(11)
After upgrading my Ubuntu 12.04 vm to Ubuntu 14.04, my shared folders were empty in the vm and when trying to manually mount, I got the error /sbin/mount.vboxsf: mounting failed with the error: No such device. After running the above and restarting the system, my shared folders appeared as they did before upgrading.. thanks!Liquesce
The problem persists on VirtualBox 5.0.18 with an Ubuntu 16.04 guest, and this solution worked for me.Matteson
how do you stop vboxadd?Paiz
yes, I'm also curious about aristofun's comment. is vboxadd a process on the guest?Epact
Thanks! I also had to install the vagrant-vbguest plugin - https://mcmap.net/q/107643/-vagrant-error-failed-to-mount-folders-in-linux-guestUndergo
@Paiz @Epact : in that same directory, before sudo ./vboxadd setup, you can do sudo ./vboxadd stop. Not sure if it's still necessary, but I'm guessing that's what that sentence means.Briony
Before running the above command, install yum and then run yum install gcc kernel-devel make followed by the above commands. Worked for me.Chamkis
If the command complains VirtualBox Guest Additions: Kernel headers not found for target kernel 3.16.0-11-amd64. Please install them..., install linux-headers-3.16.0-11. (Replace by your kernel version.)Conversable
I had the issue with mac and this don't worked on my side. But installing new version AND removing + adding shared folder settings worked for me.Saiva
Leaving a comment for all beginners: If you run out of disk space in VirtualBox and end up in EMERGENCY MODE with mount.vboxsf: mounting failed with the error: No such device, remove some files using commands ( rm -r not-important-folder ), and then do as mentioned in this answer! Restart and voila! It worked perfectly for me! Edit and expand your partition before shutting down again.Anthropocentric
yeaaaah that did not solve my problem at al... Same error message :))Ingather
I
102

You're using share folders, so you need to install VirtualBox Guest Additions inside your virtual machine to support that feature.

Vagrant

If you're using Vagrant (OS X: brew cask install vagrant), run:

vagrant plugin install vagrant-vbguest
vagrant vbguest

In case it fails, check the logs, e.g.

vagrant ssh -c "cat /var/log/vboxadd-install.log"

Maybe you're just missing the kernel header files.

VM

Inside VM, you should install Guest Additions, kernel headers and start the service and double check if kernel extension is running.

This depends on the guest operating system, so here are brief steps:

  1. Install kernel include headers (required by VBoxLinuxAdditions).

    • RHEL: sudo apt-get update && sudo apt-get install kernel-devel
    • CentOS: sudo yum update && sudo yum -y install kernel-headers kernel-devel
  2. Install Guest Additions (this depends on the operating system).

    • Ubuntu: sudo apt-get -y install dkms build-essential linux-headers-$(uname -r) virtualbox-guest-additions-iso

      If you can't find it, check by aptitude search virtualbox.

    • Debian: sudo apt-get -y install build-essential module-assistant virtualbox-ose-guest-utils

      If you can't find it, check by dpkg -l | grep virtualbox.

    • manually by downloading the iso file inside VM (e.g. wget) and installing it, e.g.

      1. wget http://download.virtualbox.org/virtualbox/5.0.16/VBoxGuestAdditions_5.0.16.iso -P /tmp
      2. sudo mount -o loop /tmp/VBoxGuestAdditions_5.0.16.iso /mnt
      3. sudo sh -x /mnt/VBoxLinuxAdditions.run # --keep

        Extra debug: cd ~/install && sh -x ./install.sh /mnt/VBoxLinuxAdditions.run

  3. Double check that kernel extensions are up and running:

    • sudo modprobe vboxsf
  4. Start/restart the service:

    • manually: sudo /opt/VBoxGuestAdditions*/init/vboxadd setup (add sudo sh -x to debug)
    • Debian: sudo /etc/init.d/vboxadd-service start
    • Fedora: sudo /etc/init.d/vboxdrv setup
    • CentOS: sudo service VBoxService start

Building the main Guest Additions module

If above didn't work, here are more sophisticated steps to fix it. This assumes that you've already VBoxGuestAdditions installed (as shown above).

The most common reason why mounting shared folder doesn't work may related to building Guest Additions module which failed. If in /var/log/vboxadd-install.log you've the following error:

The headers for the current running kernel were not found.

this means either you didn't install kernel sources, or they cannot be found.

If you installed them already as instructed above, run this command:

$ sudo sh -x /opt/VBoxGuestAdditions-5.0.16/init/vboxadd setup 2>&1 | grep KERN
+ KERN_VER=2.6.32-573.18.1.el6.x86_64
+ KERN_DIR=/lib/modules/2.6.32-573.18.1.el6.x86_64/build

So basically vboxadd script is expecting your kernel sources to be available at the following dir:

ls -la /lib/modules/$(uname -r)/build

Check if the kernel dir exists (symbolic link points to the existing folder). If it's not, please install them to the right folder (e.g. in /usr/src/kernels).

So vboxadd script can enter your kernel source directory and run make kernelrelease, get the value and compare with your current kernel version.

Here is the logic:

KERN_VER=`uname -r`
KERN_DIR="/lib/modules/$KERN_VER/build"
if [ -d "$KERN_DIR" ]; then
    KERN_REL=`make -sC $KERN_DIR --no-print-directory kernelrelease 2>/dev/null || true`
    if [ -z "$KERN_REL" -o "x$KERN_REL" = "x$KERN_VER" ]; then
        return 0
    fi
fi

If the kernel version doesn't match with the sources, maybe you've to upgrade your Linux kernel (in case the sources are newer than your kernel).

CentOS

Try:

vagrant plugin install vagrant-vbguest vagrant vbgues

If won't work, try the following manual steps for CentOS:

$ sudo yum update
$ sudo yum install kernel-$(uname -r) kernel-devel kernel-headers # or: reinstall
$ rpm -qf /lib/modules/$(uname -r)/build
kernel-2.6.32-573.18.1.el6.x86_64
$ ls -la /lib/modules/$(uname -r)/build
$ sudo reboot # and re-login
$ sudo ln -sv /usr/src/kernels/$(uname -r) /lib/modules/$(uname -r)/build
$ sudo /opt/VBoxGuestAdditions-*/init/vboxadd setup
Inscription answered 8/6, 2016 at 14:56 Comment(4)
RE the CentOS fix, it solved my issue but make sure you have gcc installed.Pacifa
Using Chef's Test Kitchen (Vagrant), vagrant plugin install vagrant-vbguest worked for meEsthonia
In my case it was because the GuestAdditions weren't the same declared between Vagrant and the Guest.Pro
vagrant plugin install vagrant-vbguest vagrant vbguest works also on centos 7 and resolved the issue. ThanksBloodline
A
58

I am able to resolved this by running below commmand

modprobe -a vboxguest vboxsf vboxvideo

Arnulfo answered 22/5, 2015 at 3:50 Comment(4)
The same issue happened on my vbox5.0.6 and Centos 7 guest. The issue is I'll need to run this every time after (re)boot.Donor
This works because these are the kernel modules you need running on a guest in order for VirtualBox to properly do all of its functions. Specifically, vboxsf (VirtualBox Shared Folders) is what's needed here. You can list these 3 files one per line in a file in /etc/modules-load.d/ (call it maybe virtualbox.conf) to make this change persist through reboots.Touched
On Debian 8 guest, running this command ruined video output.Accentor
´modprobe: WARNING: Module vboxsf not found in directory /lib/modules/5.3.11-100.fc29.x86_64´Ingather
D
26

In addition to @Mats answer, I'm adding some more info (it helped me on Debian 8).

My shared folder/clipboard stopped to work for some reason (probably due to a patch installation on my virtual machine).

sudo mount -t vboxsf Shared_Folder ~/SF/

Gave me following result:

VirtualBox: mount.vboxsf: mounting failed with the error: No such device

The solution for me was to stop vboxadd and do a setup after that:

cd /opt/VBoxGuestAdditions-*/init 
sudo ./vboxadd setup

At this point, if you still get the following error:

No such device. The Guest Additions installation may have failed. The error has been logged in /var/log/vboxadd-install.log

You need to install linux headers:

apt-get install linux-headers-$(uname -r)

then you can install Guest Additions:

sh /media/cdrom/VBoxLinuxAdditions.run --nox11

and restart your Linux by:

reboot

then you will be able to mount your shared folder!

mount -t vboxsf Shared_Folder ~/SF/

More informations (in French), check this page.

Dispraise answered 7/9, 2015 at 10:19 Comment(4)
apt-get install linux-headers-virtual helped with Lubuntu 15.04 on VirtualBoxPartitive
/media/cdrom ois empty in my caseGuendolen
Did you Clicked on Install Guest Additions from the Devices menu ?Dispraise
/sbin/mount.vboxsf: mounting failed with the error: No such deviceIngather
S
16

This was the only solution what worked for me:

Install Vagrant plugin: vagrant-vbguest, which can keep your VirtualBox Guest Additions up to date.

vagrant plugin install vagrant-vbguest

Source: https://github.com/aidanns/vagrant-reload/issues/4#issuecomment-230134083

Solubilize answered 9/10, 2016 at 23:57 Comment(1)
thanks, it helped me a lot (Y)Raymundorayna
G
10

This was resolved by:

yum install gcc kernel-devel make

workaround is here: https://gist.github.com/larsar/1687725

Glee answered 5/2, 2015 at 18:9 Comment(9)
Ran all updates no luck at all. Sorry, the answer with 13 up-votes did work betterDysphemism
I'm using a Windows 7 host with RHEL 7 and this resolved it for me (including the info from the gist link) - Thank you!Statfarad
On Ubuntu, this worked: sudo apt-get install build-essential linux-headers-uname -r dkmsBernal
Fedora: kernels-headers was not enough, but kernel-devel helped! @cstroe: uname -r should be in $( ) - see @Dispraise answer.Bane
@AndrewShatnyy "answer with 13 up-votes" is ambiguous. Please post the permalink to the answer you are referring to (click share under the answer)Ldopa
@Ldopa you right sorry. https://mcmap.net/q/134726/-virtualbox-mount-vboxsf-mounting-failed-with-the-error-no-such-device-closed worked two times alreadyDysphemism
Hmmm, I didn't need to install "make," but I found the other two independently. This worked for me.Pentyl
On Ubuntu, I had success with sudo apt-get -y install dkms build-essential linux-headers-3.13.0-36-generic (uname -a to get the right version number)Bianka
This solution no longer works if your headers don't match the OS. For example 3.10.0-862 is no longer available. You must update to *-957Orcinol
W
6

Shared folder was earlier working for me but all f sudden it stopped working (Virualbox - host was Windows 7, Guest was OpenSuSe)

modprobe -a vboxguest vboxsf vboxvideo

then mount -t vboxsf testsf /opt/tsf (testsf was the folder in Windows C drive which was added in Virtualbox shared folder --- and /opt/tsf is the folder in OpenSuse

Whiffet answered 4/11, 2015 at 17:45 Comment(0)
C
5

My host is Windows10 my VM guest is ubuntu build by vagrant. This worked for me:

vagrant plugin install vagrant-winnfsd
Concise answered 18/1, 2017 at 0:25 Comment(0)
M
4

The solution for me was to update guest additions

(click Devices -> Insert Guest Additions CD image)

Meda answered 18/6, 2018 at 7:2 Comment(0)
P
3

I also had a working system that suddenly stopped working with the described error.

After furtling around in my /lib/modules it would appear that the vboxvfs module is no more. Instead modprobe vboxsf was the required incantation to get things restarted.

Not sure when that change ocurred, but it caught me out.

Psia answered 27/7, 2015 at 14:34 Comment(2)
It worked for me after running ` sudo modprobe vboxsf`Moorish
modprobe: FATAL: Module vboxsf not found in directory /lib/modules/5.3.11-100.fc29.x86_64Ingather
E
3

I am running VirtualBox 5.1.20, and had a similar issue. Here is a url to where I found the fix, and the fix I implemented:

# https://dsin.wordpress.com/2016/08/17/ubuntu-wrong-fs-type-bad-option-bad-superblock/
if [ "5.1.20" == "${VBOXVER}" ]; then
  rm /sbin/mount.vboxsf
  ln -s /usr/lib/VBoxGuestAdditions/mount.vboxsf /sbin/mount.vboxsf
fi

The link had something similar to /usr/lib/VBoxGuestAdditions/other/mount.vboxsf, rather than what I have in the script excerpt.

For a build script I use in vagrant for the additions:

https://github.com/rburkholder/vagrant/blob/master/scripts/additions.sh

Seems to be a fix at https://www.virtualbox.org/ticket/16670

Eskridge answered 24/4, 2017 at 19:49 Comment(0)
D
3

For me, on a mac, it turned out I had an old VirtualBox image stored on my machine that didn't have metadata, so it wasn't being updated to the latest version.

That old image had an older version of the vbguest plugin installed in it, which the newer vbguest plugin on my machine couldn't work with.

So to fix it, I just removed the image that my Vagrant was based on, and then Vagrant downloaded the newer version and it worked fine.

# Remove an old version of the virtual box image that my vagrant was using    
$ vagrant box remove centos/7 

You can find out which boxes you have cached on your machine by running:

$ vagrant box list

I had also upgraded my vbguest plugin in my earlier attempts at getting this to work, using the following process, but I don't think this helped. FYI !

# Get rid of old plugins
vagrant plugin expunge 

# Globally install the latest version of the vbguest plugin`
vagrant plugin install vagrant-vbguest 

If you find bring the box fails on guest addtions, you can try doing the following to ensure the plugins install correctly. This downloads the latest based image for your system (for me CentOS), and may resolve the issue (it did for me!)

$ vagrant box update
Discretionary answered 18/7, 2018 at 17:41 Comment(0)
G
2

    There can be errors/incorrect approach in two scenarios. Check both of it and figure it out

SCENARIO 1 :

      Once you are running the VBoxLinuxAdditions.run or VBoxSolarisAdditions.pkg or VBoxWindowsAdditions.exe , check if all the modules are getting installed properly.

1.1.a. In case of VBoxLinuxAdditions, if
Building the VirtualBox Guest Additions kernel modules gets failed,
check the log file in /var/log/vboxadd-install.log . If the error is due to kernel version update your kernel and reboot the vm. In case of fedora,
1.1.b. yum update kernel*
1.1.c. reboot
1.2. If nothing gets failed, then all is fine. You are already having the expected kernel version

SCENARIO 2 :

     If the VBoxGuestAdditions is installed (check for a folder /opt/VBoxGuestAdditions-* is present .... * represents version) you need to start it before mounting.

2.1. cd /opt/VBoxGuestAdditions-*/init && ./vboxadd start

      You need to specify the user id and group id of your vm user as options to the mount command.

2.2.a. Getting uid and gid of a user:
      id -u <'user'>
      id -g <'user'>
2.2.b. Setting uid and gid in options of mount command:
      mount -t vboxsf -o uid=x,gid=x    shared_folder_name    guest_folder

Garald answered 16/3, 2016 at 7:53 Comment(0)
B
1

On Ubuntu this worked:

sudo apt-get install build-essential linux-headers-`uname -r` dkms
Bernal answered 13/1, 2016 at 19:57 Comment(0)
A
1

Had the same issue with VirtualBox 5.0.16/rXXX

Installed latest VirtualBox 5.0.18 and installed latest Vagrant 1.9.3, issue went toodles.

Anatolia answered 4/4, 2017 at 23:7 Comment(0)
S
1

I added as root user

/etc/rc.d/rc.local 
/root/mount-vboxsf.sh

then

chmod +x /etc/rc.d/rc.local

and the sample script /root/mount-vboxsf.sh (set your own the uid and gid options)

modprobe -a vboxguest vboxsf vboxvideo
mount -t vboxsf NAME_SHARED_DIRECTORY /media/sf_NAME_SHARED_DIRECTORY -o rw,uid=0,gid=0

you need add

chmod + /root/mount-vboxsf.sh
Spalding answered 20/4, 2017 at 10:57 Comment(0)
A
0

I have similar issue, check header if it's not match then run below command

CentOS: sudo yum update && sudo yum -y install kernel-headers kernel-devel

Arguello answered 13/6, 2017 at 10:42 Comment(0)
S
0

If you're on Debian:

1) remove all installed package through Virtualbox Guest Additions ISO file:

sh /media/cdrom/VBoxLinuxAdditions.run uninstall

2) install Virtualbox packages:

apt-get install build-essential module-assistant virtualbox-guest-dkms virtualbox-guest-utils

Note that even with modprobe vboxsf returning nothing (so the module is correctly loaded), the vboxsf.so will call an executable named mount.vboxsf, which is provided by virtualbox-guest-utils. Ignoring this one will prevent you from understanding the real cause of the error.

strace mount /your-directory was a great help (No such file or directory on /sbin/mount.vboxsf).

Sennar answered 30/4, 2018 at 21:27 Comment(0)
D
0

An update did the trick for me !

$ vagrant box update
$ vagrant plugin install vagrant-vbguest 
Diverticulosis answered 1/8, 2018 at 8:9 Comment(0)
H
-1

Below two commands works for me.

vagrant ssh
sudo mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant
Hymnal answered 6/8, 2018 at 10:15 Comment(0)
N
-9

Okay everyone is missing a basic fact.

mkdir /test - Makes sub directory in current directory.

sudo mkdir /test - Make directory in Root.

So if your shared directory name is shared and you do the following:

mkdir /test
sudo mount -t vboxsf shared /test

It generates this error:

sbin/mount.vboxsf: mounting failed with the error: No such file or directory

Because the directory is in the wrong place! Yes that's what this error is saying. The error is not saying reload the VBOX guest options.

But if you do this:

sudo mkdir ~/test
sudo mount -t vboxsf shared ~/test

Then it works fine.

It really amazes me how many people suggest reloading the Vbox guest additions to solve this error or writing a complex program to solve a directory created in the wrong place.

Norword answered 16/5, 2015 at 0:0 Comment(4)
The error being encountered is "No such device", not "No such file or directory". :)Jangro
mynttest@mynttest-VirtualBox:/media/sf_shared$ sudo mkdir ~/test sudo mount -t vboxsf vbshared ~/test mkdir: invalid option -- 't' Try `mkdir --help' for more information.Avraham
mkdir /test will create the directory /test in /. sudo mkdir /test will create the same directory, but owned by root rather than the current user.Sniperscope
I had same problem. So i installed kernel-devel.x86_64 0:2.6.32-754.11.1.el6 and then run these command-- cd /opt/VBoxGuestAdditions-*/init and sudo ./vboxadd setup. That worked for me.Lipoma

© 2022 - 2024 — McMap. All rights reserved.