Slow downloads from

Since a few days, downloading ppa packages during the build is really slow.

--2018-11-16 02:02:30--
Resolving (
Connecting to (||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 211820884 (202M) [application/x-debian-package]
Saving to: ‘openjdk-11-dbg_11~24-1~14.04.2_amd64.deb’

 0% [                                               ] 2,115,923    239KB/s  eta 11m 52s^C


This is what I’ve done to keep a cache of all the required apt packages (rsync is required since restore_cache on root-owned folders won’t work with machine executor), so that only the first build will be slow fetching package. Cache key needs to be manually incremented when new deb versions will be released. Sed command is just an optimization for switching from the main ubuntu mirror that is kinda slow everytime, so it’s better to switch to another mirror anyway.

    description: "Install openjdk 11 from ppa"
      - run: mkdir /tmp/archives
      - restore_cache:
          - apt-v2
      - run: sudo rsync -av /tmp/archives/ /var/cache/apt/archives/
      - run: sudo sed -i 's/' /etc/apt/sources.list
      - run:
          name: Install java 11
          command: |
            sudo add-apt-repository ppa:openjdk-r/ppa
            sudo apt update -q
            sudo apt install -qy openjdk-11-jdk
      - run: rsync -av /var/cache/apt/archives/*.deb /tmp/archives/
      - save_cache:
          key: apt-v2
          - /tmp/archives

Would you summarise for readers what your script does? Does it essentially use a different distribution URL instead of the one you’re having a problem with?

updated original post :grinning: thanks.

1 Like