Failed to fetch Debian not fixed my dependencies

#1

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
#2

Thank you for sharing your solution! :slight_smile:

1 Like
#3

@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!

#4

@halfer do you have any idea?

thanks = ))

#5

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
#6

@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

#7

@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:

#8

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…

#9

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.

#10

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

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

#11

@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.

#12

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
#13

Awesome :slight_smile: