1. Install virtualbox
sudo pacman -S virtualbox
Suggested choice: virtualbox-host-modules-arch
2. Install linux-headers
sudo pacman -S linux-headers
3. Manually load the module
After completing the above steps, an error should be reported when starting the virtual machine, and the error message will prompt you to execute
sudo /sbin/rcvboxdrv setup
4. Add the current user to the vboxusers group
To mount a usb device in a virtual machine, the current user needs to be added to the vboxusers group.
5. Install virtualbox-guest-utils
yay -S virtualbox-guest-utils
It is said that it is to have a better experience in the guest system.
When installing the software, you will be prompted to choose the package that provides the guest module. There are two types of virtualbox-guest-modules-arch and virtualbox-guest-dkms. Here you should choose the one corresponding to step 1, otherwise it will be displayed when the host starts. There was a problem that the module could not be loaded.
Reference: https://wiki.archlinux.org/index.php/VirtualBox