在 Ubuntu 20.04.1 LTS 上安装 VirtualBox 的问题

Posted

技术标签:

【中文标题】在 Ubuntu 20.04.1 LTS 上安装 VirtualBox 的问题【英文标题】:Problems with the installation of VirtualBox on Ubuntu 20.04.1 LTS 【发布时间】:2021-04-12 09:41:26 【问题描述】:

只是为了让您知道我在 Linux 方面还是个新手。

我刚刚从 Ubuntu 19.10 跳转到 Ubuntu 20.04.1 LTS,因为我认为 VirtualBox 不会有问题。 升级完成后发现VirtualBox不见了,我尝试按照官网和othersites的说明安装。

我不知道你们究竟需要什么来帮助我解决问题,所以这里有一些信息:

当我执行sudo apt update 时,会出现以下内容:

Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [109 kB]
Hit:4 http://download.virtualbox.org/virtualbox/debian focal InRelease                    
Get:5 http://security.ubuntu.com/ubuntu focal-security/main i386 Packages [169 kB]        
Get:6 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [412 kB]
Get:7 http://security.ubuntu.com/ubuntu focal-security/main Translation-en [93,5 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [724 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal-updates/main i386 Packages [399 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/main Translation-en [180 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [11,4 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal-updates/restricted i386 Packages [13,4 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [110 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/restricted Translation-en [16,5 kB]
Fetched 2 352 kB in 1s (2 345 kB/s)                                 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
10 packages can be upgraded. Run 'apt list --upgradable' to see them.

现在sudo apt install virtualbox virtualbox-ext-pack

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package virtualbox is a virtual package provided by:
  virtualbox-6.1 6.1.16-140961~Ubuntu~eoan
  virtualbox-6.0 6.0.24-139119~Ubuntu~eoan
You should explicitly select one to install.

Package virtualbox-ext-pack 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

E: Package 'virtualbox' has no installation candidate
E: Package 'virtualbox-ext-pack' has no installation candidate

或者当我做sudo apt install virtualbox-6.0 时:

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.0 : Depends: libqt5printsupport5 (>= 5.0.2) but it is not installable
                  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
                  Recommends: gcc but it is not going to be installed
                  Recommends: make but it is not going to be installed or
                              build-essential but it is not going to be installed or
                              dpkg-dev but it is not going to be installed
                  Recommends: binutils but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我做到了

$ wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
$ wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -

echo "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | \
     sudo tee -a /etc/apt/sources.list.d/virtualbox.list

没有任何问题。

我希望每个人都有美好的一天:)

【问题讨论】:

【参考方案1】:

#只需下载一个 debian 文件:

https://download.virtualbox.org/virtualbox/6.1.16/virtualbox-6.1_6.1.16-140961~Ubuntu~eoan_amd64.deb

并安装:

sudo dpkg -i virtualbox-6.1_6.1.16-140961~Ubuntu~eoan_amd64.deb

#If get's Any error

sudo apt install -f

【讨论】:

【参考方案2】:

只需在您的系统中添加一个存储库即可下载 virtualbox 所需的软件包:

deb http://deb.debian.org/debian buster main contrib non-free

然后用命令重新安装:

sudo apt install virtualbox-6.1

它对我有用。

【讨论】:

【参考方案3】:

我是通过以下方式解决的

sudo add-apt-repository 宇宙 sudo add-apt-repository 多元宇宙 sudo add-apt-repository "deb http://download.virtualbox.org/virtualbox/debian 仿生贡献" sudo apt-get 更新

如果在进行 apt-get update 时出现:

N:跳过获取配置文件“contrib/binary-i386/Packages”作为存储库“http://download.virtualbox.org/virtualbox/debian bionic InRelease”不支持架构“i386”

然后:

echo "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" | sudo tee /etc/apt/sources.list

继续: sudo apt-get 更新 sudo apt-get 升级 sudo apt-get install libpng16-16 libqt5core5a libqt5printsupport5 libqt5widgets5 libqt5x11extras5 sudo apt-get install virtualbox-6.0

【讨论】:

以上是关于在 Ubuntu 20.04.1 LTS 上安装 VirtualBox 的问题的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu 20.04 基础设置分享

在 ubuntu 20.04LTS 上安装 pygame 的问题

我应该如何在 Ubuntu 20.04 LTS 上安装 Django

在 Ubuntu 14.04 LTS 上安装 Navicat

在 Ubuntu 20.04 LTS(Vmware)上安装 docker 失败

在Ubuntu18.04.2LTS上安装电子书软件