Hi,
Quoting Dima Kogan (2023-12-01 05:11:19)
> Johannes Schauer Marin Rodrigues <
jo...@debian.org> writes:
> >> Would that work, though?
> > Yes. Did you try it and it did not work? What was the error message?
>
> No :) I wanted to read about what it did first. I tried it just now,
> though. With the --included metapackage it has the same behavior as
> before: complains that it can't install libopencv-dev.
yes, which is why I said not to use --include when trying this.
> If I don't ask it to --install the problematic package, intending to
> manually poke apt, then I can't do that: the problematic package is
> nowhere to be found. It was originally on disk locally, but without
> --include, it was never copied into the bind mount.
Sure, you just have to do that yourself.
> I do want to have a metapackage: this allows the metapackage to be updated in
> the future, and have users be able to "apt update && apt upgrade".
Yes, I think you should keep the metapackage.
> I guess I could do this differently for testing. By making the metapackage
> available in an apt server, and using an undocumented option. That's a heavy
> lift though. If I was so expert to know to do these things, I probably
> wouldn't need to debug stuff in the first place
You don't need to use an undocumented option. Running
--chrooted-customize-hook=bash is nearly the same as running
--customize-hook='chroot "$1" bash' but the latter is much harder to type due
to quoting and special chars so I suggested to do the former. But nothing stops
you from sticking to the documented methods.
> > Yes, in the man page of apt_preferences it says: "The files have either no
> > or "pref" as filename extension". In one of my last mails to you I also
> > suggested you add:
> >
> > --setup-hook='{ echo "Package: XXX"; echo "Pin: origin \"YYY\""; echo
> > "Pin-Priority: 1"; } > "$1"/etc/apt/preferences.d/mypinnings.pref'
> >
> > Notice that I used the correct filename extension.
>
> Yep. I liked my extension better, but didn't realize that the name was
> significant.
Maybe only try out different things *after* you have it working? ;)
> > Which apt command produced the error? I also don't think it was an error.
> > It was only a warning, right? Did you get it for "apt-get update" or for
> > "apt-get install"?
>
> Great questions. I just tried it again:
>
> $ sudo apt update
>
> ....
> N: Ignoring file 'mypinnings.conf' in directory '/etc/apt/preferences.d/' as it has an invalid filename extension
>
> So I don't know what the answer is.
By default, mmdebstrap does not print the output of the commands it runs. It
does that though when something goes wrong. So if "apt install" fails, then you
get its output. In your case, you missed a "note" (not even a warning) in the
"apt update" output. You would've seen that if you had run mmdebstrap with the
--verbose option.
> But this felt undebuggable, and I wish I could figure this stuff without
> sinking many hours into it or asking you every time.
I still wonder what we can learn from all of this.
You initially suggested mmdebstrap to drop down to a shell and print a command
for the user to re-run. Lets assume that this were possible (I don't think it
is feasible). In that case, you still would not've known how to proceed or that
it is the apt pinning that is at fault. If you had known that it was apt
pinning (as we know now), then you could've just added this to your mmdebstrap
invocation to debug this:
--essential-hook='chroot "$1" apt-cache policy libopencv-dev'
But even if you had and you had seen that the pin priority was wrong, how could
you have proceeded? At that point (and before installing
tst-libopencv_1_arm64.deb via --include) you could've given yourself an
interactive shell by adding (and lets stick to the documented options this
time):
--essential-hook='chroot "$1" bash'
You could've then maybe figured out what was going on as you can then make
changes and run "apt-cache policy" until it looks good. But maybe you wouldn't
have know it because you still would not've seen the apt "note" from above
about the filename extension because even though you encountered an error, you
did not run mmdebstrap with --verbose and I think it is common practice to
increase the verbosity of a program first when something goes wrong.
So given all of this, I don't think your initial suggestion of adding a
facility to drop to a shell and re-run a command in shell would've fixed your
problem. It would not've given you the additional knowledge that apt pinning is
at fault, you still would have to do the bind-mount yourself manually (or would
you expect that bind mounting to be translated into a shell command as well?)
and you still would not've seen that apt "note" about your preferences file
name.
So I'm at a loss at what to take away from this situation for mmdebstrap.
I have no problem helping you with this and it doesn't bother me but I also
don't see anything that is to be learned from all of this.
Thanks!
cheers, josch