Thursday, May 18, 2023

[Solved] How to fix VirtualBox - /sbin/mount.vboxsf: mounting failed with the error: Protocol error

Virtual box is a great tool for Java developer to run Docker and Linux on Windows Machine, especiall for them who need to develop and debug Java program in Linux environment. I use Oracle's virtual machine, VirtualBox to run the Linux operating system from my Windows machine. It's the most simple way to have two operating systems on your laptop or PC. Since I run most of the Java programs in Linux, VirtualBox gives me a nice interface to run UNIX commands right from the Windows box. This blog post is about the mounting of a shared folder failed error in Oracle's Virtualbox VM. It was working fine the day before yesterday and now, after I restarted my virtual box and tried to mount my shared folder, I was greeted by this error: "/sbin/mount.vboxsf: mounting failed with the error: Protocol error"


I was using the following command to mount my shared folder on VirtualBox:
$ mount -t vboxsf mountfolder /home/devInHost/mountfolder

I was running Oracle's VirtualBox 6.0 version with the guest operating system as RedHat Linux 8 and host OS like Windows 10.


Solving /sbin/mount.vboxsf: mounting failed with the error: Protocol error VirtualBox

There was nothing different I was trying, I had run this command successfully numerous times, but it was not working today.


I looked all over the internet for a solution and tried things like running this command after doing

$ cd / 

or
$ cd ~

but with no luck. After a bit of struggle, I found that my virtual box has no shared folder.

I went to Settings -> Shared Folders and there was nothing on it, even though I had specified shared folder in the previous run. I later realized that I had not made it permanent, that's why when I restarted my VirtualBox, there was no shared folder.

Once I specified the shared folder the command ran fine, even without restarting the virtual box.

mounting failed with the error: Protocol error VirtualBox

Summary

Here is the summary of what happened, what was the root cause of the error, and how I fixed it.

What I was trying to do: 
mounting shared folder on Linux guest OS inside Oracle VirtualBox.

Command:
$ mount -t vboxsf mountfolder /home/devInHost/mountfolder

Error:
"/sbin/mount.vboxsf: mounting failed with the error: Protocol error"

Cause:
There was no shared folder. I had before the last run but it wasn't permanent so when I restarted the Virtual box, it got reset.  You can check this by going to Settings -> Shared Folders

Solution:
Specify the new shared folder and re-run the command $ mount -t vboxsf mountfolder /home/devInHost/mountfolder again. It will work fine, no need to restart the Virtual box again.

Thanks, I hope this can save some time for you, when you get this error, don't forget to check your shared folder settings in the virtual box before looking into the internet for the solution.


Other Tech Debugging and Troubleshooting Guide You May Like
  • How to solve java.lang.UnsatisfiedLinkError: no ocijdbc11 in Java [solution]
  • java.net.SocketException: Failed to read from SocketChannel: Connection reset by peer [fix]
  • How to solve java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver in Java? [solution]
  • java.net.BindException: Cannot assign requested address: JVM_Bind [fix]
  • How to fix java.lang.ClassNotFoundException: org.postgresql.Driver error in Java? [solution]
  • Fixing Unsupported major.minor version 53.0 Error in Java [solution]
  • How to solve java.lang.classnotfoundexception sun.jdbc.odbc.jdbcodbcdriver [solution]
  • How to solve java.lang.ClassNotFoundException in Java [guide]
  • Exception in thread "main" java.lang.ExceptionInInitializerError in Java Program [fix]
  • java.net.SocketException: Too many files open java.io.IOException [solution]
  • 2 ways to solve Unsupported major.minor version 61.0 error in Java [solutions]
  • java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver [solution
  • java.io.IOException: Map failed and java.lang.OutOfMemoryError: Map failed  [fix]
  • java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory? [solution]
  • org.hibernate.MappingException: Unknown entity Exception in Java [solution]
  • java.lang.ClassNotFoundException:org.Springframework.Web.Context.ContextLoaderListener [solution]
  • Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 [solution]
  • How to solve java.lang.ClassNotFoundException: com.mysql.jdbc.Driver in Java MySQL? [solution]
Thanks for reading this  Virtual box debugging tutorial so far. If you find my solution useful, please share this article with your friends and colleagues. 

1 comment :

oktbabs said...

Thanks. It worked for me. I didnt know when the shared folder dropped off from the virtuabox.

Post a Comment