Skip to content

Instantly share code, notes, and snippets.

@trastle
Last active February 7, 2022 13:46
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save trastle/5722089 to your computer and use it in GitHub Desktop.
Save trastle/5722089 to your computer and use it in GitHub Desktop.
Fixing the issue with apt caused by a bad local proxy: -1- Create 99fixbadproxy at: /etc/apt/apt.conf.d/99fixbadproxy -2- Run clear.sh
Acquire::http::Pipeline-Depth "0";
Acquire::http::No-Cache=True;
Acquire::BrokenProxy=true;
#!/bin/bash
sudo rm /var/lib/apt/lists/*
sudo rm /var/lib/apt/lists/partial/*
sudo apt-get update
@rgautam98
Copy link

Can you explain the use and the terms in 99fixbadproxy

@ax3l
Copy link

ax3l commented Jun 14, 2017

(Not an answer to the question above, just a backlink)
Relates SO question: https://askubuntu.com/questions/679233/failed-to-fetch-hash-sum-mismatch-tried-rm-apt-list-but-didnt-work

@ben-oldcom
Copy link

this helped me to work around a apt-get install issue about error "Hash Sum MIsmatch" in docker.

@so-jelly
Copy link

Also can set options at runtime:
apt-get -o Acquire::BrokenProxy="true" -o Acquire::http::No-Cache="true" -o Acquire::http::Pipeline-Depth="0"

@valvesss
Copy link

Fucking life saver!! Tks a lot @trastle !!

@a14stoner
Copy link

a14stoner commented Mar 17, 2021

@so-jelly THANKS!!! that helped

@ostanislaw
Copy link

ostanislaw commented Apr 21, 2021

Thanks @trastle and @so-jelly I'm also behind some company proxy and this workaround was helpful for me ("Hash sum mismatch")
In case any need it to formatted for dockerfile too:

     ARG DEBIAN_FRONTEND=noninteractive
     RUN apt-get update \
        -o Acquire::http::No-Cache=true \
        -o Acquire::http::Pipeline-Depth=0 \
        -o Acquire::BrokenProxy=true \
         && apt-get install -y --no-install-recommends \
         package1 \
         package2 \
         package3 \
         && rm -rf /var/lib/apt/lists/*

@ostanislaw
Copy link

ostanislaw commented Apr 21, 2021

Thanks @trastle and @so-jelly I'm also behind some company proxy and this workaround was helpful for me ("Hash sum mismatch")
In case any need it to formatted for dockerfile too:

     ARG DEBIAN_FRONTEND=noninteractive
     RUN apt-get update \
        -o Acquire::http::No-Cache=true \
        -o Acquire::http::Pipeline-Depth=0 \
        -o Acquire::BrokenProxy=true \
         && apt-get install -y --no-install-recommends \
         package1 \
         package2 \
         package3 \
         && rm -rf /var/lib/apt/lists/*

Now also failures with fetching packages
E: Failed to fetch http://******/main/f/fonts-dejavu/fonts-dejavu-core_2.35-1_all.deb Hash Sum mismatch
E: Failed to fetch http://******main/u/ucf/ucf_3.0036_all.deb Hash Sum mismatch
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

I'll try again with the same options for install
EDIT: it solved the issue

     ARG DEBIAN_FRONTEND=noninteractive
     RUN apt-get update \
        -o Acquire::http::No-Cache=true \
        -o Acquire::http::Pipeline-Depth=0 \
        -o Acquire::BrokenProxy=true \
         && apt-get install -y --no-install-recommends \
        -o Acquire::http::No-Cache=true \
        -o Acquire::http::Pipeline-Depth=0 \
        -o Acquire::BrokenProxy=true \
         package1 \
         package2 \
         package3 \
         && rm -rf /var/lib/apt/lists/*

@ostanislaw
Copy link

another backlink:
https://askubuntu.com/a/809808

@nautikk
Copy link

nautikk commented Jul 19, 2021

Can you explain the use and the terms in 99fixbadproxy

Inside Dockerfile add this

RUN touch /etc/apt/apt.conf.d/99fixbadproxy

RUN echo "Acquire::http::Pipeline-Depth 0;Acquire::http::No-Cache true;Acquire::BrokenProxy true;" >> /etc/apt/apt.conf.d/99fixbadproxy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment