RockyLinux9 Vagrant box error

I am using VirtualBox version 7.0.6 and Vagrant version 2.3.7. I have been trying for the past days to start successfully a RockyLinux/9 VM using Vagrant. The error I am getting is “/sbin/mount.vboxsf: mounting failed with the error: No such device”.

This is the last Vagrantfile I have tried:

Vagrant.configure("2") do |config|
  config.vm.box = "rockylinux/9"
  config.vbguest.auto_update       = true
  config.vbguest.installer_options = { allow_kernel_upgrade: true, auto_reboot: true }
end
==> default: Machine booted and ready!
[default] GuestAdditions seems to be installed (7.0.16) correctly, but not running.
Redirecting to /bin/systemctl start vboxadd.service
Redirecting to /bin/systemctl start vboxadd-service.service
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
5.14.0-427.13.1.el9_4.x86_64. Please install them and execute
  /sbin/rcvboxadd setup
Restarting VM to apply changes...
==> default: Attempting graceful shutdown of VM...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: No guest additions were detected on the base box for this VM! Guest
    default: additions are required for forwarded ports, shared folders, host only
    default: networking, and more. If SSH fails on this machine, please install
    default: the guest additions and repackage the box to continue.
    default:
    default: This is not an error message; everything may continue to work properly,
    default: in which case you may ignore this message.
==> default: Mounting shared folders...
    default: /vagrant => Z:/siscog/tmp
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 uid=1000,gid=1000,_netdev vagrant /vagrant

The error output from the command was:

/sbin/mount.vboxsf: mounting failed with the error: No such device

So, I even tried the following line to install all the necessary tools (source: almalinux: "/sbin/mount.vboxsf: mounting failed with the error: No such device" for vagrant-vbguest > 0.21 · Issue #423 · dotless-de/vagrant-vbguest · GitHub) - Same result:

  config.vbguest.installer_hooks[:before_install] = ["yum install -y bzip2 elfutils-libelf-devel gcc kernel-devel kernel-headers make perl tar dkms", "sleep 2"]

Additionally, if I SSH to the VM created, I have the following outputs:

[vagrant@localhost ~]$ yum install -y kernel-devel-`uname -r`
Error: This command has to be run with superuser privileges (under the root user on most systems).
[vagrant@localhost ~]$ sudo yum install -y kernel-devel-`uname -r`
Rocky Linux 9 - BaseOS                                                                                  14 kB/s | 4.1 kB     00:00
Rocky Linux 9 - BaseOS                                                                                 606 kB/s | 2.2 MB     00:03
Rocky Linux 9 - AppStream                                                                               19 kB/s | 4.5 kB     00:00
Rocky Linux 9 - AppStream                                                                              497 kB/s | 7.9 MB     00:16
Rocky Linux 9 - Extras                                                                                  10 kB/s | 2.9 kB     00:00
Rocky Linux 9 - Extras                                                                                  23 kB/s |  15 kB     00:00
No match for argument: kernel-devel-5.14.0-427.13.1.el9_4.x86_64
Error: Unable to find a match: kernel-devel-5.14.0-427.13.1.el9_4.x86_64
[vagrant@localhost ~]$ 
[vagrant@localhost ~]$ sudo yum install -y kernel-headers-`uname -r`
Last metadata expiration check: 0:00:18 ago on Mon 20 May 2024 11:03:24 AM UTC.
Package kernel-headers-5.14.0-427.13.1.el9_4.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

In the last command, I can see that I have the kernel-headers for the target version. Now, if run the “/sbin/rcvboxadd setup” I get the following output:

[vagrant@localhost ~]$ sudo /sbin/rcvboxadd setup
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
5.14.0-427.13.1.el9_4.x86_64. Please install them and execute
  /sbin/rcvboxadd setup
VirtualBox Guest Additions: reloading kernel modules and services
VirtualBox Guest Additions: unable to load vboxguest kernel module, see dmesg
VirtualBox Guest Additions: kernel modules and services were not reloaded
The log file /var/log/vboxadd-setup.log may contain further information.

The logs say the following (note that I found the following bug: 0004192: Error installing virtualbox guest additions (6.0.24.r139119 - Qt.5.6.1) on rocky linux 9.2 - Rocky Linux BugTracker):

[vagrant@localhost ~]$ cat /var/log/vboxadd-setup.log
Could not find the X.Org or XFree86 Window System, skipping.
kernel modules and services were not reloaded

Ok, let’s try to update the kernel-headers:

[vagrant@localhost ~]$ sudo yum install -y kernel-headers
Last metadata expiration check: 0:09:06 ago on Mon 20 May 2024 11:03:24 AM UTC.
Package kernel-headers-5.14.0-427.13.1.el9_4.x86_64 is already installed.
Dependencies resolved.
=======================================================================================================================================
 Package                          Architecture             Version                                   Repository                   Size
=======================================================================================================================================
Upgrading:
 kernel-headers                   x86_64                   5.14.0-427.16.1.el9_4                     appstream                   7.2 M

Transaction Summary
=======================================================================================================================================
Upgrade  1 Package

Total download size: 7.2 M
Downloading Packages:
kernel-headers-5.14.0-427.16.1.el9_4.x86_64.rpm                                                        225 kB/s | 7.2 MB     00:32
---------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                  224 kB/s | 7.2 MB     00:33
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                               1/1
  Upgrading        : kernel-headers-5.14.0-427.16.1.el9_4.x86_64                                                                   1/2
  Cleanup          : kernel-headers-5.14.0-427.13.1.el9_4.x86_64                                                                   2/2
  Verifying        : kernel-headers-5.14.0-427.16.1.el9_4.x86_64                                                                   1/2
  Verifying        : kernel-headers-5.14.0-427.13.1.el9_4.x86_64                                                                   2/2

Upgraded:
  kernel-headers-5.14.0-427.16.1.el9_4.x86_64

Complete!

After this, I still got the same problem. I have tried with other RockyLinux 9 versions and it also happens.

Is there anything else I can try/do? I wouldn’t want to downgrade virtualbox/guest additions.

Thank you,

Hi, you try install guest additions, before install, update all system

Hello brutux, did you ever find a solution to this?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.