I have difficulties when install postgresql-client.9.4 on debian 10.

printf "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" > /etc/apt/sources.list.d/pgdg.list

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -

apt-get update && apt-get install -y -qq postgresql-client-9.4


oot@8854c7bad7ae:/# apt-get update
Hit:1 http://security-cdn.debian.org/debian-security buster/updates InRelease
Hit:2 http://cdn-fastly.deb.debian.org/debian buster InRelease
Hit:3 http://cdn-fastly.deb.debian.org/debian buster-updates InRelease
Get:4 http://apt.postgresql.org/pub/repos/apt buster-pgdg InRelease [46.2 kB]
Get:5 http://apt.postgresql.org/pub/repos/apt buster-pgdg/main amd64 Packages [138 kB]
Err:5 http://apt.postgresql.org/pub/repos/apt buster-pgdg/main amd64 Packages
  File has unexpected size (137678 != 138126). Mirror sync in progress? [IP: 80]
  Hashes of expected file:
   - Filesize:138126 [weak]
   - SHA256:8a5dec4b72ef7e16bb0336a385f5072cb4092d5a935ada6095b5c971a9d3420a
   - SHA1:9d30afef3e3590e5adadabd04845fd547f5f88f7 [weak]
   - MD5Sum:ed36fcbcb7d390b2772bc81a12cf786b [weak]
  Release file created at: Mon, 23 Sep 2019 14:11:10 +0000
Fetched 46.2 kB in 3s (15.7 kB/s)

How to fix this error?

  • Note, it's a little risky doing a printf "deb ..." to append to a text file, not just because it will break if the string contains markers like %d, but because it doesn't append a linebreak. If someone tries to append anything else to the file, it will end up being run onto the end of your line. Something like printf '\n%s\n' 'deb ...' would be safer.
    – mwfearnley
    Jun 26 at 15:53

6 Answers 6


Well, you may have actually hit it while the remote mirror was synching... in which case, waiting an hour or so, running apt-get clean (or apt clean) and then re-running the original apt-get update (or apt update).

If the error persists, you may want to notify the mirror provider if you can find a contact address, and then simply point your sources.list to a different mirror.


Helping a student university which was trying to run a simple apt-get update on an ubuntu docker container running on MacOS which was facing the same issue I ended up later finding that this issue was caused by "Screen Time", which is a MacOS Parental Control system, which apparently was blocking "certain" requests to the ubuntu repositories but not all.

Since the "firewall" had some restrictions for "adult sites", at some point when it was trying to fetch a hash from the repo, it would get a "blocked" HTML response from Screen Time on the host. This was especially interesting to me since I didn't think with the whole MacOS VM-based Docker subsystem, the HTTP networking within the container within the VM was subject to control by the host system :\

  • 4
    Yes, this was the problem for me. I went to System Preferences > Screen Time and toggled to Web Content: Unrestricted Access. May 21, 2021 at 17:33

If you are using MacOS to run this virtual machine, the solution to this problem is going to "Screen Time" setting and change the settings to "Unrestricted web access".


This error can also happen when you have the wrong DNS in your /etc/resolv.conf. In my case, Mirror sync error the first few times I tried to use apt. Then it switched to 'NOSPLIT' error.

Salis answered this problem on askubuntu.com. I made the change in my resolv.conf and the errors were solved.


Running below command fixed the issue instantly -

sudo apt update -oAcquire::AllowInsecureRepositories=true
  • 2
    Not a great idea if you care about security at all...
    – Moox
    Apr 27, 2022 at 17:37

When doing this:

sudo apt-get udpate
sudo apt-get upgrade

I ended up with several "Failed to fetch " lines. My workaround is thus:

mkdir cache
cd cache
sudo apt-get upgrade -y 2>&1 | grep "Failed to fetch " | awk '{print $5}' | xargs -i{} wget {}

sudo dpkg -i *.deb
sudo apt --fix-broken install
sudo apt-get upgrade -y

It my case it looks like my 'apt-cacher-ng' failed to download / cache some packages properly.

  • 2
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jun 3, 2022 at 6:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .