Hi Dima, qick top post as I'm about to head out for work and I don't have access to my Debian mail there. I'll write you a more complete reply in ~12 hours when I'm back.
Until then, the short answer is: you cannot re-run that apt-get in a shell because of the file descriptors that are passed, the pseudo terminal setup, proc handling, /dev/ptmx setup etc. This is also why it's not so easy (or even possible?) to copypaste the command and run it in a shell. A lot of things that mmdebstrap does are not possible (I think) in a shell because a careful dance of foreground and background processes talking with each other over pipes is constructed in many cases. It is possible to run the command you attempted to run from a shell but the command will be a bit different and thus it will not do exactly the same thing. What I would try in your situation is to not list the packages you want to install via --include but instead run mmdebstrap like this: mmdebstrap ... --variant=apt --chrooted-customize-hook=bash unstable /dev/null This will give you a shell inside a minimal chroot and from there you can mess around with apt pinning and run arbitrary apt-get install commands. Once you are happy, try to copy what you did in the shell interactively into --include options and --hooks. Hope that helps! cheers, josch Quoting Dima Kogan (2023-11-28 00:02:43) > Hi. I tried to do that apt pinning today, as you suggested. It still > fails in the same way as before: > > $ mmdebstrap .... > .... > I: installing remaining packages inside the chroot... > .... > 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: > ros-noetic-cv-bridge : Depends: libopencv-dev but it is not installable > ros-noetic-grid-map-filters : Depends: libopencv-dev but it is not > installable > ros-noetic-image-geometry : Depends: libopencv-dev but it is not > installable > E: Unable to correct problems, you have held broken packages. > > The preferences file is there, but it isn't obviously doing anything. I > did some debugging just now to try to figure out why, and I'm reminded > of > > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1036929 > > Ideally the workflow I would like is > > 1. mmdebstrap does stuff. When it runs a command, it prints out EXACTLY > what it does, in a way that I can copy/paste it, and get the same > output > > 2. If it fails to do something, it drops me into a shell. Where I can paste > the command to reproduce the problem, and then poke around to fix it > > This probably isn't 100% possible here; but how would you debug this > otherwise? > > I'm attaching a patch that does some of (1.) above. This uses > String::ShellQuote to quote all the arguments so that the command string > can be pasted. I'm guessing you'd want to do some of that differently, > so it isn't super thorough. > > OK. Then I gave myself a shell in a spot that (I think?) sits right > before the failing "apt-get install": > > mmdebstrap \ > --essential-hook 'echo $$1; bash -i' \ > .... > > And pasting the command didn't work as I had hoped: > > root@fatty:# apt-get -o Dir::Bin::dpkg=env -o > DPkg::Options::=--unset=TMPDIR -o DPkg::Options::=dpkg -o > DPkg::Chroot-Directory=/tmp/mmdebstrap.i1wpW0WLMS --yes install > -oDpkg::Use-Pty=false tst-libopoencv > '?narrow(?or(?archive(^focal$),?codename(^focal$)),?architecture(arm64),?and(?or(?priority(required),?priority(important)),?not(?essential)))' > > E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: > Permission denied) > E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), > are you root? > > Any idea what the difference is? Here I'm running the external > "apt-get". Is the "apt-get install" supposed to happen inside the > chroot? There is no "apt-get" binary there yet. > > If I can quickly and repeatedly reproduce the failure, I can "apt-cache > policy libopencv-dev", and I can see if it's trying to use the > preferences file and such. Maybe I mistyped something. > > If the above diagnostic sequence cannot work, what would? > > Thanks much >
signature.asc
Description: signature