VirtualBox shared folder not automounting

First time using Manjaro but I have been using VirtualBox for many years.

Host is Ubuntu 20.04. Manjaro is Mate 20.0.1

I get to this point on the wiki

  sudo VBoxControl sharedfolders list --automount

It looks like this should mount the shared folder I have configured through the VBox management GUI. However this does not happen.

I can manually force the mount

 sudo mount -t vboxsf host /mnt/host

And this will mount the shared folder for listing but it is owned by root. In my other experience this would be group owned by vboxsf and would be group writeable.

I don’t see that other people are having this problem, so clearly I’ve done something wrong. Where would it be?

*Update After response by @linux-aarhus *

Yes sections 8 & 9. Here is more detail.

In the sharefolders setting of the management dialog I had requested the mount point as /mnt/host and had created that directory in the guest before running the guest additions.

After reboot with guest additions installed, the systemctl status vboxservice shows this error.

 automount Error: vbsvcAutomounterMountIt: Failed to mount 'host' on '/mnt/host' because it is probably mounted elsewhere 

I removed the request to mount at /mnt/host and left that field blank.

After reboot, the /media/sf_host directory had been created as

drwxr-xr-x  2 root root 4096 Aug 28 00:16 sf_host/

and that directory is empty.

and the vboxservice status reports now

 automount Error: vbsvcAutomounterMountIt: Failed to mount 'host' on '/media/sf_host' because it is probably mounted elsewhere 

For my first installation of guest additions I had used the guestadditions.iso inserted by the VBox system. So after the wiki entry I instead installed from the pac repo.

pamac build virtualbox-ext-oracle
Preparing…
Cloning virtualbox-ext-oracle build files…
Checking virtualbox-ext-oracle dependencies…
Choose a provider for VIRTUALBOX-HOST-MODULES:
1: linux414-virtualbox-host-modules 6.1.12-6 extra
2: linux419-virtualbox-host-modules 6.1.12-7 extra
3: linux44-virtualbox-host-modules 6.1.12-3 extra
4: linux49-virtualbox-host-modules 6.1.12-3 extra
5: linux54-virtualbox-host-modules 6.1.12-7 extra
6: linux57-virtualbox-host-modules 6.1.12-7 extra
7: linux58-virtualbox-host-modules 6.1.12-5 extra
8: linux54-rt-virtualbox-host-modules 6.1.12-3 community
9: linux56-rt-virtualbox-host-modules 6.1.12-1 community
10: virtualbox-host-dkms 6.1.12-3 community

I chose 6 (because uname -r shows 5.7.15-1-MANJARO)

This built without error and I then applied

 # modprobe vboxdrv 
 

  $ sudo VBoxControl sharedfolders list --automount
  bash: $: command not found

Typo in wiki so…

  # VBoxControl sharedfolder list --automount
    ...
   Auto-mounted Shared Folder mappings (1):
   01 - host [idRoot=0 writable auto-mount host-icase]

I still see the same error in the vboxservice status. The executable in the service is given as

  Executable: /opt/VBoxGuestAdditions-6.1.6/sbin/VBoxService
  
Perhaps that should be something else?

Is it this wiki you are referring?

Section 8 and 9 and if I recall correct - you need to create the /media folder by hand

Thank you for your response. I have added detail to my post to address your question.

fixed the typo - thank you for spotting it.

I have no problems running the automount command.

The command requires that you have set (ticked) the Automount option when defining the share on the host - otherwise it won’t work.

First without the tick in Automount

~ >>> sudo VBoxControl sharedfolder list --automount
Oracle VM VirtualBox Guest Additions Command Line Management Interface Version 6.1.12
(C) 2008-2020 Oracle Corporation
All rights reserved.

Auto-mounted Shared Folder mappings (0):

No Shared Folders available.

Then after ticking the Automount option

~ >>> sudo VBoxControl sharedfolder list --automount
Oracle VM VirtualBox Guest Additions Command Line Management Interface Version 6.1.12
(C) 2008-2020 Oracle Corporation
All rights reserved.

Auto-mounted Shared Folder mappings (1):

01 - fh [idRoot=0 writable auto-mount host-icase guest-icase]
~ >>> ls /media
sf_fh
~ >>> ls /media/sf_fh
 bin	     Downloads				  Pictures	     Videos
 Data	     Manjaro-PacBang-getting-started.md   printer-pkgs.txt  'VirtualBox VMs'
 Desktop     Music				  Public
 Documents   node_modules

Another point is - ensure your Manjaro guest is up-to-date and the linuxXX-virtualbox-guest-modules matching your current running kernel is installed.

Thank you. Yes the ‘automount’ option is ticked and the service seems to recognize that. See the automount error in the service status.

The 'automount failed' 

I’m not familiar with pacman but I believe this should update the system.

 # pacman -Su
 :: Starting full system upgrade...
there is nothing to do

Kernel is

 # uname -r
 5.7.15-1-MANJARO

Guest additions on disk are these.

  find / -xdev -name "*linux*-virtualbox-guest*" 
  /var/cache/pacman/pkg/linux57-virtualbox-guest-modules-6.1.12-7-x86_64.pkg.tar.xz
  /var/cache/pacman/pkg/linux-latest-virtualbox-guest-modules-5.7-2-any.pkg.tar.zst
  /var/cache/pacman/pkg/linux56-virtualbox-guest-modules-6.1.6-11-x86_64.pkg.tar.zst
  /var/lib/pacman/local/linux-latest-virtualbox-guest-modules-5.7-2
  /var/lib/pacman/local/linux57-virtualbox-guest-modules-6.1.12-7

The service status report shows the guest additions running is :

  Executable: /opt/VBoxGuestAdditions-6.1.6/sbin/VBoxService

A search of the disk finds that this is the only VBoxService installed.

  find / -xdev -name "*VBoxService*" | xargs ls -l 
  -rwxr-xr-x 1 root root 1664000 Apr  9 10:52 /opt/VBoxGuestAdditions-6.1.6/sbin/VBoxService
  lrwxrwxrwx 1 root root      46 Aug 26 07:56 /usr/bin/VBoxService -> /opt/VBoxGuestAdditions-6.1.6/sbin/VBoxService

However pacman sees other editions of additions, I think.

   # pacman -Q | grep -i virtual.*box
   linux-latest-virtualbox-guest-modules 5.7-2
   linux57-virtualbox-guest-modules 6.1.12-7
   linux57-virtualbox-host-modules 6.1.12-7
   virtualbox 6.1.12-3
   virtualbox-ext-oracle 6.1.13.140091-1
   virtualbox-guest-utils 6.1.12-3

And the manual automount attempt

 sudo VBoxControl sharedfolder list --automount
 [sudo] password for stephen: 
 Oracle VM VirtualBox Guest Additions Command Line Management Interface Version 6.1.6
 (C) 2008-2020 Oracle Corporation
 All rights reserved.
 
 Auto-mounted Shared Folder mappings (1):
 
 01 - host [idRoot=0 writable auto-mount host-icase]

The service status reports

automount Error: vbsvcAutomounterMountIt: Failed to mount 'host' on '/media/sf_host' because it is probably mounted elsewhere 

This is probably a ‘best guess’ by the service code because a find of the entire disk fails to find a particular file on the host

 *On the host*

  ls -l 20200828.20200828-073022
 -rw-rw-r-- 1 stephen stephen 0 2020-08-28 07:30 20200828.20200828-073022

On the guest:

#  find / -name "*20200828.20200828-073022*" > find.out
# ls -l find.out
   -rw-r--r-- 1 root root 0 2020-08-28 07:38 find.out