How to completely remove virtualbox [duplicate]

I had installed VirtualBox but it started giving me problems. So I uninstalled it using:-

sudo apt-get remove virtualbox-\*
sudo apt-get purge virtualbox-\*

But when I reinstalled VirtualBox it again resumed to previous settings and started giving same problems. How can i completely remove VirtualBox from my laptop and then reinstall it such that it wont give same problem again?


Solution 1:

Your problem : Virtual Box keeps its folder and settings in your home folder. Delete everything inside the folder.

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*

Solution 2:

sudo apt-get remove virtualbox* --purge

Just try one command for remove all VM. Or perticulary one VM

sudo apt remove virtualbox virtualbox-5.0 virtualbox-4.*

After that, you maybe get some instruction which will already give there you just need to type on the command line. Then again run same above command.