Apt install on machine image results in "Some packages could not be installed"


#1

Hello,
I’m updating my project to migrate from circle 1 to 2.0
I use a simple machine: true and I noticed that a script that used to work fine, no longer works.
specifically, the command sudo apt-get install rpm now returns this error:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 rpm : Depends: librpm3 (>= 4.10.0) but it is not going to be installed
       Depends: librpmbuild3 (>= 4.10.0) but it is not going to be installed
       Depends: librpmio3 (>= 4.10.0) but it is not going to be installed
       Depends: librpmsign1 (>= 4.10.0) but it is not going to be installed
       Depends: rpm2cpio but it is not going to be installed
       Depends: debugedit (= 4.11.1-3ubuntu0.1) but it is not going to be installed
       Depends: rpm-common (= 4.11.1-3ubuntu0.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I can work around it by running sudo apt-get update first, but thought you should know.


#2

You should always run apt-get update before installing new packages.


#3

interesting. is that because the apt cache database is cleared or something? on circleci1.0 installing packages worked out of the box.


#4

I think thats circumstantial depending on the package. apt-get update is a best practice IMHO.


#5

Also, if you are installing a lot of packages, I would suggest making your own docker image so you don’t have to do it each time as a part of the build.


#6

to clarify, it’s the exact same script, exact same packages. only difference is circle 1.0 to 2.0 upgrade
also it’s a machine image, while i’ld like to cache more in the image rather then redo the installation on each run, it looks like i can’t do this with machine images.


#7