How to completely remove virtualbox

501,044

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.

Solution 3

First find installed package using below command :

sudo dpkg -l | grep virtualbox 

Then copy packages and remove using dpkg or apt-get as below :

sudo dpkg --purge <Packages>

--force-all optional

And also manually remove folder on home directory (~/"VirtualBox VMs").

Solution 4

If you installed VirtualBox through the installer script, you can find the directory where it is installed by running

cat /etc/vbox/vbox.cfg

You can then run the uninstall script located in the install directory. Assuming it's installed to /opt/VirtualBox, run

sudo /opt/VirtualBox/uninstall.sh
sudo rm -rf /opt/VirtualBox/

Solution 5

Open the terminal and type:

sudo apt remove virtualbox unity-scope-virtualbox ^virtualbox-

How to uninstall Oracle VirtualBox

If you installed VirtualBox from the Oracle website find your VirtualBox version as follows:

sudo apt install aptitude
aptitude search virtualbox\*

The latest version of VirtualBox that has Oracle VM VirtualBox on the same line with it is the package you have installed. If you have the latest version of Oracle VirtualBox installed, it is named virtualbox-5.1.

Verify that this version of Oracle VirtualBox is currently installed.

dpkg-query -s virtualbox-5.1    

Uninstall Oracle VirtualBox using a command that looks like this:

sudo apt remove VirtualBox-5.1  

If you have a different version of Oracle VirtualBox installed replace VirtualBox-5.1 in the above command with your VirtualBox version.

Share:
501,044

Related videos on Youtube

Manish Sakpal
Author by

Manish Sakpal

Updated on September 18, 2022

Comments

  • Manish Sakpal
    Manish Sakpal almost 2 years

    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?

    • Sergiy Kolodyazhnyy
      Sergiy Kolodyazhnyy over 8 years
      You say it was giving you problems. You might wanna explain what exactly were the problems. That will help others help you
    • Manish Sakpal
      Manish Sakpal over 8 years
      It said: failed to boot fedora owner not root
    • Dhaval Simaria
      Dhaval Simaria almost 8 years
      This will get your work done--> askubuntu.com/questions/711793/…
    • Takkat
      Takkat almost 7 years
      Did you try with sudo apt-get -f install?
  • Manish Sakpal
    Manish Sakpal over 8 years
    After reinstalling virtual box by following your procedure it said that fedora was inaccesible so i just removed it. Has it been successfuly removed?
  • Neil
    Neil over 8 years
    @Manishsakpal yes it has.
  • Manish Sakpal
    Manish Sakpal over 8 years
    it is giving error to . ?
  • Neil
    Neil over 8 years
    @Manishsakpal What error. you may want to try my answer again.
  • Manish Sakpal
    Manish Sakpal over 8 years
    Error is:- rm: invalid option -- '.' Try 'rm --help' for more information.
  • Neil
    Neil over 8 years
    @Manishsakpal what command did you type in ? show me
  • Manish Sakpal
    Manish Sakpal over 8 years
    the last command you told me to run
  • Zanna
    Zanna over 7 years
    why didn't you add this to your other answer instead of posting a new one?
  • Jitendra
    Jitendra over 7 years
    Sorry @Zanna I just forgot. I will update.
  • KhoPhi
    KhoPhi over 6 years
    And it was never updated.
  • Dominofoe
    Dominofoe about 6 years
    This finally worked for me. Had several different errors after updating VB and Ubuntu. I am on Ubuntu 18.10
  • Frederik Witte
    Frederik Witte over 5 years
    You don't need sudo for the rm commands
  • pbhj
    pbhj about 5 years
    Honestly I thought apt would remove packages installed with dpkg, but it doesn't even show virtualbox as being installed. Surprised that in 18.04.1 this is not linked up properly.
  • Jitendra
    Jitendra almost 5 years
    I already did @Rexford, but I haven't deleted below one, Now it's also done. :)
  • Chaim Eliyah
    Chaim Eliyah over 4 years
    In my case just the first line did everything. No further commands were necessary. The package shown in dpkg-query isn't installed locally.
  • roeland
    roeland over 4 years
    This is the correct answer when virtualbox is installed with the installer and not with debian packages.
  • Indacochea Wachín
    Indacochea Wachín about 4 years
    Working fine with VirtualBox script like: VirtualBox-6.0.18-136238-Linux_amd64.run from: download.virtualbox.org/virtualbox/6.0.18 Thanks
  • TetraDev
    TetraDev almost 4 years
    Don't put commands with sudo rm online! Someone can mess up their system badly with that.
  • Bariq Dharmawan
    Bariq Dharmawan over 3 years
    This work in ubuntu 20.04
  • FlexMcMurphy
    FlexMcMurphy about 3 years
    Does this remove guest VMs you created that might be in your home folder or just the Virtualbox application?
  • jeannej
    jeannej about 3 years
    If like me you ended up here because you just want to remove it, you do not need to go through the process given in this answer. The error message comes from VM or vbox running as root, so you have to stop it as root. I used sudo htop, found the line (perl command that took 40% of cpu) and killed it. After that I have been able to do a sudo dpkg --remove --force-remove-reinstreq virtualbox-6.1 and sudo dpkg --purge virtualbox-6.1. Hope this can help!