Hi,

Quoting Benjamin Drung (2026-12-03 00:17:15)
> > Ah okay, I see then that the inability of mmdebstrap to just replace the
> > default mirror but still do the default action of adding updates and
> > security mirrors is bad for Ubuntu as a derivative.
> 
> I though about how to implement that feature (just replace the default
> mirror), and changing the default was the cleanest solution (adding a
> --mirror option would be a bit confusing). I see the point that you want
> to keep backward compatibility. As alternative, you could bump the
> version to 2 and announce this change. I am open to other solutions, but
> I haven't found a better one.

yes, I also don't like the idea of a --mirror option (mostly just) for Ubuntu.
I also thought about how to solve this and your arguments nearly convinced me
so I thought a bit more about the overall design, so let me share my thoughts
and maybe we can brainstorm a good solution that way.

My initial design idea was the following. Calling mmdebstrap like this would
let mmdebstrap pick a suitable default mirror for the suite:

1)    $ mmdebstrap $SUITE /dev/null

Adding any option afterwards means: "I want to override the defaults and
provide my own mirror". The reason I added this way of calling mmdebstrap:

2)    $ mmdebstrap $SUITE /dev/null $URL

Was to provide a shorthand for writing:

3)    $ mmdebstrap $SUITE /dev/null "deb $URL $SUITE main"

The above has a lot of verbosity. Why provide $SUITE twice? Why add the
components which are anyways the default already? If we change the meaning of
(2) to no longer be a shorthand for (3) then what should happen when the user
writes:

4)    $ mmdebstrap $SUITE /dev/null $URL "deb $URL experimental main"

What should happen when the user writes:

5)    $ mmdebstrap $SUITE /dev/null "deb $URL experimental main" $URL

What should happen when the user writes:

6)    $ mmdebstrap $SUITE /dev/null "$URL1" "$URL2"

Are options (4), (5) and (6) still setting the default mirror? If not, and if
only (2) sets a default mirror, then that exception also has to be documented.
Every exception adds complexity and potential confusion.

After having thought about this a bit more, I understand the appeal of option
(2) choosing the default mirror but doing so has a non-negligible cost in
complexity and is thus, in my eyes, not a generally superior interface even if
we accept a breaking the interface in a 2.0 release.

> > What is the use-case for using $CC.archive.ubuntu.com instead of
> > archive.ubuntu.com? Is it just for speed? In which situation would it be
> > used?  By users of mmdebstrap on the command line or by programs which are
> > wrappers around mmdebstrap like sbuild?
> 
> The reasons are mainly speed and latency, but also to not put so much
> load on the main archive.ubuntu.com.
> 
> I would use $CC.archive.ubuntu.com when using mmdebstrap (or bdebstrap)
> and have this line in my sbuild config:
> 
> push @{$unshare_mmdebstrap_extra_args}, 
> qr/^(trusty|xenial|bionic|focal|jammy|noble|resolute|stonking|tenacious)/, 
> ['http://de.archive.ubuntu.com/ubuntu'];
> 
> To compare it with other tools: If you install Ubuntu 26.04 desktop in
> Germany (German language and location), you will get
> http://de.archive.ubuntu.com/ubuntu in your apt sources by default. So using
> a country mirror is the default behaviour and what most desktop users will
> use. My local Ubuntu server uses the country mirror as well, but I am not
> sure if that was the default or if I changed it afterwards (would need to
> test that).

I have another proposal. All derivatives do things differently. Maybe other
distros also have country specific mirrors but right now the main user is
Ubuntu and another thing that irks me about this is that this feature would be
quite specifically for a derivative. If I add special quirks, then I'd rather
add this for Debian as the upstream distro but not quite so freely for its
downstream derivatives.

But: I think downstream distros should be free in how they want the defaults to
look like. We already established that we can overload the meaning $SUITE name
to pick arbitrary mirror selections. Choosing "experimental" should probably
probably add both "unstable" as well as "experimental" by default because
"experimental" alone makes no sense. How about we do the same for the
language-specific Ubuntu mirrors? You could (which name you choose is up to
you) for example say that this:

    $ mmdebstrap trusty/de chroot.tar

