为什么我无法在未改动过的 Ubuntu 21.04 上安装 apt-file?

为什么我无法在未改动过的 Ubuntu 21.04 上安装 apt-file?

我刚刚创建了一个 Ubuntu 21.04 USB 拇指驱动器并以 Live/Try 模式启动它。

我打开一个终端并sudo apt update运行sudo apt-get install apt-file

ubuntu@ubuntu:~$ sudo apt update
Ign:1 cdrom://Ubuntu 21.04 _Hirsute Hippo_ - Release amd64 (20210420) hirsute InRelease
Hit:2 cdrom://Ubuntu 21.04 _Hirsute Hippo_ - Release amd64 (20210420) hirsute Release
Hit:4 http://archive.ubuntu.com/ubuntu hirsute InRelease                   
Get:5 http://archive.ubuntu.com/ubuntu hirsute-updates InRelease [109 kB]  
Get:6 http://security.ubuntu.com/ubuntu hirsute-security InRelease [101 kB]
Fetched 209 kB in 1s (286 kB/s)                                     
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
280 packages can be upgraded. Run 'apt list --upgradable' to see them.
ubuntu@ubuntu:~$ sudo apt-get install apt-file
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package apt-file 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 'apt-file' has no installation candidate

但正如你所见,它失败了。

所以我检查了apt-cache一下应该确实可用:

ubuntu@ubuntu:~$ apt-cache dump | grep apt-file
Package: apt-file
  Depends: apt-file (null)

然后我检查它是否已经安装:

ubuntu@ubuntu:~$ which apt-file
ubuntu@ubuntu:~$

但事实并非如此...

然后我查看了在线数据库:https://packages.ubuntu.com/hirsute/apt-file
再次应该到達。

然后,我试着安装另一个软件包,只是为了好玩。sudo apt-get install ncdu,但我得到了同样的错误...然后我尝试安装sudo apt-get install vim并且成功了!但我仍然无法安装其他软件包。

这里发生了什么?

答案1

您提供的链接

https://packages.ubuntu.com/hirsute/apt-file

应该已经提醒你了,它清楚地告诉你这是一个社区包(例如在'宇宙') 虽然它在各个风格(即来自社区的发行版)中默认启用,但它需要对 Ubuntu 进行特定的启用。

sudo add-apt-repository universe

如果你的版本是 LTS 版本,Ubuntu ISO 上提供的软件包将获得 5 年的支持,而“universe”中的软件包则没有 5 年的支持(例如,对于 18.04,许多味道软件包是 LTS,这意味着 3 年的支持,而其他软件包不是LTS 意味着他们只有 9 个月的支持;例如。Lubuntu 下一步[LXQt] 或 Ubuntu Studio 18.04不是LTS 产品)。通过默认不启用“universe”,您知道所有软件包在产品安装的整个生命周期内都受到支持。

一旦启用“universe”,您将能够安装“universe”中社区支持的软件包

欲了解更多详情,请参阅https://help.ubuntu.com/community/Repositories/Ubuntu

相关内容