Hi,

Quoting Michael Prokop (2023-06-14 17:19:37)
> since version 1.20.0, dpkg no longer creates /var/lib/dpkg/available (see
> #647911).

I see that the bug talks about 1.20.0 but I've had code creating
/var/lib/dpkg/available in mmdebstrap for a while and determined that it wasn't
necessary anymore since dpkg 1.17.11. Did you do practical tests or are you
only basing your analysis on that bug?

I'm quite certain about the version requirement because I did tests using
debbisect and using the suggestion below I'm able to create chroots for all of
unstable since 2006-08-10.

> But on Debian releases until and including buster, dpkg fails to operate with
> e.g. `dpkg --set-selections`, if /var/lib/dpkg/available doesn't exist:
> 
> | The following NEW packages will be installed:
> | [...]
> | debconf: delaying package configuration, since apt-utils is not installed
> | dpkg: error: failed to open package info file '/var/lib/dpkg/available' for 
> reading: No such file or directory
> 
> My workaround to work around this is to run:
> 
>   chroot "${TARGET}" /usr/lib/dpkg/methods/apt/update /var/lib/dpkg
> 
> As mmdebstrap seems to rely on dpkg of the host system, it would be
> nice if mmdebstrap could ensure to create an environment where apt/dpkg of
> the installed system doesn't stumble upon. :)

this already exists as a hook. :)

Try running mmdebstrap with

    --hook-dir=/usr/share/mmdebstrap/hooks/jessie-or-older

which will unconditionally do certain things only necessary for old releases.

If you instead use

    --hook-dir=/usr/share/mmdebstrap/hooks/maybe-jessie-or-older

some detection code will only run the hook if necessary (in case you do not
know upfront which release you are creating a chroot for).

Thanks!

cheers, josch

Attachment: signature.asc
Description: signature

Reply via email to