how to uninstall virtualbox from ubuntu headless server code example
Example: remove virtualbox from ubuntu
#Uninstall VirtualBox first.
sudo apt-get remove --purge virtualbox
#Run these commands to delete all virtual machines and settings and Virtual Hard Drives:
sudo rm ~/"VirtualBox VMs" -Rf
sudo rm ~/.config/VirtualBox/ -Rf
#If you want to install it again. Run this command:
sudo apt-get install virtualbox
#Additionally, check:
sudo ps aux | grep -i "vbox"
#Kill any "ghost" processes you may think are relevant.
sudo pkill VBox*