Syncing folder /var/cache/apt: filesystem vboxsf not available

49 views
Skip to first unread message

Amedee Van Gasse

unread,
Apr 6, 2023, 6:16:53 AM4/6/23
to Vagrant

I use Windows as a host and Kali Linux as a guest. VirtualBox provider.

I routinely destroy and re-provision Kali. I want to have a synced folder /var/cache/apt so that apt files aren't downloaded again each time.

This is my Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "kalilinux/rolling"
  config.vm.synced_folder "./apt-cache", "/var/cache/apt",
    user: "root", group: "root", mount_options: ["dmode=777, fmode=646"],
    create: true
  config.vm.synced_folder "./var/lib/apt/lists/", "/var/lib/apt/lists/",
    user: "root", group: "root", mount_options: ["dmode=777, fmode=646"],
    create: true
  config.vm.provision "shell", inline: <<-SHELL
    dpkg-reconfigure debconf -f noninteractive -p critical
    apt-mark hold grub-pc
    apt-get --yes --option=Dpkg::Options::=--force-confdef purge apt-listchanges
    apt-get update
    apt-get --yes --option=Dpkg::Options::=--force-confdef install linux-headers-amd64
    apt-get --yes --option=Dpkg::Options::=--force-confdef install cifs-utils
    apt-get --yes --option=Dpkg::Options::=--force-confdef --reinstall install virtualbox-guest-x11
    apt-get --yes --option=Dpkg::Options::=--force-confdef upgrade
    apt-get --yes --option=Dpkg::Options::=--force-confdef dist-upgrade
    apt-get autoremove --yes
  SHELL
end


I use this PowerShell command to bring up the Kali box:

vagrant up --provision | Tee-Object -FilePath "vagrant-up.log"


I get this error:

[default] GuestAdditions 7.0.6 running --- OK.
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
    default: /vagrant => C:/Users/amede/kali
    default: /var/cache/apt => C:/Users/amede/kali/apt-cache
Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:

mount -t vboxsf -o dmode=777, fmode=646,uid=1000,gid=0,_netdev var_cache_apt /var/cache/apt

The error output from the command was:

mount: bad usage
Try 'mount --help' for more information.


When I comment out the config.vm.synced_folder lines and run the following PowerShell command:

vagrant up --provision | Tee-Object -FilePath "vagrant-up.log"


then the Kali box comes up without error.

Some parts of the output relevant to VirtualBox GuestAdditions:

Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   6.0.0
VBoxService inside the vm claims: 6.1.38
Going on, assuming VBoxService is correct...
[default] A Virtualbox Guest Additions installation was found but no tools to rebuild or start them.
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   6.0.0
VBoxService inside the vm claims: 6.1.38
Going on, assuming VBoxService is correct...
The guest's platform ("kali") is currently not supported, will try generic Linux method...
Copy iso file C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
Mounting Virtualbox Guest Additions ISO to: /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.
Installing Virtualbox Guest Additions 7.0.6 - guest version is 6.1.38
Verifying archive integrity...     0%    70%  100%   MD5 checksums are OK. All good.
Uncompressing VirtualBox 7.0.6 Guest Additions for Linux     0%    70%  100%  
VirtualBox Guest Additions installer
This system appears to have a version of the VirtualBox Guest Additions
already installed.  If it is part of the operating system and kept up-to-date,
there is most likely no need to replace it.  If it is not up-to-date, you
should get a notification when you start the system.  If you wish to replace
it with this version, please do not continue with this installation now, but
instead remove the current version first, following the instructions for the
operating system.

If your system simply has the remains of a version of the Additions you could
not remove you should probably continue now, and these will be removed during
installation.

Do you wish to continue? [yes or no]
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Setting up modules
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: Kernel headers not found for target kernel
6.0.0-kali3-amd64. Please install them and execute
  /sbin/rcvboxadd setup
VirtualBox Guest Additions: Running kernel modules will not be replaced until
the system is restarted
An error occurred during installation of VirtualBox Guest Additions 7.0.6. Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
Job for vboxadd-service.service failed because the control process exited with error code.
See "systemctl status vboxadd-service.service" and "journalctl -xeu vboxadd-service.service" for details.
Unmounting Virtualbox Guest Additions ISO from: /mnt
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   6.0.0
VBoxService inside the vm claims: 7.0.6
Going on, assuming VBoxService is correct...
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   6.0.0
VBoxService inside the vm claims: 7.0.6
Going on, assuming VBoxService is correct...
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 6.1.38
    default: VirtualBox Version: 7.0
==> default: Mounting shared folders...
    default: /vagrant => C:/Users/amede/kali


Reply all
Reply to author
Forward
0 new messages