Random 404 when doing `apt-get install postgresql-client`

postgresql
#1

In my config I am using postgresql:

version: 2
references:
  container_config: &container_config
    docker:
      - image: circleci/postgres:9.6-alpine-ram

#...

  install_dependencies: &install_dependencies
    run:
      name: Installing Dependencies
      command: |
        sudo apt-get install postgresql-client

And since yesterday (at least) jobs are randomly failing with:

#!/bin/bash -eo pipefail
sudo apt-get install postgresql-client
Reading package lists... Done


Building dependency tree       


Reading state information... Done

The following additional packages will be installed:
  postgresql-client-9.6 postgresql-client-common
Suggested packages:
  postgresql-9.6 postgresql-doc-9.6
The following NEW packages will be installed:
  postgresql-client postgresql-client-9.6 postgresql-client-common
0 upgraded, 3 newly installed, 0 to remove and 2 not upgraded.
Need to get 1416 kB of archives.
After this operation, 6001 kB of additional disk space will be used.

Get:1 http://deb.debian.org/debian stretch/main amd64 postgresql-client-common all 181+deb9u2 [79.2 kB]

Err:2 http://deb.debian.org/debian stretch/main amd64 postgresql-client-9.6 amd64 9.6.11-0+deb9u1
  404  Not Found

Get:3 http://deb.debian.org/debian stretch/main amd64 postgresql-client all 9.6+181+deb9u2 [55.8 kB]

Fetched 135 kB in 0s (1029 kB/s)
E: Failed to fetch http://deb.debian.org/debian/pool/main/p/postgresql-9.6/postgresql-client-9.6_9.6.11-0+deb9u1_amd64.deb  404  Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Exited with code 100

Anyone noticing similar things? Any ideas on what can be the cause and that could be a fix?
Note: nothing has changed in this circleci yml for weeks…

#2

Added a sudo apt-get update before the installation of postgresql-client and so far we are no longer seeing randomly failing jobs.

2 Likes
#3

This behaviour is expected. The parent image will have been built without the Apt cache being written to the disk, or perhaps it has one but it is out of date. An update of the available software is always a good idea to refresh this to the latest state before doing any installs.

1 Like
closed #4

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.