1

Having an issue with a server. I wanted to upgrade NGINX to a newer release, but whatever I try, I get

?E: Package 'nginx' has no installation candidate

I first tried sudo apt-get update && sudo apt-get upgrade

sudo apt-get update
Hit:1 https://deb.nodesource.com/node_14.x focal InRelease
Hit:2 http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:4 http://archive.canonical.com/ubuntu focal InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-security InRelease
Hit:6 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Get:7 https://packages.amplify.nginx.com/ubuntu focal InRelease [3818 B]
Hit:8 http://archive.ubuntu.com/ubuntu focal-proposed InRelease
Hit:9 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Get:10 https://packages.amplify.nginx.com/ubuntu focal/amplify-agent amd64 Packages [557 B]
Fetched 4375 B in 1s (3977 B/s)
Reading package lists... Done

sudo apt-get upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

dpkg --get-selections | grep hold doesn't return anything so these packages aren't held

I checked /var/log/unattended-upgrades/unattended-upgrades.log and I see

2020-07-04 06:31:38,584 INFO Starting unattended upgrades script
2020-07-04 06:31:38,585 INFO Allowed origins are: o=Ubuntu,a=focal, o=Ubuntu,a=focal-security, o=UbuntuESMApps,a=focal-apps-security, o=UbuntuESM,a=focal-infra-security, o=UbuntuESM,a=focal-security
2020-07-04 06:31:38,585 INFO Initial blacklist:
2020-07-04 06:31:38,585 INFO Initial whitelist (not strict):
2020-07-04 06:31:39,944 INFO No packages found that can be upgraded unattended and no pending auto-removals
2020-07-04 06:31:40,074 INFO Package nginx is kept back because a related package is kept back or due to local apt_preferences(5).
2020-07-04 06:39:52,369 INFO Starting unattended upgrades script
2020-07-04 06:39:52,370 INFO Allowed origins are: o=Ubuntu,a=focal, o=Ubuntu,a=focal-security, o=UbuntuESMApps,a=focal-apps-security, o=UbuntuESM,a=focal-infra-security, o=UbuntuESM,a=focal-security
2020-07-04 06:39:52,370 INFO Initial blacklist:
2020-07-04 06:39:52,375 INFO Initial whitelist (not strict):

OK thinks I, this is a simple fix

sudo apt-get install nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package nginx is a virtual package provided by:
  nginx-light 1.18.0-0ubuntu1 [Not candidate version]
  nginx-full 1.18.0-0ubuntu1 [Not candidate version]
  nginx-extras 1.18.0-0ubuntu1 [Not candidate version]
  nginx-core 1.18.0-0ubuntu1 [Not candidate version]
  nginx-light 1.17.10-0ubuntu1 [Not candidate version]
  nginx-full 1.17.10-0ubuntu1 [Not candidate version]
  nginx-extras 1.17.10-0ubuntu1 [Not candidate version]
  nginx-core 1.17.10-0ubuntu1 [Not candidate version]

E: Package 'nginx' has no installation candidate

So I ran sudo apt-cache policy nginx and got back

nginx:
  Installed: 1.17.2-1-ppa7~bionic
  Candidate: (none)
  Version table:
     1.18.0-0ubuntu1 -1
        500 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
     1.17.10-0ubuntu1 -1
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages
 *** 1.17.2-1-ppa7~bionic -1
        100 /var/lib/dpkg/status

I checked /etc/apt/sources.list and all looks ok in there...

###### Ubuntu Main Repos
deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
Ubuntu Update Repos

deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ focal-proposed main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse

Ubuntu Partner Repo

deb http://archive.canonical.com/ubuntu focal partner deb-src http://archive.canonical.com/ubuntu focal partner

Ubuntu Extras Repo

deb http://apt.postgresql.org/pub/repos/apt focal-pgdg main

I tried setting up a /etc/apt/sources.list.d/nginx.list with

deb http://nginx.org/packages/mainline/ubuntu/ focal nginx 
deb-src http://nginx.org/packages/mainline/ubuntu/ focal nginx

but that didnt work either. So I tried to uninstall and purge nginx-* ( so it included common etc ) but now I cannot install nginx at all because it still says there is no install candidate.

 sudo apt-get install nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package nginx is a virtual package provided by:
  nginx-light 1.18.0-0ubuntu1 [Not candidate version]
  nginx-full 1.18.0-0ubuntu1 [Not candidate version]
  nginx-extras 1.18.0-0ubuntu1 [Not candidate version]
  nginx-core 1.18.0-0ubuntu1 [Not candidate version]
  nginx-light 1.17.10-0ubuntu1 [Not candidate version]
  nginx-full 1.17.10-0ubuntu1 [Not candidate version]
  nginx-extras 1.17.10-0ubuntu1 [Not candidate version]
  nginx-core 1.17.10-0ubuntu1 [Not candidate version]

E: Package 'nginx' has no installation candidate

Oops! Help please!

Greg
  • 121

1 Answers1

0

I faced a similar problem a few days back, this happens when APT is not able to identify the package you are trying to install, try going to Ubuntu Software & Updates and ensure that you are downloading from the main-server and also try:

 sudo apt-get -y --allow-unauthenticated install nginx
  • sudo apt-get -y --allow-unauthenticated install nginx returns
    Package nginx is a virtual package provided by:
      nginx-light 1.18.0-0ubuntu1 [Not candidate version]
      nginx-full 1.18.0-0ubuntu1 [Not candidate version]
      nginx-extras 1.18.0-0ubuntu1 [Not candidate version]
      nginx-core 1.18.0-0ubuntu1 [Not candidate version]
      nginx-light 1.17.10-0ubuntu1 [Not candidate version]
      nginx-full 1.17.10-0ubuntu1 [Not candidate version]
      nginx-extras 1.17.10-0ubuntu1 [Not candidate version]
      nginx-core 1.17.10-0ubuntu1 [Not candidate version]
    

    ie its not a candidate versn

    – Greg Jul 05 '20 at 00:41