I have installed virtualbox from Software Center, then tried to install extension pack but then realized the package was for the new version 5.1 instead of the old one on Software Center. So I removed the old version, but encountered an error saying extension pack folder was not empty, so I removed the whole folder where extension pack was stored. Now if I try to install/update/remove virtuabox I get this error:

 The following packages will be REMOVED:
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 158 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 273859 files and directories currently installed.)
Removing virtualbox-5.1 (5.1.8-111374~Ubuntu~xenial) ...
dpkg: error processing package virtualbox-5.1 (--purge):
 subprocess installed pre-removal script returned error exit status 1
/var/lib/dpkg/info/virtualbox-5.1.postinst: 95: /var/lib/dpkg/info/virtualbox-5.1.postinst: /usr/lib/virtualbox/prerm-common.sh: not found
/var/lib/dpkg/info/virtualbox-5.1.postinst: 96: /var/lib/dpkg/info/virtualbox-5.1.postinst: /usr/lib/virtualbox/postinst-common.sh: not found
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

Also, when I run

sudo apt-get purge virtualbox-\*

A terminal pops up saying "Running VMs found" while as far as I can see there are none. Any help will be appreciated as I am quite new to Ubuntu.

  • You can make most programs print English messages by prefixing the command with LC_MESSAGES=POSIX, e. g. LC_MESSAGES=POSIX free. Works the same for graphical applications. With super-user privileges you need sudo LC_MESSAGES=POSIX apt ... or gksudo env LC_MESSAGES=POSIX synaptic (for graphical applications). – David Foerster Nov 19 '16 at 14:41
  • What directory did you remove exactly when you removed the extension pack? – David Foerster Nov 19 '16 at 14:44
  • Thanks, updated the error message in english! The folder was named /virtualbox, iniside /etc. IS there anything I can do? – Jack Nov 19 '16 at 19:00
  • How did you install a package with a dot in the name? That's not a legal character. What's he output of apt-cache policy virtualbox-5.1? – David Foerster Nov 19 '16 at 19:53

This should help you out.

If not, you may have to delete the files manually.

Follow the guide located here to boot your computer in safe mode. The second you log in, open the System Monitor by pressing the dash button and typing "System Monitor" and finding it in the list of programs. It's the black box with the green squiggly line in it.

Find anything related to VBox and kill it. If you can't find anything at all, right click System Monitor while it's still open in your taskbar, select "lock to launcher", and reboot into safe mode. Timing is critical, so try your best to open it as soon as you log in. If you still can't find any VBox items in the monitor, you can delete the VBox files.

Head over to /usr/share/applications and find any files relating to VBox, deleting them accordingly.

Now go to /home/your_username/ and see if there's a folder titled "VirtualBox" or anything along those lines. It may or may not have a dot in its title. Delete the folders if you see them.

At this point, most of the files for VBox should be removed, and the data that determines if it's actually on your computer or not should be gone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.