-1

I had previously uninstalled VirtualBox. Now, I'm trying to re-install it; but, it is not installing.

Here are my actions and results:

~$ sudo apt-get install virtualbox
    [sudo] password for sudarsan: 
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Package virtualbox is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

However the following packages replace it: virtualbox-qt

N: Ignoring file 'virtualbox.list.save.3' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
N: Ignoring file 'virtualbox.list.save.2' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
N: Ignoring file 'virtualbox.list.save.1' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
E: Package 'virtualbox' has no installation candidate
Kevin Bowen
  • 19,615
  • 55
  • 79
  • 83
  • Have you removed multiverse repository ? http://askubuntu.com/questions/453096/why-was-the-virtualbox-package-removed-from-the-14-04-repository – mprotic Nov 10 '16 at 14:10

2 Answers2

1

You have three problems.

  1. You should always do a sudo apt-get update before your sudo apt-get install. Next, you need to use the correct package name for Virtualbox which is virtualbox, or virtualbox-5.1 if you have the updated repository in your /etc/apt/sources.list...
deb download.virtualbox.org/virtualbox/debian xenial non-free contrib
  1. You have 3 invalid files in /etc/apt/sources.list.d/, and need to delete them with:
sudo rm /etc/apt/sources.list.d/virtualbox.list.save.1  
sudo rm /etc/apt/sources.list.d/virtualbox.list.save.2  
sudo rm /etc/apt/sources.list.d/virtualbox.list.save.3
  1. The file /etc/apt/sources.list.d/virtualbox.list is invalid and needs to be edited.

Cheers, Al

heynnema
  • 70,711
  • The package name in the Ubuntu archive is virtualbox. – Gunnar Hjalmarsson Oct 06 '16 at 22:54
  • You're correct if you want virtualbox 5.0, but if you want the latest version 5.1, you may need to add a repository to get it. "deb http://download.virtualbox.org/virtualbox/debian xenial non-free contrib". Cheers, Al – heynnema Oct 06 '16 at 23:12
  • I get virtualbox 5.1 from the Ubuntu archive anyway since I'm on 16.10. ;) But it's possible that the OP's problem is related to previous enabling and later disabling of that external repository. – Gunnar Hjalmarsson Oct 06 '16 at 23:38
  • sudarsan@sudarsan-Inspiron-3551:~$ sudo apt-get update E: Type 'trusty' is not known on line 2 in source list /etc/apt/sources.list.d/virtualbox.list E: The list of sources could not be read. – Bvg Sudarshan Oct 07 '16 at 02:10
  • sudarsan@sudarsan-Inspiron-3551:~$ sudo apt-get autoremove Reading package lists... Done Building dependency tree
    Reading state information... Done The following packages will be REMOVED:
    – Bvg Sudarshan Oct 07 '16 at 02:16
  • Did you delete the files I suggested? Please edit your question and add the results of cat /etc/apt/sources.list.d/virtualbox.list. Cheers, Al – heynnema Oct 07 '16 at 06:33
0

I would try this:

sudo apt purge virtualbox
sudo apt update
sudo apt install virtualbox
Gunnar Hjalmarsson
  • 33,540
  • 3
  • 64
  • 94