I have performed an in-place upgrade of a working lubuntu 16.04 virtualbox guest with shared folders (using VBoxGuestAdditions-5.2.18), upgrading to 18.04.
Things went smoothly until I discovered the shared folders weren't working any more. From what I can see in syslog, they get mounted:
Aug 16 17:16:16 xxxxx vboxadd-service.sh: VirtualBox Guest Addition service started. Aug 16 17:16:16 xxxxx systemd: Started vboxadd-service.service. Aug 16 17:16:16 xxxxx kernel: [ 180.942058] 00:00:00.011477 automount vbsvcAutoMountWorker: Shared folder 'usb1' was mounted to '/media/sf_usb1' Aug 16 17:16:16 xxxxx kernel: [ 180.944112] 00:00:00.013562 automount vbsvcAutoMountWorker: Shared folder 'usb2' was mounted to '/media/sf_usb2'
and I see no failures or errors after that. However, when I access the folders in the guest, they are not the actual shared folders. They are empty and while I can write to them, it appears to save to the local guest drive, not in the shared folder.
When I check the status of the service, it returns:
vboxadd-service.service Loaded: loaded (/opt/VBoxGuestAdditions-5.2.18/init/vboxadd-service; enabled; Active: inactive (dead)
I found this link: Virtual Box Shared Folder Drives Don't Automount in 16.04 to 18.04 upgraded Ubuntu MATE which looks like the same issue, and when I do run:
sudo systemctl restart vboxadd-service.service
as described at the link, the real shared folders do mount successfully, I am able to read and write to them as well.
I have reinstalled the guest additions many times, but I don't think that is the issue (nor permissions) since restarting the service does mount them correctly.
My question is: How do I fix this, or at least have an automated work around? Until there is a "proper" fix, I would like to have the service restarted automatically. I have tried editing the /etc/systemd/system/multi-user.target.wants/vboxadd-service.service file, changing RESTART=no to "on-failure" and "always" but that didn't help. Is there somewhere I can call the restart command to run with elevated privileges in a startup script somewhere after its first attempt which doesn't stick or something more elegant?
EDIT: The version of Virtualbox on the Ubuntu host server matches the Guest Additions version (Host: 5.2.18r124319; Guest: VBoxGuestAdditions-5.2.18)
There are no errors during the GA installation:
Verifying archive integrity... All good. Uncompressing VirtualBox 5.2.18 Guest Additions for Linux........ VirtualBox Guest Additions installer Removing installed version 5.2.18 of VirtualBox Guest Additions... Copying additional installer modules ... Installing additional modules ... VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules. This may take a while. VirtualBox Guest Additions: Running kernel modules will not be replaced until the system is restarted VirtualBox Guest Additions: Starting.