Can't install / build VirtualBox Guest Additions on Rocky 9

Greetings -

Any ideas on getting VirtualBox Guest Additions to work for a Rocky 9.3 based VM?

I cannot get Guest Additions (GA) to work for a VirtualBox VM. I’ve tried on both an Ubuntu 20.04 host with VB 6.1 and a Windows 11 host with VB 7.0. There is a similar sounding problem in a couple other posts, unable-to-install-virtualbox-guest-additions-in-rocky-8-9, or even cannot-build-virtualbox-guest-additions, with other people having problems with GA.

After having the problems getting GA to work with the Rocky VM on the Ubuntu host I assumed the problems were from something wrong on the Ubuntu system so I switched to a windows 11 host and the problems continue. All of below info is from trying this on the Windows system. I’ve been running Ubuntu systems and VMs and wanted to try out RH based distros - but not having fun so far. From scouring the internet for this problem it seems like there is some kind of fundamental issue with GA and RH based distros. That seems extremely odd to me though so it must be because I have been using Ubuntu and am not linux admin level anyway.

Host is Windows 11 but same problem happens on an Ubuntu host
I already have several Ubuntu VMs with GA working fine so the host and VB install are okay. Just got the Rocky 9.3 DVD ISO yesterday (should I have chosen the 8.x? instead?)
VirtualBox version 7.0 is installed (on Ubuntu it was the 6.1 but same problem with GA)
With Ubuntu its been as easy as clicking “insert Guest Additions CD” and everything works without all this building the kernel stuff. I find it hard to believe that RH would be having all its paying corporate customers doing that, so am sure something strange is going on.

I have tried everything from these articles below and none of them solve the problems.

www.linkedin[.]com /pulse/installing-virtualbox-guest-additions-centosrhel-enhanced-soran
forums.virtualbox[.]org /viewtopic.php?t=1091421
technixleo[.]com /install-and-use-virtualbox-on-centos-rhel/
kifarunix[.]com /install-virtualbox-guest-additions-on-rocky-linux-9/

Those pages are centered around building some kernel files for the GA. That is something I never needed to do with Ubuntu. NOTE: I put a space after the .com or .org so the forum system didn’t put link previews in, so you’ll have to delete that space to get to the link.

There are always errors after running “/run/media/$USER/VBox_GAs_7.0.4/” (as sudo of course).

It prints out:

VirtualBox Guest Additions: Look at /var/log/vboxadd-setup.log to find out what  went wrong

ValueError: File context for /opt/VBoxGuestAdditions-7.0.4/other/mount.vboxsf already defined

The log file vboxadd-setup.log contains these errors below. There might be a couple more errors that I didn’t copy over to this post but hopefully you get the idea. Also, to keep the post even shorter I only copied the lines with the error statement - didn’t see a way to attach the whole file here.

/tmp/vbox.0/regops.c:3779:63: error: passing argument 6 of ‘simple_write_begin’ from incompatible pointer type [-Werror=incompatible-pointer-types]
/tmp/vbox.0/regops.c:3779:12: error: too many arguments to function ‘simple_write_begin’
/tmp/vbox.0/regops.c:3859:6: error: ‘struct address_space_operations’ has no member named ‘readpage’

The site above at “” looked promising because it was editing the file regops.c with three one-line changes, but it did not work either. After editing that file the error in the log file is these 3 instances of missing a header file:

In file included from /tmp/vbox.0/vboxvideo_guest.h:34,
                 from /tmp/vbox.0/modesetting.c:27:
/tmp/vbox.0/vbox_drv.h:171:10: fatal error: drm/ttm/ttm_bo_api.h: No such file or directory
  171 | #include <drm/ttm/ttm_bo_api.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from /tmp/vbox.0/hgsmi_base.c:27:
/tmp/vbox.0/vbox_drv.h:171:10: fatal error: drm/ttm/ttm_bo_api.h: No such file or directory
  171 | #include <drm/ttm/ttm_bo_api.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from /tmp/vbox.0/vbox_drv.c:35:
/tmp/vbox.0/vbox_drv.h:171:10: fatal error: drm/ttm/ttm_bo_api.h: No such file or directory
  171 | #include <drm/ttm/ttm_bo_api.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

I’ll try out any ideas to get this working - if its possible.

It seems like tens of thousands of people would be having this problem though instead of just me. Since I had the same / similar problems on both the Ubuntu and Windows system I’m pretty sure this is a red-hat with virtualbox problem and not related to my specific computer(s).

Thanks in advance!

