Daniel's Blog

Updating Packages with `apt`

Sometimes there is an old system that needs some upgrading so it's time to login and update the packages.

Updating the packages

This will check the remote package managers and update the list of packages from those repositories so a check can be done to see which packages need updating

$ sudo apt-get update

Dealing with obsolete repos

Sometimes this type of error will come up:

Err https://apt.dockerproject.org ubuntu-trusty/main amd64 Packages            
  Could not resolve host: apt.dockerproject.org
Err https://apt.dockerproject.org ubuntu-trusty/main i386 Packages             
  Could not resolve host: apt.dockerproject.org
...
W: Failed to fetch https://apt.dockerproject.org/repo/dists/ubuntu-trusty/main/binary-amd64/Packages  Could not resolve host: apt.dockerproject.org

W: Failed to fetch https://apt.dockerproject.org/repo/dists/ubuntu-trusty/main/binary-i386/Packages  Could not resolve host: apt.dockerproject.org

These errors mean that the remote repository is no longer there. There can be two reasons for this. One the repo was deprecated. I find this with Ubuntu when the LTS is no longer supported and has been moved to the old-releases url. If this happens, the distribution should really be updated as it will not receive security updates.

In this particular case, there is a very old version of docker installed. It isn't used anymore so it's best to uninstall it and remove the custom apt repo.

Removing custom apt repo

$ cd /etc/apt/sources.list.d
$ ls
docker.list  newrelic.list

$ sudo rm docker.list
$ sudo apt-get update

GPG errors

This error was also encountered:

W: GPG error: http://pkg.jenkins-ci.org binary/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FSOMEAGARBAGED5

This machine used to run jenkins, but not anymore. Jenkins was uninstalled, and the sources.list was removed. However the GPG Key was left.

Removing GPG Key from apt

$ cd /etc/apt/trusted.gpg.d
$ sudo rm jenkins.gpg

Uninstalling an old package

Newrelic was once used on this machine, but it isn't anymore. So there is no reason to keep it around.

$ sudo apt-get remove newrelic-sysmond
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  newrelic-sysmond
0 upgraded, 0 newly installed, 1 to remove and 377 not upgraded.
After this operation, 4,858 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 166546 files and directories currently installed.)
Removing newrelic-sysmond (2.3.0.132) ...
Stopping New Relic Server Monitor: newrelic-sysmond OK

Now the sources.list can be removed

$ sudo rm /etc/apt/sources.list.d/newrelic.list

Now the next person won't have to wonder about obsolete packages when working on this machine.

What is the DepCompareOp error?

This error is a warning and it is specific to the version of apt that is in Ubuntu 14.04. Upgrading the distribution should remove this error

W: Ignoring Provides line with DepCompareOp for package gdb-minimal

apt-get upgrade is now running properly so we're done. Next up is to upgrade the distribution to one that is supported.

Upgrading packages mentioned on login

When logging in, this is encountered:

Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-92-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

392 packages can be updated.
0 updates are security updates.

New release '16.04.7 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

*** System restart required ***
Last login: Mon Dec 26 23:51:56 2022 from 10.1.1.230

Doing apt-get upgrade results in 353 packages:

$ apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  gcc-7-base ...
The following packages will be upgraded:
  ant ...
353 upgraded, 0 newly installed, 0 to remove and 24 not upgraded.
Need to get 156 MB/398 MB of archives.
After this operation, 25.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y