Vagrant up stuck on retrying on second up (synced_folder error)

Windows 10 Pro 20H2
Vagrant 2.2.14
VirtualBox 6.1.18

I’ve got this simple vagrant file with ubuntu/trusty64 as guest OS. The first time brining this up goes fine, but the second time hangs on “Retrying…”. When I look inside the VB GUI I see:

vboxsd: SHFL_FN_MAP_FOLDER failed for 'opt/test': share not found
vboxsd: SHFL_FN_MAP_FOLDER failed for '/vagrant': share not found

An error occurred while mounting /opt/test.
keys:Press S to skip mounting or M for manual recovery

Now if, and only if, I press ‘S’ inside the VB GUI the vagrant up completes fine. Is this a known bug? Tried reinstalling the vagrant-vbguest plugin and the vagrant plugin expunge --reinstall command, but that doesn’t change anything.

The complete vagrantfile I’m using (./test only contains an empty txt file):

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/trusty64"
  config.vm.synced_folder "./test", "/opt/test"
end

The command history:

$ vagrant plugin list
vagrant-vbguest (0.29.0, global)

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' version '20190514.0.0' is up to date...
==> default: Setting the name of the VM: why_default_1617177654328_7255
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
[default] A Virtualbox Guest Additions installation was found but no tools to rebuild or start them.
 * Stopping VirtualBox Additions
   ...done.
Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
  acl at-spi2-core colord dconf-gsettings-backend dconf-service dkms fakeroot
  fontconfig fontconfig-config fonts-dejavu-core gcc gcc-4.8
  hicolor-icon-theme libasan0 libasound2 libasound2-data libatk-bridge2.0-0
  libatk1.0-0 libatk1.0-data libatomic1 libatspi2.0-0 libavahi-client3
  libavahi-common-data libavahi-common3 libc-dev-bin libc6-dev
  libcairo-gobject2 libcairo2 libcanberra-gtk3-0 libcanberra-gtk3-module
  libcanberra0 libcolord1 libcolorhug1 libcups2 libdatrie1 libdconf1
  libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libexif12 libfakeroot
  libfontconfig1 libfontenc1 libgcc-4.8-dev libgd3 libgdk-pixbuf2.0-0
  libgdk-pixbuf2.0-common libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa
  libgomp1 libgphoto2-6 libgphoto2-l10n libgphoto2-port10 libgraphite2-3
  libgtk-3-0 libgtk-3-bin libgtk-3-common libgudev-1.0-0 libgusb2
  libharfbuzz0b libice6 libieee1284-3 libitm1 libjasper1 libjbig0
  libjpeg-turbo8 libjpeg8 liblcms2-2 libllvm3.4 libltdl7 libnotify-bin
  libnotify4 libogg0 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0
  libpciaccess0 libpixman-1-0 libquadmath0 libsane libsane-common libsm6
  libtdb1 libthai-data libthai0 libtiff5 libtsan0 libtxc-dxtn-s2tc0 libv4l-0
  libv4lconvert0 libvorbis0a libvorbisfile3 libvpx1 libwayland-client0
  libwayland-cursor0 libx11-xcb1 libxaw7 libxcb-dri2-0 libxcb-dri3-0
  libxcb-glx0 libxcb-present0 libxcb-render0 libxcb-shm0 libxcb-sync1
  libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxfont1 libxi6
  libxinerama1 libxkbcommon0 libxkbfile1 libxmu6 libxpm4 libxrandr2
  libxrender1 libxshmfence1 libxt6 libxtst6 libxxf86vm1 linux-libc-dev
  manpages-dev notification-daemon sound-theme-freedesktop x11-common
  x11-xkb-utils xfonts-base xfonts-encodings xfonts-utils xserver-common
  xserver-xorg-core
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  virtualbox-guest-dkms* virtualbox-guest-utils* virtualbox-guest-x11*
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
After this operation, 12.2 MB disk space will be freed.
(Reading database ... 63238 files and directories currently installed.)
Removing virtualbox-guest-dkms (4.3.40-dfsg-0ubuntu14.04.1) ...

-------- Uninstall Beginning --------
Module:  virtualbox-guest
Version: 4.3.40
Kernel:  3.13.0-170-generic (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

vboxguest.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.13.0-170-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.


vboxsf.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.13.0-170-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.


vboxvideo.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.13.0-170-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod....

DKMS: uninstall completed.

------------------------------
Deleting module version: 4.3.40
completely from the DKMS tree.
------------------------------
Done.
Removing virtualbox-guest-x11 (4.3.40-dfsg-0ubuntu14.04.1) ...
Purging configuration files for virtualbox-guest-x11 (4.3.40-dfsg-0ubuntu14.04.1) ...
Removing virtualbox-guest-utils (4.3.40-dfsg-0ubuntu14.04.1) ...
Purging configuration files for virtualbox-guest-utils (4.3.40-dfsg-0ubuntu14.04.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.15) ...
Reading package lists...
Building dependency tree...
Reading state information...
dkms is already the newest version.
dkms set to manually installed.
linux-headers-3.13.0-170-generic is already the newest version.
linux-headers-3.13.0-170-generic set to manually installed.
The following packages were automatically installed and are no longer required:
  acl at-spi2-core colord dconf-gsettings-backend dconf-service fontconfig
  fontconfig-config fonts-dejavu-core hicolor-icon-theme libasound2
  libasound2-data libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatspi2.0-0
  libavahi-client3 libavahi-common-data libavahi-common3 libcairo-gobject2
  libcairo2 libcanberra-gtk3-0 libcanberra-gtk3-module libcanberra0 libcolord1
  libcolorhug1 libcups2 libdatrie1 libdconf1 libdrm-intel1 libdrm-nouveau2
  libdrm-radeon1 libexif12 libfontconfig1 libfontenc1 libgd3
  libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgl1-mesa-dri libgl1-mesa-glx
  libglapi-mesa libgphoto2-6 libgphoto2-l10n libgphoto2-port10 libgraphite2-3
  libgtk-3-0 libgtk-3-bin libgtk-3-common libgudev-1.0-0 libgusb2
  libharfbuzz0b libice6 libieee1284-3 libjasper1 libjbig0 libjpeg-turbo8
  libjpeg8 liblcms2-2 libllvm3.4 libltdl7 libnotify-bin libnotify4 libogg0
  libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpciaccess0
  libpixman-1-0 libsane libsane-common libsm6 libtdb1 libthai-data libthai0
  libtiff5 libtxc-dxtn-s2tc0 libv4l-0 libv4lconvert0 libvorbis0a
  libvorbisfile3 libvpx1 libwayland-client0 libwayland-cursor0 libx11-xcb1
  libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0
  libxcb-render0 libxcb-shm0 libxcb-sync1 libxcomposite1 libxcursor1
  libxdamage1 libxfixes3 libxfont1 libxi6 libxinerama1 libxkbcommon0
  libxkbfile1 libxmu6 libxpm4 libxrandr2 libxrender1 libxshmfence1 libxt6
  libxtst6 libxxf86vm1 notification-daemon sound-theme-freedesktop x11-common
  x11-xkb-utils xfonts-base xfonts-encodings xfonts-utils xserver-common
  xserver-xorg-core
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Copy iso file C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
Mounting Virtualbox Guest Additions ISO to: /mnt
mount: block device /tmp/VBoxGuestAdditions.iso is write-protected, mounting read-only
Installing Virtualbox Guest Additions 6.1.18 - guest version is 4.3.40
Verifying archive integrity... All good.
Uncompressing VirtualBox 6.1.18 Guest Additions for Linux........
VirtualBox Guest Additions installer
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 3.13.0-170-generic.
 Adding system startup for /etc/init.d/vboxadd ...
   /etc/rc0.d/K90vboxadd -> ../init.d/vboxadd
   /etc/rc1.d/K90vboxadd -> ../init.d/vboxadd
   /etc/rc6.d/K90vboxadd -> ../init.d/vboxadd
   /etc/rc2.d/S10vboxadd -> ../init.d/vboxadd
   /etc/rc3.d/S10vboxadd -> ../init.d/vboxadd
   /etc/rc4.d/S10vboxadd -> ../init.d/vboxadd
   /etc/rc5.d/S10vboxadd -> ../init.d/vboxadd
 Adding system startup for /etc/init.d/vboxadd-service ...
   /etc/rc0.d/K65vboxadd-service -> ../init.d/vboxadd-service
   /etc/rc1.d/K65vboxadd-service -> ../init.d/vboxadd-service
   /etc/rc6.d/K65vboxadd-service -> ../init.d/vboxadd-service
   /etc/rc2.d/S35vboxadd-service -> ../init.d/vboxadd-service
   /etc/rc3.d/S35vboxadd-service -> ../init.d/vboxadd-service
   /etc/rc4.d/S35vboxadd-service -> ../init.d/vboxadd-service
   /etc/rc5.d/S35vboxadd-service -> ../init.d/vboxadd-service
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.
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: Running kernel modules will not be replaced until
the system is restarted
Unmounting Virtualbox Guest Additions ISO from: /mnt
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
    default: /vagrant => C:/why
    default: /opt/test => C:/why/test
	
$ vagrant halt
==> default: Attempting graceful shutdown of VM...

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' version '20190514.0.0' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...

This is directly after I pressed S in the VB GUI:

==> default: Machine booted and ready!
[default] GuestAdditions 6.1.18 running --- OK.
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
    default: /vagrant => C:/why
    default: /opt/test => C:/why/test
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.

make sure u using insecure_private_key when create box , download public key from here https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub
and copy to /home/$USER/.ssh/authorized_keys

Thanks for your reply, but I’m sorry, I don’t completely understand what you’re suggesting. I’m not creating a box, I’m using the existing ubuntu/trusty64 box. Vagrant detects the insecure key and replaces it fine (see logs). And I also don’t see how this solves the mounting issue of shared folders. SSH works fine when I manually skip the mounting in the VB GUI or when I leave out the synced_folder property.

I have the same problem that you describe. What do you mean when you say “press ‘S’ inside the VB GUI”. What steps do I have to take to do that?