"shared folder" does not work

Discussions about using Linux guests in VirtualBox.
Plagrö
Posts: 140
Joined: 27. May 2018, 14:57

"shared folder" does not work

Post by Plagrö »

VirtualBox 6.1:

My host is MX-Linux 19.4. (Xfce)
My guest is also MX-Linux 19.4 (Xfce)
k20240106-151010.png
k20240106-151010.png (17.17 KiB) Viewed 4298 times

I had never problems to create shared folders in a windows guest, but I never bring it to work in a Linux guest.
I have already tried to create a working "shared folder" it simply does not work in my Linux guest. I can not find the shared folder. Not in "/media" and also not in "/mnt" and not in "/home/Plagroe" and also not under "devices" or "places" or "network" in thunar.

Question 1:
How should I install VBoxGuestAdditions in my Linux guest? What is right?:
A) You must install VBoxGuestAdditions in each of your guest accounts. So for example if you want to use them in "root" account, you have to install then in "root" account. If you will use them in your /home/Plagrö account, then you have to install them also in /home/Plagrö account
B) It does not matter in which account you are, when you install them. If you install them in your home/Plagrö account they will also work, if you logg you in into another account

Question 2:
What file do I have to install? What is right?:
A) VBoxLinuxAdditions.run
B) autorun.sh

Question 3:
How should I start the file from question 2 when I am logged in with the account "/home/Plagrö"? What is right?:
A) You can start the file "without sudo"
B) You should start the file with "sudo"
C) Don't start the file with "sudo" if you do that, it would make available the VBoxGuestAdditions for the user "root" instead of for the user "Plagrö"

Would appreciate some answers. Thank you.
Last edited by Plagrö on 7. Jan 2024, 13:18, edited 1 time in total.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: "shared folder" does not work

Post by scottgus1 »

Guest Additions can be installed for all users from any user account that has sudo access.

You probably need to be in a sudo prompt to run the VBoxLinuxAdditions.run.

There are prerequisites for GAs, though, same as for Virtualbox on the Linux host. See the manual's install instructions for a Linux host for the prerequisites for the GAs. Then run the .run file under sudo on any account you want.
Plagrö
Posts: 140
Joined: 27. May 2018, 14:57

Re: "shared folder" does not work

Post by Plagrö »

Thank you.
OK it works.

But only if you do after each start of the VM this:

Code: Select all

Plagroe@mx:/media/Plagroe/VBox_GAs_6.1.30
$ sudo ./VBoxLinuxAdditions.run
[sudo] Passwort für Plagroe: 
Verifying archive integrity... All good.
Uncompressing VirtualBox 6.1.30 Guest Additions for Linux........
VirtualBox Guest Additions installer
Removing installed version 6.1.30 of VirtualBox Guest Additions...
You may need to restart your guest system to finish removing guest drivers.
update-initramfs: Generating /boot/initrd.img-4.19.0-25-amd64
I: The initramfs will attempt to resume from /dev/sda2
I: (UUID=e33a7ed9-3b40-4025-9d56-b092d15887d2)
I: Set the RESUME variable to override this.
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel 
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel 4.19.0-25-amd64.
update-initramfs: Generating /boot/initrd.img-4.19.0-25-amd64
cryptsetup: ERROR: Couldn't resolve device 
    /dev/disk/by-uuid/79c17d9a-6a1d-49af-9636-50003879deac
cryptsetup: WARNING: The initramfs image may not contain cryptsetup binaries 
    nor crypto modules. If that's on purpose, you may want to uninstall the 
    'cryptsetup-initramfs' package in order to disable the cryptsetup initramfs 
    integration and avoid this warning.
I: The initramfs will attempt to resume from /dev/sda2
I: (UUID=e33a7ed9-3b40-4025-9d56-b092d15887d2)
I: Set the RESUME variable to override this.
VirtualBox Guest Additions: Running kernel modules will not be replaced until 
the system is restarted
Building the VirtualBox Guest Additions kernel modules.  This may take a while.
To build modules for other installed kernels, run
  /sbin/rcvboxadd quicksetup <version>
or
  /sbin/rcvboxadd quicksetup all
Running kernel modules will not be replaced until the system is restarted
vboxadd-service.sh: Starting VirtualBox Guest Addition service.
Plagroe@mx:/media/Plagroe/VBox_GAs_6.1.30
$ 
When I do not make this after the start of my VM, then this happens, when I click on the SFolder:
Error opening directory '/home/Plagroe/SFolder’: No authorisation.
k20240107-122403.png
k20240107-122403.png (11.72 KiB) Viewed 4224 times
What can I do?
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: "shared folder" does not work

