Build fails on apt-get update

Hello,
My build is failing on every execution on the “sudo apt-get update” command.
Here is the full output of the failing step:

#!/bin/bash --login
sudo apt-get update

Get:1 http://security.debian.org/debian-security stretch/updates InRelease [53.0 kB]
Ign:2 http://deb.debian.org/debian stretch InRelease
Get:3 http://deb.debian.org/debian stretch-updates InRelease [93.6 kB]
Get:4 http://deb.debian.org/debian stretch-backports InRelease [91.8 kB]
Get:5 http://deb.debian.org/debian stretch Release [118 kB]
Get:6 http://deb.debian.org/debian stretch Release.gpg [2410 B]
Get:7 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [613 kB]
Get:8 http://deb.debian.org/debian stretch-updates/main amd64 Packages.diff/Index [14.9 kB]
Get:9 http://deb.debian.org/debian stretch-updates/main amd64 Packages [2596 B]
Get:10 http://deb.debian.org/debian stretch-backports/main amd64 Packages.diff/Index [28.5 kB]
Get:10 http://deb.debian.org/debian stretch-backports/main amd64 Packages.diff/Index [28.5 kB]
Get:11 http://deb.debian.org/debian stretch-backports/main amd64 Packages [612 kB]
Get:12 http://deb.debian.org/debian stretch/main amd64 Packages [7080 kB]
Reading package lists… Done
E: Could not open file /var/lib/apt/lists/deb.debian.org_debian_dists_stretch-backports_main_binary-amd64_Packages.diff_Index - open (2: No such file or directory)

Exited with code exit status 100

CircleCI received exit code 100

I looked around and found this workaround but I’m confused on what this is supposed to do. Can someone explain to me why this works to solve the issue?

Thank you!!

1 Like

[SOLUTION] The fix is explained here : https://github.com/CircleCI-Public/gcp-cli-orb/issues/5

It seems that the first time apt-get udpate is run, it does fail. So you should run it a second time (don’t ask me why)

To fix your config file, you should find and replace apt-get update by ( sudo apt-get update || sudo apt-get update )

In my config file, I had

      - run:
          name: Install GEOS
          command: |
            sudo apt-get update
            sudo apt-get install libgeos++

I changed it to

  - run:
      name: Install GEOS
      command: |
        ( sudo apt-get update || sudo apt-get update )
        sudo apt-get install libgeos++

It worked for me, hope that helps

Cheers

We’re investigating.

Thanks for reporting. We’ve created a response here.