On 7/10/26 19:10, Johannes Schauer Marin Rodrigues wrote:
[...]
The way you are running
mmdebstrap above means that you install aptitude inside the chroot but then you
are running aptitude from*outside* the chroot. If you have aptitude inside the
chroot anyways, why not run that one? It would also be a bit shorter:
mmdebstrap forky /dev/null --chrooted-customize-hook=aptitude
I was only doing --include=aptitude in the last example.
In the other examples, I'm not installing aptitude in the chroot.
My goal is to browse around a different release than my host system,
as quickly as possible (i.e. installing as little as possible).
[Update: I was doing --variant=apt --essential-hook, but while writing
this I realized --variant=extract --extract-hook is even faster.]
This is what I'm currently doing (in my ~/.shrc):
D_aptitude () {
mmdebstrap "$@" /dev/null http://localhost:3142/debian \
--dpkgopt=force-unsafe-io \
--variant=extract \
--components=main,contrib,non-free,non-free-firmware \
'--aptopt=Acquire::Languages "en"' \
--extract-hook='APT_CONFIG=$MMDEBSTRAP_APT_CONFIG HOME=$1/root
aptitude -s -oDir::Aptitude::State=var/lib/aptitude
-oaptitude::UI::Package-Display-Format="%c%a%M%S %p %e %Z %t %v %V";
false';
}
D_aptitude forky
Compared to --include=aptitude --chrooted-customize-hook,
--essential-hook is ~30% faster, and --variant=extract --extract-hook is
~80% faster:
bash5$ time mmdebstrap forky /dev/null http://localhost:3142/debian
--dpkgopt=force-unsafe-io *--variant=extract* '--components=main,cont\
rib,non-free,non-free-firmware' '--aptopt=Acquire::Languages "en"'
*--extract-hook=*'APT_CONFIG=$MMDEBSTRAP_APT_CONFIG HOME=$1/root aptit\
ude -s -oDir::Aptitude::State=var/lib/aptitude
-oaptitude::UI::Package-Display-Format="%c%a%M%S %p %e %Z %t %v %V";
false'
aptitude cannot run in ncurses mode with terminal type "dumb"
real 0m5.536s
user 0m4.557s
sys 0m1.052s
bash5$ time mmdebstrap forky /dev/null http://localhost:3142/debian
--dpkgopt=force-unsafe-io *--variant=apt* '--components=main,contrib,\
non-free,non-free-firmware' '--aptopt=Acquire::Languages "en"'
*--essential-hook=*'APT_CONFIG=$MMDEBSTRAP_APT_CONFIG HOME=$1/root
aptitud\
e -s -oDir::Aptitude::State=var/lib/aptitude
-oaptitude::UI::Package-Display-Format="%c%a%M%S %p %e %Z %t %v %V";
false'
aptitude cannot run in ncurses mode with terminal type "dumb"
real 0m18.913s
user 0m16.201s
sys 0m5.051s
bash5$ time mmdebstrap forky /dev/null http://localhost:3142/debian
--dpkgopt=force-unsafe-io *--variant=apt* '--components=main,contrib,\
non-free,non-free-firmware' '--aptopt=Acquire::Languages "en"'
*--chrooted-customize-hook=*'aptitude -s
-oaptitude::UI::Package-Display-F\
ormat="%c%a%M%S %p %e %Z %t %v %V"; false' *--include=aptitude*
aptitude cannot run in ncurses mode with terminal type "dumb"
real 0m27.016s
user 0m19.160s
sys 0m5.958s
I guess the actual issue here is that Dir::Aptitude::State is not
relative to Dir::State by default.
I can see a case for either way.
When mmdebstrap runs host's aptitude in an unshared hook,
a Dir::Aptitude::State outside the build root (aptitude's default) will
always fail...
hrm, although I guess that is not true for --mode=root.
This has more edge cases than I thought.
I guess if no one else is asking for this, it can go on living in my
~/.shrc instead of in /bin/mmdebstrap.
PS: similar command but for apt-file not aptitude (~40% faster than
--variant=apt --include=apt-file --chrooted-customize-hook, which would
still need the --aptopt to make apt download the Contents.xz files):
mmdebstrap forky /dev/null http://localhost:3142/debian --quiet
--components=main,contrib,non-free,non-free-firmware
--aptopt=/etc/apt/apt.conf.d/50apt-file.conf --variant=custom
--extract-hook='APT_CONFIG=$MMDEBSTRAP_APT_CONFIG apt-file search
bdic | grep -een.AU -een.US -een.GB'