4

I just created an Ubuntu 21.04 USB thumb drive and booted it in Live/Try mode.

I opened a terminal and ran sudo apt update and 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

But as you can see it fails.

So I check the apt-cache and it should indeed be available:

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

Then I checked if it was already installed:

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

But nope...

Then I checked the online database: https://packages.ubuntu.com/hirsute/apt-file
And again it should be there.

Then I tried, just for fun, to install a different package. sudo apt-get install ncdu, but I got the same error... Then I tried to install sudo apt-get install vim and that worked! But I still can't install the other packages.

What is going on here?

Dan
  • 13,119
Forivin
  • 358
  • The link you provided (https://packages.ubuntu.com/hirsute/apt-file) should have tipped you off - it clearly tells you it's a community package (ie. found in 'universe') which is enabled by default in flavors (ie. distributions from the community) but requires a specific enable for Ubuntu. – guiverc Aug 25 '21 at 11:16
  • Thanks @Dan, i wrote up my 'comment', at least how I see it (which is still really as duplicate... but based on your comments so thank you). – guiverc Aug 25 '21 at 11:34

1 Answers1

7

The link you provided

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

should have tipped you off, it clearly tells you it's a community package in bold (ie. found in 'universe') which whilst enabled by default in flavors (ie. distributions from the community), it requires a specific enable for Ubuntu.

sudo add-apt-repository universe

If your release is a LTS release, packages provided on the Ubuntu ISO have support for 5 years, where as packages found in 'universe' do not have the 5 year support (eg. for 18.04 many flavor packages were LTS which means 3 years of support, whilst others were not LTS meaning they only had 9 months of support; eg. Lubuntu Next [LXQt] or Ubuntu Studio 18.04 were not LTS products). By not having 'universe' enabled by default, you know all packages are supported the entire life of your product's install.

Once 'universe' is enabled, you'll be able to install community supported packages found in 'universe'

For more details, please see https://help.ubuntu.com/community/Repositories/Ubuntu

guiverc
  • 30,396
  • In case people don't remember details like Ubuntu Studio 18.04 was not a LTS; I'll provide https://fridge.ubuntu.com/2018/04/27/ubuntu-18-04-lts-bionic-beaver-released/ which states "Maintenance updates will be provided for 5 years for Ubuntu Desktop, Ubuntu Server, Ubuntu Cloud, and Ubuntu Core. Ubuntu Studio will be supported for 9 months. All the remaining flavours will be supported for 3 years." (Lubuntu Next isn't mentioned as it wasn't an official ISO with Lubuntu still using LXDE with 18.04 which was a LTS) – guiverc Aug 25 '21 at 11:41