Control: tag -1 wontfix

Hi,

TLDR: there is no one-size-fits-all solution and mmdebstrap tries to do what
debootstrap does. Usually reproducibility is required when mmdebstrap is run
from a script and in that case, adding a hook which does the right thing is
easy and documented with examples in the man page.

Quoting Johannes Schauer Marin Rodrigues (2023-06-17 21:34:48)
> Quoting Josh Triplett (2023-06-17 20:37:47)
> > mmdebstrap has a couple of places in which it copies host configuration into
> > the bootstrapped system. For instance, it puts the host's hostname into
> > /etc/hostname, and copies in the host's /etc/resolv.conf. Please consider
> > providing a single option that suppresses all current and future uses of the
> > host configuration, to make it easier to build reproducible installations.
> > 
> > The manpage mentions using a customize-hook to handle those two files,
> > but given the common need for reproducible installations, it'd be nice
> > to have this become simpler and standardized.
> 
> you are right, mmdebstrap only creates bit-by-bit reproducible output if run
> from the same host because of these two files it copies in. You are right in
> that it should be easier to prevent those two files from messing up
> reproducibility.
> 
> The next question becomes: what should be done about /etc/hostname and
> /etc/resolv.conf? What should their reproducible content be?
> 
> Or should they just be deleted?
> 
> You are not the only one who wants such an option:
> 
> https://gitlab.mister-muffin.de/josch/mmdebstrap/issues/26
> https://gitlab.mister-muffin.de/josch/mmdebstrap/issues/33
> 
> As I've explained in the first of above issue, I'd rather add a hook than a
> command line flag because all instances that I can come up with where you want
> to run mmdebstrap to create bit-by-bit reproducible output, you run it from a
> script and not manually type the command from the terminal. Can you confirm
> this?

I would like to suggest to those who run into this bug to try and convince
debootstrap maintainers to improve reproducibility and no longer copy in
/etc/hostname and /etc/resolv.conf. I fear this is not going to happen because
it's just too convenient to have these two files get copied from the host.

The man page now contains quite a bit of documentation about what mmdebstrap
does and what to do to change its behaviour:

> Remove files that make the result unreproducible and write the empty string to
> /etc/machine-id  if   it   exists.   This   can   be   disabled   using
> --skip=cleanup/reproducible. Note that this will not remove files that make 
> the
> result  unreproducible  on machines with differing /etc/resolv.conf or
> /etc/hostname. Use a --customize-hook to make those two files  reproducible
> across  multiple  hosts.  See section "SOURCE_DATE_EPOCH" for more 
> information.
> 
> [...]
> 
> Note that for debootstrap compatibility, mmdebstrap will copy the host's
> /etc/resolv.conf and  /etc/hostname into the chroot. This means that the
> mmdebstrap output will differ if it is run on machines with differing
> /etc/resolv.conf and /etc/hostname contents. To make the  result  reproducible
> across  different hosts, you need to manually either delete both files from 
> the
> output:
> 
>     $ mmdebstrap --customize-hook='rm "$1"/etc/resolv.conf' \
>                  --customize-hook='rm "$1"/etc/hostname' ...
> 
> or fill them with reproducible content:
> 
>     $ mmdebstrap --customize-hook='echo nameserver X > "$1"/etc/resolv.conf' \
>                  --customize-hook='echo host > "$1"/etc/hostname' ...

If you are interested in bit-by-bit reproducible mmdebstrap output, then you
are probably running it from a script and in that case, just add the hooks
which do what your use-case requires.

Thanks!

cheers, josch

Attachment: signature.asc
Description: signature

Reply via email to