Unless ubuntu happens to provide the kernel modules in their repositories already, you are also building the kernel modules when using the guest additions disc in virtualbox.

With that said, this worked fine for myself. I was not able to replicate your issue with a standard installation of Rocky Linux. In my case, I used the XFCE desktop. GNOME (Workstation) and others should work the same way.

# make sure you're fully up to date and reboot
% dnf update -y
% init 6

# login, open terminal, become root
% sudo su -
% dnf install kernel-devel -y

# Click devices -> Insert Guest Additions CD image...
# On a desktop, it should automatically mount. 
% cd /run/media/nazu/VBox_GAs_7.0.14
% ./

# While this runs, it will state that it is building the modules
# and for what kernel. If it succeeds, it will tell you services
# were not restarted automatically and some modules were reloaded.

# Upon completion, reboot and check that it installed.
% init 6

# login and check
% sudo su -
% systemctl status vboxadd

Well, I suppose Ubuntu could be adding prebuilt modules. There is no long delay that I recall (as would happen if it was building kernel modules) when adding the GA to Ubuntu VMs I’ve created. Seems like there would be a noticable big delay if it were building kernel modules; or maybe I just have a bad memory (lol - I do!). In the next couple days I’ll re-create an Ubunu VM and pay closer attention to see what happens during the GA install.

To be sure of what you tried - you have an actual deskdop with Rocky as the OS and built the GA kernel modules directly on it - and not within a VM? I’m not actually sure how building the GA modules on a standard install compares to an install on a VM. I did notice your screenshots shows 7.0.14, whereas my VirtualBox GA showed 7.0.4 - but it’s a Windows 11 install of VB.

I did do some of the steps you have, muiltiple times, inside the VM, and tried all the different install methods in those links I included, Tthe exact steps you did were not in any of those links but I can give it a shot. Not sure if all those steps will work on a VM rather than a “real” system though, and, I might needto start with a new VM since all the things I’ve done might have made too many changes.

Or, should I step back and re-try with Rocky 8 instead?

I don’t have anymore time this morning, have to head to work and will start checking later, but just ran

$ lsmod | grep vboxguest
vboxguest             483328  7 vboxsf

SO, does this mean that at some point the GA actuall installed, even though there were errors?

I saw that from searching for “how to tell if guest additions are installed in VM” and that showed up at How can I tell if the VirtualBox guest additions were installed on an Ubuntu VM? - Ask Ubuntu


$ VBoxClient --version

If this means GA is actually installed then I have to A) figure out how to mount a shared folder - since automount did not work and B) figure out at which step got GA installed.

It actaully kindof makes some sense now, that it might at least be partially installed. At some point in all the different things tried I reallize now that bi-directional cut and paste was working, and from my understanding, the bidirectional clipboard is a feature of GA… so it must be there. I have to figure out what got it working, since the whole point oif this was to create a VM that I can use at work for some specific software that works under RH and not other distros. It needs to be as clean of a VM as possible and there’s no doubt its all crapped up from all the stuff I did.

Anyway, gotta run for now…

LOL okay sorry for all these updates but I couldn’t resist trying some other things before taking off this morning.

What also apparently happened along the way is my VM settings for the shared folder got erased somehow, but after re-enabling them from Devices → Shared Folders it is there – but the permissions are incorrect where “ls /mnt/vmshare” did not work due to permissions while “sudo ls /mnt/vmshare” did. Something is definitely wrong during the GA install and no idea what other problems there are.

So, the short version of this long story is that GA seems to have installed, at least partially, but with some problems. There still are errors during compiles for the GA installation yet some of it works.

Its a little scary since there must be some unknown future problems waiting to manifest. This makes me wonder if other people on the internet are having similar problems from a partially installed GA, where some errors might have occurred but they are unaware. There’s a lot of posts floating for people looking to get help on some GA related features not working such as auto-mount and other things too. Not just for RH based but others distros too. Is all this a Linux / distro thing or an oracle virtual box thing. Have I just been lucky all this time with GA working under Ubuntu?

Any inputs on these very weird behaviors is welcome!

Sorry for all the posts on my problem here, but hopefully it may help uncover some issues and will help someone else.

No, this was done in a VirtualBox VM. I wouldn’t ever have a reason to install the guest additions anywhere else.

I can’t really attest to this in particular. In my case, I don’t really use shared folders, but I didn’t have any issues setting that up.

If you are continuing to have issues, I would suggest uninstalling all the drivers, rebooting, and trying to install them again. You could also start clean and just reinstall Rocky Linux 9 entirely to the VM and run through the installation steps for the guest additions.