3

I believe I did everything what was described on how to access a folder on my host - Windows 10 - from my guest - ubuntu 20.04. However I get no results.

Guest additions are installed on my VM : enter image description here enter image description here enter image description here enter image description here

The settings for shared folder :

enter image description here

Installed the latest Guest Additions CD enter image description here

However, when I cd into my folder and list files there's nothing there. And I do keep a file there on my host, so it should be seen:

tomas@ubuntu20:~/share$ ls -l
total 0
tomas@ubuntu20:~/share$ df -t vboxsf
df : no file systems processed 
tomas@ubuntu20:~/share$ usermod -aG vboxsf tomas
usermod : group 'vboxsf' does not exist
tomas@ubuntu20:~/share$ chmod 755 .
tomas@ubuntu20:~/share$ ps -ef | grep -i vbox
root         385       2  0 10:19 ?        00:00:00 [iprt-VBoxWQueue]
tomas       1112    1098  0 10:24 pts/0    00:00:00 grep --color=auto -i vbox
tomas@ubuntu20:~/share$ service --status-all | grep -i virtual # no output
tomas@ubuntu20:~/share$ sudo mount -t vboxsf -o uid=1000,gid=1000 ubuntush /home/tomas/share
mount: /home/tomas/share: wrong fs type, bad option, bad superblock on ubuntush, missing codepage or helper program, or other error.

From Windows 10(host) Command Prompt:

C:\Users\as_to>VBoxManage sharedfolder add "ubuntu20" --name "ubuntush" --hostpath "C:\Users\as_to\Desktop\ubuntush"
VBoxManage.exe: error: Shared folder named 'ubuntush' already exists
VBoxManage.exe: error: Details: code VBOX_E_OBJECT_IN_USE (0x80bb000c), component SessionMachine, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "CreateSharedFolder(Bstr(pszName).raw(), Bstr(szAbsHostPath).raw(), fWritable, fAutoMount, Bstr(pszAutoMountPoint).raw())" at line 1194 of file VBoxManageMisc.cpp

Does anybody know what is missing ?

7
  • What is the output of df -t vboxsf command output on the guest? You can try to install the latest Guest Additions CD to the guest. Link: download.virtualbox.org/virtualbox/6.1.22/…
    – FedKad
    Jun 21, 2021 at 9:34
  • df : no file systems processed
    – Tomas.R
    Jun 21, 2021 at 9:38
  • What are the outputs of ps -ef | grep -i vbox and service --status-all | grep -i virtual on the guest?
    – FedKad
    Jun 21, 2021 at 10:20
  • for ps : root 385 2 0 10:19 ? 00:00:00 [iprt-VBoxWQueue] tomas 1112 1098 0 10:24 pts/0 00:00:00 grep --color=auto -i vbox for service, no output at all. UPDATED the question to see this clearer
    – Tomas.R
    Jun 21, 2021 at 10:28
  • 1
    Will do, thank you
    – Tomas.R
    Jun 21, 2021 at 10:36

3 Answers 3

4

With a help of great @FedonKadifeli I was able to solve the issue.

First and foremost - the guest OS is Ubuntu 20.04 LTS Server.

From a running guest OS window install Guest Additions. Go to : Devices - > Insert Guest Additions CD Image

Then to the guest OS command line :

sudo apt update
sudo apt upgrade

sudo mount /dev/sr0 /cdrom
mount: /cdrom: WARNING: device write-protected, mounted read-only. # This is OK

cd /cdrom 
sudo bash ./VBoxLinuxAdditions.run

The output of the last command should be something like that : enter image description here

However, the last 3 lines of the output I got was saying this :

"This system is currently not set up to build kernel modules.
Please install the gcc make perl packages from your distribution.
VirtualBox Guest Additions: Running kernel modules will not be replaced until
the system is restarted"

So, first I had to install additional packages. And anything extra that may be needed:

sudo apt install gcc 
sudo apt install make
sudo apt install perl

Restart the guest :

reboot

Then from a Guest OS window go to :

Devices - Shared Folders - Shared Folders Settings - Add new Shared Folder :

Folder Path : C:\Users\as_to\Desktop\foo
Folder Name : foo

Mount point : /home/tomas/bar - This will create a directory after you close this window

Auto-mount (check)

Make Permanent (check)

Press OK to close the window.

Next, if you try to cd into bar you will get permission denied :

cd bar/
-bash: cd: bar/: Permission denied

Add user to the group "vboxsf" and logout/login again for the changes to be applied:

sudo usermod -aG vboxsf tomas
logout

And that's it. All should work now. Thank you again @FedonKadifeli, awesome guy.

2
  • On the macos this works too. But sometimes shared folder may breaks. Just try to recreate shared folder.
    – spiilmusic
    Oct 21, 2021 at 12:06
  • Similar steps worked for me in host Ubuntu 18.04 and guest Ubuntu 21.04 but had to reboot after usermod since after logout still had permissioned denied to shared folder.
    – Daniel
    Nov 26, 2021 at 21:22
0

Thanks for your post. I have the same versions as you: ubuntu 20.04, windows 10 (Host), virtualbox v6.1, but after all the above steps I still have an empty shared directory in ubuntu.

Looking at the mount after reboot I have this entry which doesn't look right:

$mount | grep shared
 /home/damo/shared on /home/damo/shared type vboxsf (rw,....)

Seems to be trying to mount the folder to itself instead of from windows...? The VM Shared folder settings are

Folder path: C:\Users\damo\VirtualBox VMs\shared
Mount point: /home/damo/shared

With auto mount and make permanent checked. Do I need to do something on the host side to enable sharing of a folder?

0

The instructions that worked for me came from: Unable to mount the CD/DVD image on the machine Sandbox and How to Install & Use VirtualBox Guest Additions on Ubuntu:

Install some packages in order to be able to build the kernel:

sudo apt install build-essential dkms linux-headers-generic

Install the VirtualBoxGuestAdditions from Ubuntu repository:

sudo apt install virtualbox-guest-additions-iso
sudo mkdir /media/GuestAdditionsISO
sudo mount -o loop /usr/share/virtualbox/VBoxGuestAdditions.iso /media/GuestAdditionsISO

Install the Guest Additions:

cd /media/GuestAdditionsISO
sudo ./VBoxLinuxAdditions.run

Reboot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.