13

I would like to update my virtualbox but get the error message

$ sudo dpkg -i virtualbox-5.1_5.1.22-115126~Ubuntu~trusty_amd64.deb 

dpkg: regarding virtualbox-5.1_5.1.22-115126~Ubuntu~trusty_amd64.deb containing virtualbox-5.1:
 virtualbox-5.1 conflicts with virtualbox
  virtualbox-5.0 provides virtualbox and is present and installed.

dpkg: error processing archive virtualbox-5.1_5.1.22-115126~Ubuntu~trusty_amd64.deb (--install):
 conflicting packages - not installing virtualbox-5.1
Errors were encountered while processing:
 virtualbox-5.1_5.1.22-115126~Ubuntu~trusty_amd64.deb

I understand what it means, but are not sure how to solve the issue. Should I de-install my current installation? I am afraid I might lose my settings etc.

Make42
  • 409
  • 4
  • 14
  • Seems you have an other version of virtualbox already installed on your system. you should remove it first... by the way: I suggest you to install virtualbox from Ubuntu repositories. I don't think that you lose any settings. At least I didn't ;) – Ravexina May 03 '17 at 07:05
  • @Ravexina: I am using Kubuntu 14.4, so there are no updates for virtualbox anymore in the repo. My fear is that by removing the older version I lose the settings, not by updating from the repo. – Make42 May 03 '17 at 07:11
  • 1
    We have to remove a previous version (5.0) to be able to intall an upgrade (5.1). See https://askubuntu.com/questions/692982/virtualbox-failed-to-install-after-upgrade-to-15-10 – Takkat May 03 '17 at 07:13
  • @Make42 I'm not sure, however I once removed mine and reinstalled the same version but everything was there ;) – Ravexina May 03 '17 at 07:14
  • All settings, and all virtual machines will be preserved. – Takkat May 03 '17 at 07:17
  • Unless there is a very special configuration which I doubt, removing a package does not remove it's config files. That is what the purge option is for. –  May 03 '17 at 07:37

1 Answers1

13

I've never lost my VirtualBox guest OSs or settings when manually upgrading Oracle VirtualBox by manually uninstalling the old version and then downloading the latest version of Oracle VirtualBox and manually installing it by following the steps listed below. Your existing VirtualBox guest OS(s) will not be deleted if the version of Oracle VirtualBox is upgraded. Make sure that you also upgrade the Oracle VM VirtualBox Extension Pack so that it is the same version as whatever version of VirtualBox that is installed.

  1. Show the name of the installed virtualbox package.

    dpkg -l | grep virtualbox | grep ii 
    

    The results of this command should be something like virtualbox-5.0

  2. Uninstall the old version of VirtualBox

    sudo dpkg -r virtualbox-5.0 # match the version of virtualbox with the results of step 1.
    
  3. Download the latest version of Oracle VirtualBox for your Ubuntu release and Oracle VM VirtualBox Extension Pack from the official Oracle VirtualBox website. You might want to compare the SHA256 checksum that is provided on the download webpage to verify the integrity of the downloaded packages.

  4. Change directories using cd to the directory containing the Oracle VirtualBox .deb file that you downloaded. In your question this file is named:
    virtualbox-5.1_5.1.22-115126~Ubuntu~trusty_amd64.deb

  5. Install the latest version of Oracle VirtualBox for your Ubuntu release.

    sudo dpkg -i virtualbox-5.1_5.1.22-115126~Ubuntu~trusty_amd64.deb
    
karel
  • 114,770
  • A possibly better command to find installed virtualbox packages might be dpkg -l *virtualbox* | grep ii... as this shows all virtualbox-related packages, but only ones that are currently installed. – heynnema May 03 '17 at 14:04
  • What if it still shows conflict after doing this? There were only some configuration files. – jjmerelo Nov 13 '18 at 19:15
  • If I uninstall the old version of VB, will my virtual machine(s) get deleted along with it? – Steve Feb 25 '20 at 13:20
  • VirtualBox only supports images of a virtual hard disk, so you first need to create a new virtual machine in VirtualBox before using an existing VirtualBox image. See this Oracle VirtualBox tutorial: Importing a VDI in VirtualBox. – karel Feb 25 '20 at 13:39