How to uninstall VirtualBox

DxHum

Member
Joined
Jun 2, 2024
Messages
56
Reaction score
21
Credits
466
I tried installing Virtual Box so that I could try different Linux distros. This is the message I am receiving:

There were problems setting up VirtualBox. To re-start the set-up process, run
/sbin/vboxconfig
as root. If your system is using EFI Secure Boot you may need to sign the
kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
them. Please see your Linux system's documentation for more information.
Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...
Processing triggers for libc-bin (2.35-0ubuntu3.8) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for shared-mime-info (2.1-2) ...
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
dxhum@dxhum-HPE-580t:~$ virtualbox
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (6.5.0-35-generic) or it failed to
load. Please recompile the kernel module and install it by

sudo /sbin/vboxconfig

You will not be able to start VMs until this problem is fixed.

I am a bit uneasy as I tried to uninstall via Ubuntu Software application. It only said that the software could not be uninstalled. Also, there was a warning that the software was "released by a 3rd party and could not be trusted".

I've searched "uninstalling VBox" but none of the command line suggestions worked.

I'd like to get this cleaned up and start over.

DX
 


IS VB installed to Linux [id so which distro] or windows [which edition]
 
It appears you're operating on Ubuntu in that you've attempted to uninstall via Unbuntu Software Application, lets try this.

Open a terminal and try the following commands:

Code:
sudo apt-get remove virtualbox

This command should remove VirtualBox from your system. If it doesn't work or gives you an error, you can try purging it instead:

Code:
sudo apt-get purge virtualbox

This command not only removes the package but also deletes its configuration files. After running one of these commands, reboot your system.

If VirtualBox is still showing up or causing issues after attempting these removal commands, we may need to manually clean up any remaining files.

To do this, navigate to your home directory and look for any VirtualBox-related files or directories. You can use the following commands:

Code:
cd ~
ls -a

Look for any files or directories related to VirtualBox, and if you find any, you can delete them. Be cautious with this step, as you don't want to accidentally delete something important.

Once you've cleaned up any remaining files, you can try installing VirtualBox again if you still want to use it. Make sure to follow the installation instructions carefully, and if you encounter any errors during installation.
 
IS VB installed to Linux [id so which distro] or windows [which edition]

First, I am sorry for being so ambiguous in my post. I'm usually not like that.

I have Ubuntu 22.04 as the host operating system. My plan is to install VB and then create virtual machines with different distros to familiarize myself. Mint has come up frequently, so, I'd like to make that a VM.

When I switched over to Linux, it was to remove Windows from my life. So no Windows in this house, just on it. ;)

So, to rephrase my question: How can I uninstall VB 7.0 from a Ubuntu 22.04, which is the host OS.
 
Code:
sudo apt-get remove virtualbox

Code:
sudo apt-get purge virtualbox

Both of these commands told me that virtual box was not installed. But this is confusing as there is an icon for in in applications. It did open with a warning that while the interface opened, I would not be able start any virtual machines.

This error is why I want to remove and reinstall.
 
If you're not sure how it's installed, here's a few ways you can try to track it down.

Check APT logs:
You can check the APT logs to see if VirtualBox was installed via apt. The logs are located in /var/log/apt/, and you can examine them using commands like grep to search for VirtualBox installation entries.

Code:
grep virtualbox /var/log/apt/history.log

Check installed Packatges
You can list all installed packages and look for VirtualBox entries. If it was installed via apt, it will appear in the list of packages.

Code:
dpkg -l | grep virtualbox

Check Snap:
If VirtualBox was installed via Snap, you can check whether the Snap package is installed.

Code:
snap list | grep virtualbox
This will list all installed Snap packages, and you can see if VirtualBox is among them.

Check Flatpak:
Similarly, if VirtualBox was installed via Flatpak, you can check whether the Flatpak package is installed.

Code:
flatpak list | grep virtualbox

This will list all installed Flatpak applications, and you can see if VirtualBox is listed.
By using these commands, you can determine how VirtualBox was installed on the system.
 
Last edited:
Here is a simple bash script you can run to achieve this if you're as lazy as I am.

Code:
#!/bin/bash

# Define log file path
log_file=~/Downloads/virtualbox_installation.log

# Function to log output
log_output() {
    echo "$(date +"%Y-%m-%d %H:%M:%S") $1" >> "$log_file"
}

# Check APT logs
log_output "Checking APT logs..."
grep virtualbox /var/log/apt/history.log >> "$log_file"

# Check installed packages
log_output "Checking installed packages..."
dpkg -l | grep virtualbox >> "$log_file"

# Check Snap
log_output "Checking Snap packages..."
snap list | grep virtualbox >> "$log_file"

# Check Flatpak
log_output "Checking Flatpak packages..."
flatpak list | grep virtualbox >> "$log_file"

log_output "Script execution completed."

save the file as something like " search-vbox.sh" or something then execute it with

Code:
bash search-vbox.sh

It'll output it's findings to your Downloads directory. Theoretically ofc. Since I'm not on ubuntu, I haven't actually tested the script; but it should work.
 
This may help...
https://www.itechguides.com/how-to-uninstall-virtualbox-in-ubuntu/

In Linux Mint...from the Menu select Virtualbox...right click and select Uninstall...that's it.
1718411256739.gif
 
This is your problem - vboxdrv kernel module is not loaded. Either there is no module available for the current kernel (6.5.0-35-generic) or it failed to load. Please recompile the kernel module

This should fix it by installing gcc version 12
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa -y
sudo apt update
sudo apt install g++-12 gcc-1
 
Both of these commands told me that virtual box was not installed. But this is confusing as there is an icon for in in applications.
Go to Applications. Right click on the icon. Select uninstall. It should tell you that the app/program does not exist, would you like to get rid of the icon ?....Select Yes.

I would take the Terminals word for it. VB is not installed. The icon is left behind as a bit of fluff/rubbish.
 
I tried installing Virtual Box so that I could try different Linux distros. This is the message I am receiving:
...
dxhum@dxhum-HPE-580t:~$ virtualbox
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (6.5.0-35-generic) or it failed to
load. Please recompile the kernel module and install it by

sudo /sbin/vboxconfig


You will not be able to start VMs until this problem is fixed.

...

Also, there was a warning that the software was "released by a 3rd party and could not be trusted".

According to the error messages filtered above, my take is that you have enabled Secure Boot. You'll need to sign the kernel module, or it won't work.

To test this hypothesis, type in the terminal mokutil --sb-state.

1718440880776.png


If the output is "SecureBoot enabled", like in the image, you can either disable secure boot in your UEFI or check this URL to know how to sign the virtualbox modules: https://gist.github.com/reillysiemens/ac6bea1e6c7684d62f544bd79b2182a4

If you want to try adapting a script, you can check my script for Fedora; you will have to change some file and directory paths to make it work for Ubuntu: https://github.com/gvisoc/signmodules
 
Last edited:
My bad, Bob - I think I misread your Post. That being said, the Ubuntu method linked is quite good, nice find. :)
 

Members online


Latest posts

Top