Post by scottgus1 »

Did you run the prerequisites first, especially the headers?
Plagrö
Posts: 140
Joined: 27. May 2018, 14:57

Re: "shared folder" does not work

Post by Plagrö »

Thank you.

Do you mean this?:
k20240107-213821.jpg
k20240107-213821.jpg (95.05 KiB) Viewed 4157 times
Or this?:
k20240107-213920.jpg
k20240107-213920.jpg (82.11 KiB) Viewed 4157 times
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: "shared folder" does not work

Post by scottgus1 »

First picture, though the picture doesn't show all the prerequisites. https://www.virtualbox.org/manual/ch02. ... nux-prereq The headers are the usual missing item.
Plagrö
Posts: 140
Joined: 27. May 2018, 14:57

Re: "shared folder" does not work

Post by Plagrö »

OK. Thank you.

Yes the headers were installed:

Kernel:

Code: Select all

Plagrö@mx:~
$ uname -r
4.19.0-25-amd64
Plagrö@mx:~
$ 
Installed is the following package:

Code: Select all

linux-headers-amd64: Version: 4.19+105+deb10u20
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: "shared folder" does not work

Post by scottgus1 »

Good. The best I can offer now is to wait for a Linux guru that can interpret this further.
fth0
Volunteer
Posts: 5678
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: "shared folder" does not work

Post by fth0 »

FWIW, the build scripts for the VirtualBox kernel modules (in VirtualBox on the host and in the VirtualBox Guest Additions in the guest) have been modified several times within the VirtualBox 6.1.x release updates. In consequence, I wouldn't look at any version older than 6.1.48.
Byroniac
Posts: 28
Joined: 1. Sep 2014, 09:08

Re: "shared folder" does not work

Post by Byroniac »

Disclaimer: I am not a Linux guru but I may be able to help...

My host system is Windows 11 and my guest VM currently is Kali Linux. What I generally have to do on all my Linux guests is that I have to add myself to the vboxsf security group in order to use the shared folder with my user account (byron, in my case) and not just root. So for example I can mount C:\ as C_DRIVE and specify /mnt/c as my desired mount location and in Linux it will show up for me similar to this:

mount | grep -i c_drive

outputs:
C_DRIVE on /mnt/c type vboxsf (rw,nodev,relatime)

Like this, e.g:

usermod -a -G vboxsf byron

Case-sensitive! Lowercase a (append), uppercase g (groups). You can check this with, e.g. "sudo groups byron" to see if group was added. Then reboot the VM. FYI: Some Linux distros allow you to do something like "adduser byron vboxsf" instead of using usermod, but I am trying to train myself to always use usermod as it has always been available on every Linux I have tried so far.

Hope this helps.
Last edited by Byroniac on 11. Jan 2024, 06:45, edited 1 time in total.
Byroniac
Posts: 28
Joined: 1. Sep 2014, 09:08

Re: "shared folder" does not work

Post by Byroniac »

WARNING: usermod without the -a will erase all other group memberships. Probably a good idea to do, e.g. "sudo groups byron" beforehand to see what groups you have so you can add them back if need be (you can easily guess how I discovered this unfortunate scenario).
Plagrö
Posts: 140
Joined: 27. May 2018, 14:57

Re: "shared folder" does not work

Post by Plagrö »

Thank you for your comments.

I was already automatically part of the vboxsf group in my VM. It was not necessary to add me manually.

Behaviour as described above. It must be something else that is not working.
Byroniac
Posts: 28
Joined: 1. Sep 2014, 09:08

Re: "shared folder" does not work

Post by Byroniac »

Perhaps you should try mounting it under /media or /mnt instead of under your home directory, or leave it blank and let it choose a location (I do not usually do it this way, though).
Plagrö
Posts: 140
Joined: 27. May 2018, 14:57

Re: "shared folder" does not work

Post by Plagrö »

Unfortunately leaving the field blank does also not help. Same issue.
Also not when I write into the field /media or /mnt

It feels like any service has not started. (?)
Or if it does not mount.
Byroniac
Posts: 28
Joined: 1. Sep 2014, 09:08

Re: "shared folder" does not work

Post by Byroniac »

If your system supports systemd, have you tried "sudo systemctl enable --now virtualbox-guest-utils.service" ? You can do "systemctl status virtualbox-guest-utils.service" to get status, or "sudo systemctl restart virtualbox-guest-utils.service". You can also do "sudo systemctl --failed" to see any failed services.

By the way, I would recommend not simply saying /mnt or /media but add some directory to it, as in my example I used /mnt/c.
Post Reply