How to install VirtualBox Guest Additions on Fedora?

Fedora magazine has an article (updated in 2020) about the topic, but I don’t understand this part:

Once finished, actually install the Additions by running the script

sudo /run/media/ *user* /VBOXADDITIONS*/VBoxLinuxAdditions.run

There’s no such “script” on my system (I did allow the Guest Additions image download to finish, after installing the packages mentioned).

UPDATE: Is the virtualbox-guest-additions package in the Fedora repo a direct replacement for the manual installation?

Yes, use the package and add your user to vboxsf group if you plan folder sharing with host.

1 Like

I can’t attach any external drive to my virtual machine (I have three connected, two HDDs and a thumbdrive), none are detected in the machine settings:

Following advice on superuser.com, I ran the command sudo usermod -aG vboxusers $USER.

Is it mandatory to install Extension Pack and Guest Additions for the machine?

1- install Extension Pack compatible with virtualbox version on your system

2-add your user to vboxusers group .

( you can use my script to auto download and install Extension Pack + add your user to vboxusers group ).

3 - You have to make sure akmods service is enable .

sudo systemctl enable akmods.service --now

Finaly try reboot your system

if not work remove virtualbox and try install virtualbox from rpmfusion Exclusively
(google translate :smiley: )

There is no reason to try to install the guest additions by hand. The virtualbox-guest-additions package in the Fedora repos is sufficient.

1 Like

Is there a reason which prevents Extension Pack from getting its own package? Can the pack be alternatively installed from within Virtualbox on Fedora (see software installation - How to install VirtualBox Extension Pack to VirtualBox latest version on Linux? - Unix & Linux Stack Exchange)?

1 Like

Install it manually by downloading from following link: https://download.virtualbox.org/virtualbox/6.1.16/Oracle_VM_VirtualBox_Extension_Pack-6.1.16.vbox-extpack

Then File > Preferences > Extensions and add it.

2 Likes

You didn’t read the magazine article carefully. As the magazine says,
Guest Additions need to be installed inside the VM, not on your host OS.
The scripts are to be run in the guest OS, and are included in the guest addition CD. Insert this CD to your guest OS by clicking Devices → Insert Guest Additions CD image… in Virtual Box.
Also, the article’s method is outdated, just like the magazine’s comment says, install this on your guest OS

Another way to install the guest additions is to enable the rpmfusion-free repo and install them as any other package:
$ sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
$ sudo dnf install VirtualBox-guest-additions

What you really need for your host OS is Oracle’s VirtualBox Extension Pack, which is proprietary (subject to VirtualBox_PUEL – Oracle VM VirtualBox), and must be downloaded from VirtualBox’s website (not rpmfusion): Downloads – Oracle VM VirtualBox. This is not needed for basic function of VirtualBox, but as you said you want to connect hard disk through USB,

I can’t attach any external drive to my virtual machine (I have three connected, two HDDs and a thumbdrive), none are detected in the machine settings:

then it’s necessary because this Extension Pack provides USB 2.0 and USB 3.0 ability.

Is it mandatory to install Extension Pack and Guest Additions for the machine?

Yes, it is, for USB 2.0/USB 3.0 ability.
My suggestion: qemu/kvm. It is a trully FOSS alternative, and can be easily controlled by virtmanager (sudo dnf install virt-manager). Also, you don’t have to insert out-of-tree kernel modules from virtualbox, it’s in the kernel main tree. One drawback is that virtmanager does not provide easy guest integration like sharing files between guest and host (well, at least for non-linux guest; you can share filesystem for linux guest), which is pretty inconvenient. But as for USB qemu/kvm does it pretty well, no extra packages needed.

I guess it’s because fedora has stricter licensing issues and packaging standards than other distributions (debian, arch, etc.). Fedora’s repository cannot contain non-free or patent-encumbered software, and even reject free software not conforming to Fedora Packaging Guideline (FYI, programs written in Go or Rust is known to be hard to package). Rpmfusion will accept more packages, but these packages have to be at least legally redistributable
According to https://rpmfusion.org/FAQ#What_packages_are_available_from_RPM_Fusion.3F

Does RPM Fusion distribute illegal software?

No. RPM Fusion only distributes packages which can be legally re-distributed.