Creates a trusty chroot.tar with all the desired default mirrors but uses the
german default mirror.

What do you think?

> > gpg --with-colons --show-keys
> > /usr/share/keyrings/debian-archive-keyring.gpg | grep 6ED0E7B82643E131
> 
> $ gpg --with-colons --show-keys 
> /usr/share/keyrings/debian-archive-keyring.gpg | grep 6ED0E7B82643E131
> sub:-:4096:1:6ED0E7B82643E131:1674301461:1926589461:::::s::::::23:
> fpr:::::::::4CB50190207B4758A3F73A796ED0E7B82643E131:
> 
> > mmdebstrap automatically adds a signed-by to a sources.list entry if needed.
> > This does not happen in make_mirror.sh. To test this theory, could you edit 
> > the
> > entries that start with "deb [arch=$nativearch] ..." to include a signed-by
> > value of the keyring you found to contain the desired fingerprint?
> > > 
> 
> Yes, adding signed-by=/usr/share/keyrings/debian-archive-keyring.gpg to
> those lines make the scripts pass this failure. So could you update the
> script to explicitly specify the signed-by key?

Yes, I added this change locally. But I used debian-archive-keyring.pgp because
as I understood it, the keyring maintainers are changing the default extension.
Using debian-archive-keyring.pgp also works on Ubuntu, yes?

> > So yes, your proposal would be quick but even if we limit ourselves to
> > Debian, it would make the assumption that we pass a non-empty suite name
> > and that we are not using unstable or testing.
> 
> I see your point. Instead of implementing that, I put those two lines in
> my sbuild config:
> 
> push @{$unshare_mmdebstrap_extra_args}, qr/^xenial/, 
> ['--hook-dir=/usr/share/mmdebstrap/hooks/xenial/'];
> push @{$unshare_mmdebstrap_extra_args}, qr/^jammy/, 
> ['--hook-dir=/usr/share/mmdebstrap/hooks/jessie-or-older/'];
> 
> That looks clean enough for me. So ditch this automatism idea and just
> let sbuild carry those two entries by default (at least for Ubuntu).

Okay.

> > Note also, that the skip-makedev hook is not necessarily dependent on the
> > root mode hook. If you are inside an unprivileged container, then you are
> > root but you still cannot do mknod.
> > 
> > I only now realize that you only need these hooks for the 'standard' 
> > variant?
> > What is your use case to create such chroots? I must admit that I only 
> > created
> > --variant=standard because there was a priority of that name not because it 
> > was
> > useful for anything. What is your use-case?
> 
> I don't have a recent use-case. My use-case is to use mmdebstrap for
> sbuild (the buildd variant). While debugging the failure there, I was
> calling mmdebstrap manually and --variant=standard happened to be the
> default.

Oh, can you please make sure that this is the default? In the man page it says
that the default variant is "debootstrap" (alias for "important") and in the
code it says:

6036     my $options = {
6037         components      => ["main"],
6038         variant         => "important",
6039         include         => [],

> > > > > Then sbuild should default to add this hook to support building on old
> > > > > releases by default.
> > > > 
> > > > Okay, you implement it and you know ubuntu better than I, so I will 
> > > > leave the
> > > > naming of this up to you.
> > > 
> > > The drawback of having such a maybe-old-distro hook would that it
> > > clutters the output even for recent releases.
> > 
> > I only see four additional lines of output when I add the hook to a 
> > creation of
> > an unstable chroot. Is that too much?
> 
> This is my perfectionism not liking it. With the two line sbuild config
> change about, the maybe-jessie-or-older is not needed.

Ah yes, that is a valid argument. I also find it quite ugly.

> With that said, I think the skip-makedev and xenial hooks plus the
> jessie-or-older change are ready to be merged and no more hooks are
> needed (at least for my sbuild use case).

Thank you, applied locally.

cheers, josch

Attachment: signature.asc
Description: signature

Reply via email to