Hi, Quoting Dima Kogan (2023-11-23 02:54:16) > Hi. I'm seeing a failure that I understand very well, but yet don't know > how to debug or fix. Any suggestions would be appreciated. > > I'm making an Ubuntu/focal image that has a bunch of stuff installed, > and can serve as a base for development. This runs on arm64. There're a > number of ugly external APT repos that have semi-broken packages, but it > should all still work.
damn, my "moon robot stuff needs fixing" alarm clock just woke me up at 3:39 AM in the morning for yet another mmdebstrap bug. Lets go! ;) > This is the same command, but I also make some nvidia packages > available. THAT repo ships its own copy of libopencv-dev: version > 4.5.xxxxx. When building the image I explicitly do NOT want it to pick > up that version, but to use the normal Ubuntu/focal ones: that > restriction in the meta-package should do that for me. There's no reason > this shouldn't work, and I can easily create this situation with some > apt commands after I chroot into the image. But mmdebstrap cannot create > this image: the above command fails: > > The following packages have unmet dependencies: > tst-libopencv : Depends: libopencv-dev (< 4.5) but 4.5.4-8-g3e4c170df4 is > to be installed > E: Unable to correct problems, you have held broken packages. > E: setup failed: E: apt-get -o Dir::Bin::dpkg=env -o > DPkg::Options::=--unset=TMPDIR -o DPkg::Options::=dpkg -o > DPkg::Chroot-Directory=/tmp/mmdebstrap.rIZdCWvgpA --yes install > -oAPT::Status-Fd=<$fd> -oDpkg::Use-Pty=false /tmp/tst-libopencv_1_arm64.deb > ?narrow(?or(?archive(^focal$),?codename(^focal$)),?architecture(arm64),?and(?or(?priority(required),?priority(important)),?not(?essential))) > failed > > Suggestions? If you want to install everything with just a single command (i.e. just use --include with your meta-package instead of using multiple --customize-hooks that run apt install with the right options) then you need to use apt pinning. The reason for that is that apt will only consider candidate versions for installation. It picks candidate versions by choosing the package with the highest pinning priority and in case of a tie, chooses the highest version. So even if you have one package with a Depends: A (< 2) and you have repositories configured with both A (= 1) and A (= 2), apt will only look at A (= 2) and then fail to install the package due to the A (< 2) version restriction. Apt will not look at A (= 1) to satisfy the dependency. This is just a limitation in apt. What I do in another project (incidentally also building arm64 images) is to add this to my mmdebstrap invocation: --setup-hook='{ echo "Package: XXX"; echo "Pin: origin \"YYY\""; echo "Pin-Priority: 1"; } > "$1"/etc/apt/preferences.d/mypinnings.pref' In your case, XXX should probably be libopencv-dev and YYY should be repo.download.nvidia.com. With that being set, libopencv-dev coming from repo.download.nvidia.com will be put to a very low pin priority (1) and thus not get selected by apt. Hope this helps! cheers, josch
signature.asc
Description: signature