0

I am having an issue with installing virtualbox 6.1 using apt with Ubuntu 20.04 OS. I used this tutorial to get all the way to the last step with the command

$ sudo apt install virtualbox-6.1

which is giving me an error of

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies: virtualbox-6.1 : Depends: python (< 2.8) but it is not installable Depends: python (>= 2.7) but it is not installable Depends: python:any (>= 2.6.6-7~) Recommends: libsdl-ttf2.0-0 but it is not installable E: Unable to correct problems, you have held broken packages.

The apt-cache policy virtualbox-6.1 is this.

  Installed: (none)
  Candidate: 6.1.18-142142~Ubuntu~eoan
  Version table:
     6.1.18-142142~Ubuntu~eoan 500
        500 https://download.virtualbox.org/virtualbox/debian eoan/contrib amd64 Packages
     6.1.16-140961~Ubuntu~eoan -1
        100 /var/lib/dpkg/status

It is still having the python issue it looks like

$ python --version
Python 3.8.5
$ python3 --version
Python 3.8.5
$ dpkg -l python
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================================================
rc  python         2.7.17-1     amd64        interactive high-level object-oriented language (Python2 version)
$ dpkg -l python3
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Architecture Description
+++-==============-==============-============-=========================================================================
ii  python3        3.8.2-0ubuntu2 amd64        interactive high-level object-oriented language (default python3 version)
  • What are you getting virtualbox from? I don't see those requirements in the virtualbox 6.1 packaged from Ubuntu 20.04 (focal) https://packages.ubuntu.com/focal-updates/virtualbox https://packages.ubuntu.com/focal-updates/virtualbox Why not use the Ubuntu packaged version? – guiverc Jan 26 '21 at 23:08
  • I am using apt to get virtualbox – mamaluigie Jan 26 '21 at 23:33
  • 1
    Please add apt-cache policy virtualbox to your question. As per first comment, I'd recommend the default Ubuntu packaged version found in repositories, it's tested & you'll have less issues come upgrade time ... It's also 6.1 too, so I don't see why you're opting to add 3rd party repositories. https://help.ubuntu.com/community/Repositories/Ubuntu – guiverc Jan 26 '21 at 23:34
  • I have added the apt-cache policy virtualbox-6.1 to the question @guiverc – mamaluigie Jan 27 '21 at 00:11
  • 3
    eoan refers to Ubuntu 19.10, thus why it has the python2 dependencies. That package won't work on any release from 20.04 on (without a lot of messing about). You should use a source built for Ubuntu 20.04 LTS; I'd still recommend the default repository package (I've had no issues with it). Are you using Ubuntu 20.04? or Ubuntu 19.10 as per your last paste? – guiverc Jan 27 '21 at 00:13
  • FYI: The python2 deps are EOL; refer https://www.python.org/doc/sunset-python-2/ Ubuntu 20.04 LTS means the 2020-April release, which was naturally after 1-Jan-2020 and thus doesn't use the EOL python2. You should not have added packages relating to an EOL release, nor be using the EOL 19.10 release. – guiverc Jan 27 '21 at 00:17
  • How would I just use the default repository package. @guiverc – mamaluigie Jan 27 '21 at 00:18
  • A simple sudo apt install virtualbox will install the Ubuntu repository (assuming 'multiverse' is enabled, see my first comment) version, however you've shown pastes that apply to EOL releases (19.10/eoan). An apt-cache policy virtualbox will show what is available (version wise, if you've added other sources it may add other versions by default with that command, so you'll need to specify version you want). I'm not currently using focal and your pastes don't match rmadison results (known issue if I recall correctly) so won't advise further as your pastes don't match online tools – guiverc Jan 27 '21 at 00:24
  • This is a question and answer site. If you have an answer, post the solution below so that it is helpful to future visitors. Don't add "fixed" or "updates" into the title. The title's purpose is to adequately describe your question in order to identify it among other questions. You can accept a solution if it answers your question. – Nmath Jan 27 '21 at 01:06

1 Answers1

2

Try this...

sudo apt autoremove --purge virtualbox*

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - echo "deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian lsb_release -sc contrib" | sudo tee --append /etc/apt/sources.list.d/virtualbox.list

sudo apt instal virtualbox-6.1

Enterprise
  • 12,352
  • This solution did not work for me. It still gives the same unmet dependencies for python error... – mamaluigie Jan 26 '21 at 23:32
  • 1
    @guiverc, the reason for not using the virtualbox package from the ubuntu repositories has something to do with an issue in kernel 5.8. I'm not an expert here, so I'll point you to this bug for more info: https://bugs.launchpad.net/ubuntu/+source/virtualbox/+bug/1891916 – Enterprise Jan 26 '21 at 23:36
  • @mamaluigie, did you remove virtualbox-6.1 first using sudo apt autoremove --purge virtualbox*? – Enterprise Jan 26 '21 at 23:40
  • @mamaluigie, This looks like an issue with installing python on your machine. Plese edit your question and add the outputs of python --version, dpkg -l python, python3 --version, and dpkg -l python3 to your question. – Enterprise Jan 26 '21 at 23:45
  • Thank you, I've seen the bug; but as I'm not impacted by it (still have 5.4 kernel on my focal boxes) I've not encountered the issue & ignored it. Thanks. (I note that bug has been reported as fix released...) – guiverc Jan 26 '21 at 23:46
  • I had to add symbolic link python -> python2 because I did not have python. In other words I had python2 -> python2.7 and python3 -> python3.8 but nothing for python – nick indiessance May 21 '21 at 22:33