Failed to fetch Debian not fixed my dependencies

following solution does not work if my dependencies need the same base library.
To run my RSpec tests I need to install the same gems but if we use the previous solution to change source library it doesn’t support base Debian image. So I used the following solution,

          name: Fix circleci issue with jessie-update binary list on 20180326
          command: |
            cat /dev/null > /etc/apt/sources.list
            echo "deb http://archive.debian.org/debian/ jessie main" | tee -a /etc/apt/sources.list
            apt-get update

Added following line to just remove all other source libraries and keep only jessie main base library.

1 Like

Thank you for sharing your solution! :slight_smile:

1 Like

@kulkarnisourabh

I am trying your solution but end up with

#!/bin/bash -eo pipefail cat /dev/null > /etc/apt/sources.list echo "deb http://archive.debian.org/debian/ jessie main" | tee -a /etc/apt/sources.list sudo apt-get update

/bin/bash: /etc/apt/sources.list: Permission denied Exited with code 1

so seems like i do not have permission to edit /etc/apt/sources.list. did you use your solution as is or did you circumvent the permission-problem i’m having somehow?

thanks in advance!

@halfer do you have any idea?

thanks = ))

trying to use sudo to no avail…

#!/bin/bash -eo pipefail
sudo cat /dev/null > /etc/apt/sources.list
echo "deb http://archive.debian.org/debian/ jessie main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
/bin/bash: /etc/apt/sources.list: Permission denied
Exited with code 1

@gnak are you trying to do with any bash script or have you added this in circleci config.yml file?? will you be able to share your configuration file here ?? Thanks

@gnak my solution is simple just add my step before you use apt-get update in yours .circleci/config.yml file. (correct me if I am wrong) by default cercleci runs all steps with root previledge so no need to use sudo. For better understanding if possible please share your config.yml file. Thanks :slight_smile:

hey @kulkarnisourabh,

thank you for your quick response and help.

i have put it in my .circleci/config.yml, under steps key, like so:

      - run:
          name: Fix circleci issue with jessie-update binary list on 20180326
          command: |
            sudo cat /dev/null > /etc/apt/sources.list
            echo "deb http://archive.debian.org/debian/ jessie main" | sudo tee -a /etc/apt/sources.list
            sudo apt-get update
      - run: sudo apt-get install -y python-dev

which replaces my previous line:
- run: sudo apt-get update && sudo apt-get install -y python-dev

On circleCI I’m on the free trial also if that has any effect…

I don’t think you’ve made it clear whether your change solves your problem. Does this now work, or are you still looking for assistance? :slightly_smiling_face:

It does not have any effect.

Hey Halfer, nice to see you dropping by = ) thanks

sorry, it does not solve my problem. still looking for assistance

@gnak One thing try to remove sudo from all steps and check…if not worked then rerun your job with SSH , SSH to CircleCi container and try to debug permissions to source.list file try if you can use sudo inside container or not also check sudo permissions to /etc/sudoers then you will know root cause. Feel free to reach me. Thanks.

So solved it!

by using script:

      - run:
          name: Fix circleci issue with jessie-update binary list on 20180326
          command: |
            sudo chmod 646 /etc/apt/sources.list
            cat /dev/null > /etc/apt/sources.list
            echo "deb http://archive.debian.org/debian/ jessie main" | tee -a /etc/apt/sources.list

The diff from previous attempts is the line sudo chmod 646 /etc/apt/sources.list.

I solved it by SSHing into the container.
whoami => circleci
I checked ls -la on sources.list. permissions: -rw-r--r--
owner is root
circleci is not in group, so changed permissions to -rw-r--rw-.

1 Like

Awesome :slight_smile: