🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #552

Bug#1135708: Should $MMDEBSTRAP_APT_CONFIG deal with Dir::Aptitude::State?

#552
From: Trent W. Buck
Date: Sun, 11 Oct 2026 23:10
222 lines
13703 bytes
This is a multi-part message in MIME format.
--------------0iJmdfyyo4ZjEZhGD0WOtTZV
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

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'

--------------0iJmdfyyo4ZjEZhGD0WOtTZV
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 7/10/26 19:10, Johannes Schauer
      Marin Rodrigues wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:179136061060.21057.7508895816310474707@localhost">
      <pre class="moz-quote-pre" wrap="">[...]
The way you are running
mmdebstrap above means that you install aptitude inside the chroot but then you
are running aptitude from <b class="moz-txt-star"><span
      class="moz-txt-tag">*</span>outside<span class="moz-txt-tag">*</span></b> 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</pre>
    </blockquote>
    <p>I was only doing --include=aptitude in the last example.<br>
      In the other examples, I'm not installing aptitude in the chroot.<br>
    </p>
    <p>My goal is to browse around a different release than my host
      system,<br>
      as quickly as possible (i.e. installing as little as possible).</p>
    <p>[Update: I was doing --variant=apt --essential-hook, but while
      writing this I realized --variant=extract --extract-hook is even
      faster.]</p>
    <p>This is what I'm currently doing (in my ~/.shrc):</p>
    <blockquote>
      <p><tt>D_aptitude () {<br>
              mmdebstrap "$@" /dev/null <a class="moz-txt-link-freetext" href="http://localhost:3142/debian">http://localhost:3142/debian</a> \<br>
              --dpkgopt=force-unsafe-io \<br>
              --variant=extract \<br>
              --components=main,contrib,non-free,non-free-firmware \<br>
              '--aptopt=Acquire::Languages "en"' \<br>
              --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';<br>
          }<br>
        </tt><br>
        <tt>D_aptitude forky</tt></p>
    </blockquote>
    <p>Compared to --include=aptitude --chrooted-customize-hook,
      --essential-hook is ~30% faster, and --variant=extract
      --extract-hook is ~80% faster:</p>
    <blockquote>
      <p><tt>bash5$ time mmdebstrap forky /dev/null
          <a class="moz-txt-link-freetext" href="http://localhost:3142/debian">http://localhost:3142/debian</a> --dpkgopt=force-unsafe-io <b>--variant=extract</b> '--components=main,cont\<br>
          rib,non-free,non-free-firmware' '--aptopt=Acquire::Languages
          "en"' <b>--extract-hook=</b>'APT_CONFIG=$MMDEBSTRAP_APT_CONFIG
          HOME=$1/root aptit\<br>
          ude -s -oDir::Aptitude::State=var/lib/aptitude
          -oaptitude::UI::Package-Display-Format="%c%a%M%S %p %e %Z %t
          %v %V"; false'<br>
          aptitude cannot run in ncurses mode with terminal type "dumb"<br>
          real    0m5.536s<br>
          user    0m4.557s<br>
          sys     0m1.052s<br>
        </tt><tt><br>
          bash5$ time mmdebstrap forky /dev/null
          <a class="moz-txt-link-freetext" href="http://localhost:3142/debian">http://localhost:3142/debian</a> --dpkgopt=force-unsafe-io <b>--variant=apt</b>
          '--components=main,contrib,\</tt><br>
        <tt>non-free,non-free-firmware' '--aptopt=Acquire::Languages
          "en"' <b>--essential-hook=</b>'APT_CONFIG=$MMDEBSTRAP_APT_CONFIG
          HOME=$1/root aptitud\</tt><br>
        <tt>e -s -oDir::Aptitude::State=var/lib/aptitude
          -oaptitude::UI::Package-Display-Format="%c%a%M%S %p %e %Z %t
          %v %V"; false'</tt><br>
        <tt>aptitude cannot run in ncurses mode with terminal type
          "dumb"</tt><br>
        <tt>real    0m18.913s</tt><br>
        <tt>user    0m16.201s</tt><br>
        <tt>sys     0m5.051s</tt><br>
        <br>
        <tt>bash5$ time mmdebstrap forky /dev/null
          <a class="moz-txt-link-freetext" href="http://localhost:3142/debian">http://localhost:3142/debian</a> --dpkgopt=force-unsafe-io <b>--variant=apt</b>
          '--components=main,contrib,\</tt><br>
        <tt>non-free,non-free-firmware' '--aptopt=Acquire::Languages
          "en"' <b>--chrooted-customize-hook=</b>'aptitude -s
          -oaptitude::UI::Package-Display-F\</tt><br>
        <tt>ormat="%c%a%M%S %p %e %Z %t %v %V"; false' <b>--include=aptitude</b></tt><br>
        <tt>aptitude cannot run in ncurses mode with terminal type
          "dumb"</tt><br>
        <tt>real    0m27.016s</tt><br>
        <tt>user    0m19.160s</tt><br>
        <tt>sys     0m5.958s</tt></p>
    </blockquote>
    <p>I guess the actual issue here is that Dir::Aptitude::State is not
      relative to Dir::State by default.<br>
      I can see a case for either way.</p>
    <p>When mmdebstrap runs host's aptitude in an unshared hook,<br>
      a Dir::Aptitude::State outside the build root (aptitude's default)
      will always fail...<br>
      hrm, although I guess that is not true for --mode=root.</p>
    <p>This has more edge cases than I thought.<br>
      I guess if no one else is asking for this, it can go on living in
      my ~/.shrc instead of in /bin/mmdebstrap.</p>
    <p>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):</p>
    <blockquote>
      <p><tt>mmdebstrap forky /dev/null <a class="moz-txt-link-freetext" href="http://localhost:3142/debian">http://localhost:3142/debian</a>
          --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'</tt></p>
    </blockquote>
  </body>
</html>

--------------0iJmdfyyo4ZjEZhGD0WOtTZV--
Technical Details
Message-ID: <NNadj-4XBz-5@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod
References: <MRdot-2Fn0-1@gated-at.bofh.it> <NLv2x-42LO-1@gated-at.bofh.it> <MRdot-2Fn0-1@gated-at.bofh.it> <NLv2x-42LO-1@gated-at.bofh.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod
From: "Trent W. Buck" <trentbuck@gmail.com>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1135708: Should $MMDEBSTRAP_APT_CONFIG deal with Dir::Aptitude::State?
Date: Mon, 12 Oct 2026 01:10:01 +0200
Message-ID: <NNadj-4XBz-5@gated-at.bofh.it>
References: <MRdot-2Fn0-1@gated-at.bofh.it> <NLv2x-42LO-1@gated-at.bofh.it> <MRdot-2Fn0-1@gated-at.bofh.it> <NLv2x-42LO-1@gated-at.bofh.it>
X-Original-To: Johannes Schauer Marin Rodrigues <josch@debian.org>,
 1135708@bugs.debian.org
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Sun Oct 11 23:02:19 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -0.546
Reply-To: "Trent W. Buck" <trentbuck@gmail.com>, 1135708@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: josch@debian.org
X-Debian-Pr-Message: followup 1135708
X-Debian-Pr-Package: mmdebstrap
X-Debian-Pr-Source: mmdebstrap
X-Forwarded-Encrypted: i=1; AKwUvByUOS7YtwBkOQvEYkAKkBts4pjd0Pkmzfh9tf68pPt8PIAYcizbXXhWu76ZhQD2ExyOeu6EPtjW@bugs.debian.org
X-Gm-Message-State: AFq9FYLW7A7zjKSiB1K3NQMjuu2TsIar+ITtY9s5mie5uLPYQk+Ue3Mo
	Ho+N3gUTuGIYbj9ZbuxRBupLm6TVLrsokTrz136KZl/YGG5o9HmKLL0pKrfBSw==
X-Gm-Gg: AYBFou1IUnhGUTKG/ohXMTfLH1nYmyyDRJaHdRjQBhVcvBVydPh3lH4xvwaSbrTXiuZ
	K2oxy447fHqc1asuc1T2ctsBuSV9AFNJPOn0Cv2YvST6FTW/4re9IFkmrEJcyihE2lyAJjYYUdZ
	p8Zjw807IfglVpXZQuHqUJtyQALXkrnuHuWOKHNeBmpFWGWTEYQeTIhpsohO7/7jVXjXQ15OGNb
	sklmZ7SC+tIUS3S+qwEP/NAAc30xEwMr3byAMB+t8rFAIRg9StX5pWjByrH1wiFrY4ySxw7GV4H
	wrMatib5xyny7hLeGAAosVze6aJ/8TccKQP1WjPbE8Skx1rIJEuavniLNPoLWoh2TGfdW5nv0fB
	xr2EV+DeGubKzSnF9UC+m3pxQ5iMTRM5xC2ckv3CoJ5+EBXQ00qR+n9sxjQdtZBYZLeUnOcesen
	VTlbHKGTwx7a+tpr5CLTsONmrJs0lByZyVCvtAmmEIv/xE5jjEp+xyiNyvGvaAAVHHRtXt6Nk4o
	ikZq69qkUaNSqu5YDPCP3XiGVq6pyQ=
X-Received: by 2002:a17:902:f54f:b0:2dd:c053:d73e with SMTP id d9443c01a7336-2e842cd9904mr67736385ad.37.1791756902412;
        Sun, 11 Oct 2026 15:15:02 -0700 (PDT)
Content-Type: multipart/alternative;
 boundary="------------0iJmdfyyo4ZjEZhGD0WOtTZV"
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: en-AU, en-US
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/1996332
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 222
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Mon, 12 Oct 2026 09:14:59 +1100
X-Original-Message-ID: <bf162940-a5c6-46e2-906c-6e8192424262@gmail.com>
X-Original-References: <177794640233.1352345.15973565201487935235.reportbug@hera> <179136061060.21057.7508895816310474707@localhost> <177794640233.1352345.15973565201487935235.reportbug@hera> <179136061060.21057.7508895816310474707@localhost>