Unable to use a shared folder in VBox Ubuntu guest that was upgraded from 20.10 to 21.04

The host machine is Ubuntu 20.10 Desktop with VirtualBox version 6.1.16. The guest machine was also Ubuntu 20.10 Desktop with the latest (6.1.16) VB Guest Additions. I was able to use shared folders (shared from Host to Guest) from the "normal" Ubuntu user in the guest machine, since this user was also in the group vboxsf and the shared folder was mounted in the guest machine with permissions drwxrwx--- root vboxsf.

Now, after I upgraded (using do-release-upgrade) the guest machine to 21.04, I am no longer able to access the shared folder from the normal user in the guest machine, because the shared folder is mounted with permissions drwxr-x--- root root in the guest.

I tried to re-install GAs, with no change.

Nothing has changed on the host machine and a "clone" of the same old (20.10) guest works as expected (shared folders are mounted with permissions drwxrwx--- root vboxsf as normal).

Note: As a side note, I need to mention that clipboard sharing also stopped working for the guest that was upgraded to 21.04.


Solution 1:

There was an error in the file /var/log/vboxadd-setup.log.1, something like this:

[...]
In file included from /tmp/vbox.0/combined-os-specific.c:33:
/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c: In function ‘rtR0MemObjLinuxVMap’:
/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c:560:34: error: implicit declaration of function ‘alloc_vm_area’ [-Werror=implicit-function-declaration]
  560 |                 pMemLnx->pArea = alloc_vm_area(pMemLnx->Core.cb, papPtes); /* Note! pArea->nr_pages is not set. */
      |                                  ^~~~~~~~~~~~~
/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c:560:32: warning: assignment to ‘struct vm_struct *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  560 |                 pMemLnx->pArea = alloc_vm_area(pMemLnx->Core.cb, papPtes); /* Note! pArea->nr_pages is not set. */
      |                                ^
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:287: /tmp/vbox.0/combined-os-specific.o] Error 1
make[1]: *** [Makefile:1837: /tmp/vbox.0] Error 2
make: *** [/tmp/vbox.0/Makefile-footer.gmk:117: vboxguest] Error 2

Some further investigation showed that the "subroutine (alloc_vm_area) was removed from linux 5.10."

So, I downloaded the latest VBoxGuestAdditions_6.1.22.iso from https://download.virtualbox.org/virtualbox/6.1.22/ and reinstalled it on the guest. Although my VirtualBox Manager on the host machine is at version 6.1.16, the problem in the guest is solved now.