Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using version pinning and virtual packages results in unsatisfiable constraints #205

Open
allanlei opened this issue Aug 15, 2016 · 11 comments

Comments

@allanlei
Copy link

When using virtual packages in-conjunction with version pinning results in the package not found. I am trying to install gdal-dev which is not in v3.4 but is in edge/testing. If I remove the virtual package, it installs.

Is this possible or bug?

/etc/apk/repositories:

http://dl-cdn.alpinelinux.org/alpine/v3.4/main
http://dl-cdn.alpinelinux.org/alpine/v3.4/community
@edge-testing http://dl-cdn.alpinelinux.org/alpine/edge/testing

Commands:

# apk --no-cache add --virtual .build-deps gdal-dev@edge-testing
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
  gdal-2.1.0-r1:
    masked in: @edge-testing
    satisfies: gdal-dev-2.1.0-r1[gdal] gdal-dev-2.1.0-r1[gdal=2.1.0-r1]
  gdal-dev-2.1.0-r1:
    masked in: @edge-testing
  .build-deps-0:
    masked in: cache
    satisfies: world[.build-deps]

Without virtual packages

# apk --no-cache add gdal-dev@edge-testing
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
(1/9) Installing libgcc (5.3.0-r0)
(2/9) Installing giflib (5.1.4-r1)
(3/9) Installing libjpeg-turbo (1.4.2-r0)
(4/9) Installing libstdc++ (5.3.0-r0)
(5/9) Installing tiff (4.0.6-r3)
(6/9) Installing gdal@edge-testing (2.1.0-r1)
(7/9) Installing pkgconf (0.9.12-r0)
(8/9) Installing pkgconfig (0.25-r1)
(9/9) Installing gdal-dev@edge-testing (2.1.0-r1)
Executing busybox-1.24.2-r9.trigger
OK: 72 MiB in 41 packages
@msnelling
Copy link

I'm seeing the same thing.

@andyshinn
Copy link
Contributor

@ncopa is this an upstream bug?

@kaniini
Copy link

kaniini commented Nov 30, 2016

In general using the edge/testing repo should require using edge/main. edge/testing is similar to Debian's "experimental" repo, which implies that you're running "unstable"... same idea basically.

With that said, it might be a problem in the dependency resolver. It is most certainly an apk-tools bug at any rate, as using --virtual shouldn't cause such a radical change in dependency resolution.

@udondan
Copy link

udondan commented Jul 31, 2017

Still the same with Alpine 3.6

apk add --no-cache --virtual foo gosu@testing=1.9-r0
ERROR: unsatisfiable constraints:
  gosu-1.9-r0:
    masked in: @testing
  foo-0:
    masked in: cache
    satisfies: world[foo]

No problem w/o --virtual foo

@kaniini
Copy link

kaniini commented Jul 31, 2017

I will look into it in apk-tools as time permits.

@raoofm
Copy link

raoofm commented Feb 20, 2018

any update on this?

@kaniini
Copy link

kaniini commented Feb 20, 2018

The problem is that gosu@testing=1.9-r0 is an invalid dependency (because dependencies aren't allowed to be masked, only "world dependencies").

@kaniini
Copy link

kaniini commented Feb 20, 2018

In other words, the problem is that apk does not properly explain that a child dependency cannot be tagged.

Improving apk diagnostics is something I am actively working on at this moment.

@kaniini
Copy link

kaniini commented Feb 20, 2018

I added a diagnostic for this, but pinned child dependencies are explicitly not allowed by the solver for a multitude of reasons.

When you use --virtual what you're doing is creating a package on the fly and then attaching the dependencies to it. If a pinned repo becomes unavailable, or the pinning itself changes later, then the dependency tree will have orphaned nodes and become unsolvable.

This will be in the apk-tools 2.10 release.

@kaniini
Copy link

kaniini commented Feb 20, 2018

Final thoughts:

  • There was an apk-tools bug -- it was attempting to modify the dependency graph with something that was impossible, but the dependency resolution behaviour was working as expected upon closer examination.

  • If you're using masking in a docker container, don't use --virtual. If you need --virtual with a masked package, you're probably thinking about the problem wrongly: consider using version constraints instead.

  • If you are using packages from the testing repo, your base image really needs to be on Alpine edge anyway, so there's not much point in masking. If you mix packages from different Alpine releases, welp, you get to keep both pieces if it breaks.

@seanpianka
Copy link

I've been using --virtual for my build deps, but version pinning an edge package. Then, trying to apk del the virtual was throwing this unsatisfiable constraints error.

@kaniini Your advice to use alpine:edge as my base image solved my issue, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants