Install zip unzip

Hi,

I have a weird issue installing zip unzip.
This is a short version of my ci.yml

before_script:

  • apt-get update -y
    stages:
  • build
    build_site:
    image: tetraweb/php
    stage: build
    script:
    • apt-get install zip unzip

Sometimes, after apt-get install zip unzip I get this message:

Reading package lists…
Building dependency tree…
Reading state information…
Package zip is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package ‘zip’ has no installation candidate
ERROR: Job failed: exit code 1

This is an erratic error. Not always happens. Usually the error happens in the first try. Then, I click retry and it runs properly after. Any ideas?

Thanks

2 Likes

Hi,

I’m having the same problem. Have you found any solution?

@damiarita Where you able to resolve this? I am running into the same issue.

I am sorry. I never managed to solve it.

I found an image that had the software I needed installed. I insalled zip to unzip the installer of the software. Now, my image has it directly. You can search images at https://hub.docker.com/

I’m seeing this problem as well.

The following code fails sometimes:

image: tetraweb/php

before_script:
  - apt-get update
  - apt-get install zip unzip

Couldn’t find a pattern to the problem. Using shared runners.

The tetraweb/php docker image is referenced in the official documentation.

Hello, the install step needs the option -y, otherwise you would get a prompt only if zip is not installed already. And you better „export DEBIAN_FRONTEND= noninteractive“ as well beforehand.

Hi,

this seemed to help me:

Unfortunately in german. The englisch summary:
add rm /etc/apt/sources.list.d/additional.list before the installation of the packages, as it sometimes uses the source from this file. And if it does, it fails.

I am using this image: tetraweb/php:7.1

Hi Guys
Following up on this topic as I also came upon a random failure to install zip and unzip when building AMIs on AWS using Packer.

The final solution was to blow away the lists as suggested, then update and then rebuild the caches before the installation

sudo rm -rf /var/lib/apt/lists/*
sudo apt-get update
sudo apt-cache gencaches
sudo apt-get install -y zip unzip

This seems to have fixed the problem (4 consecutive runs with no issue). I suspect some corruption on the ubuntu 18.04 AMI from Canonical.

Hope that helps someone,
regards
Ian Carson