So I installed VirtualBox 6.0 from the deb file before learning that actually, I wanted version 5.2 (I have my reasons). Anyway, I attempted to remove virtualbox-6.0 using apt remove --purge and it failed with the following error:
dpkg: error processing package virtualbox-6.0 (--remove):
installed virtualbox-6.0 package pre-removal script subprocess returned error exit status 1
dpkg --remove --force-all virtualbox-6.0 did no different. In my infinite wisdom, I decided to delete every trace of virtualbox I could find on my system, did so, and now virtualbox is gone from everything it had under /usr. Then I tried removing it, which still returned the same error. I was unable to install version 5.2 because it complained that another installation was still there. There is no trace of any processes running or files on my drive, yet this annoyingly persistent vbox is still in the way. How do I get it to go away?
I ran into exactly the same problem. I was unable to remove the package in a "normal" manner.
To solve it I had to manually delete all related files.
To do so I ran:
$ dpkg -L virtualbox-6.0
The output lists all files/folders owned by the package but there are also important folders such as
/usr/src
listed so you cannot just delete everything with a pipe likedpkg -L virtualbox-6.0 | xargs rm -r
, you need to delete them 1 by one or folder by folder it goes quite fast.