Rocky Linux 9.4 on VirtualBox 7.0.6 Guest Additions workaround

I’ll be brief, because I think my situation may be fairly isolated. I found a similar topic here but it is closed:

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

My host is Windows 7, so I’m stuck with VirtualBox 7.0.6. RockyLinux 9.3 worked fine in this environment, but with the recent update in 9.4 to kernel 5.14.0-427.16.1, Guest Additions failed to build with the following error:

__pte_offset_map is undefined

I couldn’t find much help on this specific error, but I found this general post in Centos 9 about issues installing Guest Additions:

[Centos 9 Guest] Cannot install Guest Additions 7.0.12

I followed the instructions there, and got Rocky working with the latest Guest Additions on the day I’m writing this:

[guyr@rocky64 ~]$ VBoxClient -version

I just did a software update after getting this all working, including a new kernel, and Guest Additions is continuing to work. I imagine this will probably break again at some point in the future, which is part of my motivation for documenting all this. BTW, I also have an Ubuntu VM running the latest 24.04, and that continues to work with the default VirtualBox 7.0.6 Guest Additions. But that has moved on to kernel 6.8.0-36, which might be why I haven’t encountered this issue there.

Hope this helps somebody (including a future me :smile: ). To save people having to read the complete linked article, the brief solution is to install the latest test build of the Guest Additions:
" This issue should be fixed in the VirtualBox test builds 7.0.13r160458 and newer."