Giter VIP home page Giter VIP logo

debuerreotype's Introduction

Debuerreotype

GitHub CI

Reproducible, snapshot-based Debian rootfs builds (especially for Docker).

This is based on lamby's work for reproducible debootstrap:

"Debuerreotype"?

The name is an attempt at riffing off the photography basis of the word "snapshot". The daguerreotype process was an early method for taking photographs, and this is a method for taking "photographs" of Debian at a given point in time.

Why?

The goal is to create an auditable, reproducible process for creating rootfs tarballs (especially for use in Docker) of Debian releases, based on point-in-time snapshots from snapshot.debian.org.

However, as noted below, the only strictly Docker-specific script is debuerreotype-minimizing-config, which applies many configuration tweaks which are useful for Docker users and may or may not be useful outside of that context.

Usage

The usage of the scripts here center around a "rootfs" directory, which is both the working directory for building the target rootfs, and contains the debuerreotype-epoch file, which records our snapshot.debian.org epoch value (so we can adjust timestamps using it, as it is the basis for our reproducibility).

Available scripts:

script purpose
debuerreotype-init create the initial "rootfs", given a suite and a timestamp (in some format date(1) can parse); sources.list will be pointing at snapshot.debian.org
debuerreotype-chroot run a command in the given "rootfs" (using unshare to mount /dev, /proc, and /sys from the parent environment in a simple, safe way)
debuerreotype-apt-get run apt-get via debuerreotype-chroot, including -o Acquire::Check-Valid-Until=false to account for older snapshots with (now) invalid Valid-Until values
debuerreotype-minimizing-config apply configuration tweaks to make the rootfs minimal and keep it minimal (especially targeted at Docker images, with comments explicitly describing Docker use cases)
debuerreotype-slimify remove files such as documentation to create an even smaller rootfs (used for creating slim variants of the Docker images, for example)
debuerreotype-debian-sources-list generate an appropriate Debian sources.list in the rootfs given a suite (especially for updating sources.list to point at deb.debian.org before generating outputs)
debuerreotype-recalculate-epoch (esp. for non-Debian) recalculate debuerreotype-epoch from /var/lib/apt/lists/*_{In,}Release files' Date: fields (after updating sources.list / apt-get update)
debuerreotype-fixup invoked by debuerreotype-tar to fixup timestamps and remove known-bad log files for determinism
debuerreotype-tar deterministically create a tar file of the rootfs
debuerreotype-version print out the version of the current debuerreotype installation

A simple Dockerfile is provided for using these scripts in a simple deterministic environment based on Docker, but given a recent enough version of debootstrap, they should run fine outside Docker as well (and their deterministic properties have been verified on at least a Gentoo host in addition to the provided Debian-based Docker environment).

The provided Dockerfile also includes comments with hints for bootstrapping the environment on a new architecture (which then presumably doesn't have a debian Docker base image yet).

Full example: (see examples/debian.sh for this in practice)

$ debuerreotype-init --keyring /usr/share/keyrings/debian-archive-removed-keys.gpg rootfs stretch 2017-01-01T00:00:00Z
I: Retrieving InRelease
I: Checking Release signature
I: Valid Release signature (key id 126C0D24BD8A2942CC7DF8AC7638D0442B90D010)
...
I: Checking component main on http://snapshot.debian.org/archive/debian/20170101T000000Z...
...
I: Base system installed successfully.

$ cat rootfs/debuerreotype-epoch
1483228800

$ debuerreotype-minimizing-config rootfs

$ debuerreotype-apt-get rootfs update -qq
$ debuerreotype-apt-get rootfs dist-upgrade -yqq
$ debuerreotype-apt-get rootfs install -yqq --no-install-recommends inetutils-ping iproute2
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libelf1:amd64.
(Reading database ... 6299 files and directories currently installed.)
Preparing to unpack .../0-libelf1_0.166-2.2_amd64.deb ...
Unpacking libelf1:amd64 (0.166-2.2) ...
Selecting previously unselected package libmnl0:amd64.
Preparing to unpack .../1-libmnl0_1.0.4-2_amd64.deb ...
Unpacking libmnl0:amd64 (1.0.4-2) ...
Selecting previously unselected package iproute2.
Preparing to unpack .../2-iproute2_4.9.0-1_amd64.deb ...
Unpacking iproute2 (4.9.0-1) ...
Selecting previously unselected package netbase.
Preparing to unpack .../3-netbase_5.3_all.deb ...
Unpacking netbase (5.3) ...
Selecting previously unselected package inetutils-ping.
Preparing to unpack .../4-inetutils-ping_2%3a1.9.4-2+b1_amd64.deb ...
Unpacking inetutils-ping (2:1.9.4-2+b1) ...
Setting up libelf1:amd64 (0.166-2.2) ...
Processing triggers for libc-bin (2.24-8) ...
Setting up libmnl0:amd64 (1.0.4-2) ...
Setting up netbase (5.3) ...
Setting up inetutils-ping (2:1.9.4-2+b1) ...
Setting up iproute2 (4.9.0-1) ...
Processing triggers for libc-bin (2.24-8) ...

$ debuerreotype-debian-sources-list rootfs stretch

$ debuerreotype-tar rootfs - | sha256sum
e6f10da22f7ab5996f855c85ad5ae38cd786029c57893436c3bb2320f30bc188  -

$ # try it!  you should get that same sha256sum value!

(As a one-liner via docker-run.sh: ./docker-run.sh sh -euxc 'debuerreotype-init --keyring /usr/share/keyrings/debian-archive-removed-keys.gpg /tmp/rootfs stretch 2017-01-01T00:00:00Z; debuerreotype-minimizing-config /tmp/rootfs; debuerreotype-apt-get /tmp/rootfs update -qq; debuerreotype-apt-get /tmp/rootfs dist-upgrade -yqq; debuerreotype-apt-get /tmp/rootfs install -yqq --no-install-recommends inetutils-ping iproute2; debuerreotype-debian-sources-list /tmp/rootfs stretch; debuerreotype-tar /tmp/rootfs - | sha256sum')

How much have you verified this?

Well, I ran the scripts across seven explicit architectures (amd64, arm64, armel, armhf, i386, ppc64el, s390x) and eight explicit suites (oldstable, stable, testing, unstable, wheezy, jessie, stretch, sid) for a timestamp of 2017-05-16T00:00:00Z (where supported, since wheezy/oldstable didn't or no longer currently supports some of those architectures), and there were no modifications to any of the tarballs after several runs across several days.

Additionally, GitHub Actions runs with a fixed timestamp value across several suites to verify that their checksums are reproducible, as expected.

From time to time, comments in the files generated by debuerreotype-minimizing-config might change (for example), which would obviously result in a different checksum, but a simple diffoscope should be sufficient to verify that the change is benign.

debuerreotype's People

Contributors

blackikeeagle avatar cailloumajor avatar carlosedp avatar maxpeal avatar tianon avatar vicamo avatar wolletd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

debuerreotype's Issues

Switch from Google's DNS to CloudFlare's (which is more privacy-focused)

Splitting this off from #39 (comment):

We should probably also adjust this code to use CloudFlare's new(ish) 1.1.1.1 service instead (which is more privacy-focused than Google's and IMO fits more closely with the Debian ethos), but that's going to change everyone's hashes so I'm wary of making such a change: 😅

{
echo 'nameserver 8.8.8.8'
echo 'nameserver 8.8.4.4'
} > "$targetDir/etc/resolv.conf"

Remove apt cache and fetched list

I was wondering why my images are so fat and I found out that /var/lib/apt and /var/cache/apt are not emptied during the build process.
I think removing those files should be part of this scripts because we all want smaller images.

IMHO this should be done right before tar'ing the image.
So I could build this in into debuerreotype-tar or create a new helper script like .cleanup-apt.

Any suggestions on this?

Non-Debian?

It'd be great to be able to use this to build at least consistent tarballs of Debian derivatives that aren't on snapshot.debian.org.

Perhaps one of the archive files has a useful timestamp that could be used for getting a semi-consistent/reproducible result?

Remeove comments from /etc/apt/sources.list

If I update my rootfs with a new repository the previous mirror is still there but commented out.
This might be fine in most of the cases but when you start diffing your images for changes you get a false positve because of the timestamps.

Tianon helped me out with the tipp of removing it with a simple sed -i -e '/^#/d' (thanks for it! :)) but it is just lingering around something.

I don't see any reason to keep this information there. So my idea/wish would be to remove old stuff from the file to end up with a clean sources.list.
But if there is a reason to keep it (I would be interested if there is really one) then a commnd line option would be nice. Somethink like --no-backup or so.

raspian.sh seems to be broken

I'm trying to get a raspbian rootfs built (and build a sane raspbian base image which I coudn't find)

However I'm getting the following errors with the current master head 99259e6:

$ ./raspbian.sh  output stretch
…
I: Extracting util-linux...
I: Extracting xz-utils...
I: Extracting zlib1g...
W: Failure trying to run: chroot /tmp/rootfs dpkg-deb -f /var/cache/apt/archives/dpkg_1.18.25_armhf.deb Version
W: See /tmp/rootfs/debootstrap/debootstrap.log for details
W: Failure trying to run: chroot /tmp/rootfs mount -t proc proc /proc
W: See /tmp/rootfs/debootstrap/debootstrap.log for details

error: 'debootstrap' failed!

  Full command:

    debootstrap --force-check-gpg --variant=minbase --merged-usr --keyring=/usr/share/keyrings/raspbian-archive-keyring.gpg --arch=armhf stretch rootfs http://archive.raspbian.org/raspbian

  Logs:

gpgv: Signature made Wed Feb 13 16:55:36 2019 UTC
gpgv:                using RSA key 9165938D90FDDD2E
gpgv: Good signature from "Mike Thompson (Raspberry Pi Debian armhf ARMv6+VFP) <[email protected]>"
chroot: failed to run command 'dpkg-deb': No such file or directory
chroot: failed to run command 'mount': No such file or directory

tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors

I'm running this script on an ubuntu 18.04.01 and docker 18.09.1

Thanks

Upstart suppression ought to be conditional

Debian Jessie is the last release that contains upstart, so our upstart suppression code ought to be somehow conditional on that (perhaps on the availability of an upstart package in the current repo, so that we're still generic to derivatives):

# prevent upstart scripts from running during install/update
"$thisDir/debuerreotype-chroot" "$targetDir" dpkg-divert --local --rename --add /sbin/initctl > /dev/null
cp -a "$targetDir/usr/sbin/policy-rc.d" "$targetDir/sbin/initctl"
sed -i 's/^exit.*/exit 0/' "$targetDir/sbin/initctl"
# TODO should we only do this if "/sbin/initctl" already exists?

(This would probably resolve that TODO there in an even cleaner way than testing for initctl.)

Q: what’s the actual Docker official-images use?

Where does the actual job for the official-images in docker hub run (GitHub workflow?), can we see the console log for those runs? And which parameters/steps (aka script) is used. Is this the example/debian-all.sh?

Install error of openjdk with debian:10-slim

Hi!
I don't know if it's the right place to report this problem, but openjdk-11-jre-headless cannot be installed with the debian:10-slim docker image.

Dockerfile:

FROM debian:10-slim
RUN apt-get update && apt-get install -y openjdk-11-jre-headless

Output:

...
Adding debian:IdenTrust_Commercial_Root_CA_1.pem
Adding debian:UCA_Global_G2_Root.pem
Adding debian:Entrust_Root_Certification_Authority.pem
done.
Processing triggers for libc-bin (2.28-10) ...
Processing triggers for ca-certificates (20200601~deb10u2) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...

done.
done.
Setting up openjdk-11-jre-headless:amd64 (11.0.9.1+1-1~deb10u2) ...
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode
update-alternatives: error: error creating symbolic link '/usr/share/man/man1/rmid.1.gz.dpkg-tmp': No such file or directory
dpkg: error processing package openjdk-11-jre-headless:amd64 (--configure):
 installed openjdk-11-jre-headless:amd64 package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 openjdk-11-jre-headless:amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)
The command '/bin/sh -c apt-get update && apt-get install -y openjdk-11-jre-headless' returned a non-zero code: 100

apt-get update -y is failing on debian:bullseye-slim on Raspberry Pi 4B 4gb RAM

Hi! Last time I see an issue inside fresh container with the apt-get update command inside docker container with the debian:bullseye-slim image. ROM 64gb (more than half is free)
Host OS: Raspberry Pi OS Lite buster
Docker version 20.10.8, build 3967b7d
Docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.6.1-docker)
  compose: Docker Compose (Docker Inc., v2.0.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 1
 Server Version: 20.10.8
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: e25210fe30a0a703442421b0f60afac609f950a3
 runc version: v1.0.1-0-g4144b63
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.10.60-v7l+
 Operating System: Raspbian GNU/Linux 10 (buster)
 OSType: linux
 Architecture: armv7l
 CPUs: 4
 Total Memory: 3.749GiB
 Name: raspberrypi
 ID: 5IGQ:VLSZ:DCFS:MON6:S3ND:LJX4:ZGSL:BICW:ZUV2:2OUU:C3V5:3A4J
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No memory limit support
WARNING: No swap limit support
WARNING: No kernel memory TCP limit support
WARNING: No oom kill disable support

Error:

root@53c4ea8c1710:/# apt-get update -y
Get:1 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Get:2 http://deb.debian.org/debian bullseye InRelease [113 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
Err:1 http://security.debian.org/debian-security bullseye-security InRelease
  At least one invalid signature was encountered.
Err:2 http://deb.debian.org/debian bullseye InRelease
  At least one invalid signature was encountered.
Err:3 http://deb.debian.org/debian bullseye-updates InRelease
  At least one invalid signature was encountered.
Reading package lists... Done
W: GPG error: http://security.debian.org/debian-security bullseye-security InRelease: At least one invalid signature was encountered.
E: The repository 'http://security.debian.org/debian-security bullseye-security InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://deb.debian.org/debian bullseye InRelease: At least one invalid signature was encountered.
E: The repository 'http://deb.debian.org/debian bullseye InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://deb.debian.org/debian bullseye-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://deb.debian.org/debian bullseye-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

The other strange thing that in the same network on my MacOS (x86_64) instance the same docker image worked successfully.
For now I will continue using the buster version, because its working fine.

Reproducibility of the final "/etc/apt/sources.list" contents drifts over time

https://github.com/debuerreotype/debuerreotype/pull/24/files#r201544096

Just to note this somewhere, when we generate the final sources.list for an older snapshot revision, we should probably somehow include or exclude lines based on whether snapshot had support at that point in time, not whether the current contents of the archive do (which is what caused 06573aa).

When Jessie transitioned to LTS it lost security support for several arches (arm64 being one) which caused a reproducibility issue with the full build since we check the actual contents of the mirror/archive to determine whether to include lines (which helps us handle not only testing/unstable not being security supported, but also architecture specific security support).

I think we probably need to improve the debuerreotype-gen-sources-list changes from #24 to take into account the snapshot point-in-time contents for whether to generate individual lines instead (so that even the final non-snapshot /etc/apt/sources.list contents stay reproducible because eventually we'll end up generating an empty file when the release becomes completely unsupported and moves to archive since we won't necessarily be doing --debian-eol in that case).

Wheezy reproducibility

(Filing an official issue to give a single place for discussion/findings.)

From the current README:

Wheezy is a little sad, and will have a delta similar to the following (as seen via diffoscope):

├── etc/apt/trustdb.gpg
│ │ @@ -1,8 +1,8 @@
│ │ -0000000: 0167 7067 0303 0105 0102 0000 591b faa5  .gpg........Y...
│ │ +0000000: 0167 7067 0303 0105 0102 0000 591b fc0c  .gpg........Y...
│ │  0000010: 0000 0000 0000 0000 0000 0000 0000 0000  ................
│ │  0000020: 0000 0000 0000 0001 0a00 0000 0000 0000  ................
│ │  0000030: 0000 0000 0000 0000 0000 0000 0000 0000  ................
│ │  0000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
│ │  0000050: 0a00 0000 0000 0000 0000 0000 0000 0000  ................
│ │  0000060: 0000 0000 0000 0000 0000 0000 0000 0000  ................
│ │  0000070: 0000 0000 0000 0000 0a00 0000 0000 0000  ................

Presumably this is some sort of timestamp, but that's just a guess. Suggestions for ways of fixing this would be most welcome! (Otherwise, we'll just wait for Wheezy to go EOL and forget this ever happened. :trollface:)

Use of Signed-by in debian.sources

The created /etc/apt/sources.d/debian.sources contain 2 entries for the current distribution, prepared by the debuerreotype scripts. The entry adds a Signed-By clause, which means apt will not use the keys in /etc/apt/trusted-pgp.d/.

I noticed this because I wanted to delete older distribution trusted keys from the directory, but it had no effect. The reason why I want to remove those older keys is to defend against downgrade attacks.

The problem is now, that the file uses /usr/share/keyrings/debian-archive-keyring.gpg aggregate, which contains all of the keys.

I see three ways to fix it:

a) remove Signed-By lines and rely on trusted.d
b) create a per-codename aggregate keyring file /usr/share/keyrings/debian-archive-bookworm.gpg and replace the two Signed-By with it.
c) specify the actual fine grained keys. This requires 3 seperate entries, like so:

Types: deb
URIs: http://deb.debian.org/debian
Suites: stable
Components: main
Signed-By: /usr/share/keyrings/debian-archive-bookworm-stable.gpg

Types: deb
URIs: http://deb.debian.org/debian
Suites: stable-updates
Components: main
Signed-By: /usr/share/keyrings/debian-archive-bookworm-automatic.gpg

Types: deb
URIs: http://deb.debian.org/debian-security
Suites: stable-security
Components: main
Signed-By: /usr/share/keyrings/debian-archive-bookworm-security-automatic.gpg

Not sure if the semantic of those files is well defined and if bookworm-stable.gpg is the actual key that will be used for the main release’ future minor updates?

Newby question

Hi!
I perhaps wrong get point of this repository, if so, please correct me.
Does this repo about building Debian rootfs?
Does if yes, can i build it for armv7?

Building from an ISO image

Since #33 is closed and I cannot reopen it, opening a new one (note: I am not the author of the original issue).

The goal I am trying to achieve is creating a build environment for a product which has a lifetime of ten years. The environment should be independent of any online sources (which can go offline) and we need an option to install additional build tools inside the environment as the product evolves, without hassle.

My current approach is to download a double-layer Blu-ray ISO image of buster and to utilize debuerreotype to create a root file system which can then be used in a chroot or a docker image.

So I run an HTTP server in the mounted ISO's root directory and point debuerreotype-init --non-debian there and... it fails ;-). Specifically, there is no Release.gpg file in the ISO image and since --force-check-gpg is set for debootstrap unconditionally, it fails. When I patch the parameter to --no-check-gpg, it works \o/. I was able to import the image to docker and use apt in it (docker needs the --net=host parameter to make the localhost repo available in the container).

After this, I need to provide different parameters to apt to make it work with the unsigned repository, or (better) set [trusted=yes] on that repo in the sources.list.

Thus, we have actionable items now:

  • Make GPG signature check optional
  • Mark the local repository trusted

Note that for testing, I use the smaller CD image.

Exclude /usr/lib/python3.*/EXTERNALLY-MANAGED to fix system-wide pip install due to PEP-668

The Python PEP-668 introduces a big breaking change by forbidding the system-wide installation of Python packages via pip.

All the many many Dockerfiles out there running pip install are now broken as soon as they try to move to Bookworm-based image:

WARNING: The directory '/github/home/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.
    
    See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

The goal is to prevent issues when mixing and matching distro-managed packages and pip-installed ones.

However, this is not really an issue for containers. Citing the use-case #5 in PEP-668 itself:

... builders of base container images may want to ensure that the marker file is not present, even if the underlying OS ships one by default.

The suggestion is thus for Docker containers to remove the /usr/lib/python3.11/EXTERNALLY-MANAGED file.

Rather than having everyone rm it, could the base container ship a dpkg exclusion to prevent any /usr/lib/python3.*/EXTERNALLY-MANAGED files from being installed?

docker images for raspbian linux/arm64, linux/arm/v6, linux/arm/v7?

@tianon, can you please start publishing raspbian linux/arm64, linux/arm/v6, linux/arm/v7 to https://hub.docker.com/r/tianon/raspbian? or even https://hub.docker.com/_/raspbian? :-)

Do you known why https://hub.docker.com/u/raspbian is not official?

I'm sorry if this is not the correct repo for this issue, but I didn't find a more suitable one.

Also, in order for the image to be more alike raspberry pi os I would like to customize it with the following:

echo 'deb http://archive.raspberrypi.org/debian/ buster main' >/etc/apt/sources.list.d/raspi.list && \
	gpg --keyserver keys.gnupg.net --recv-key 82B129927FA3303E && \
	gpg -a --export 82B129927FA3303E | apt-key add -

NB this is needed to be able to install the libraries that add support for accessing the rpi hardware (e.g. /dev/vchiq with the libraspberrypi-dev/libraspberrypi0 library.

And maybe these apt.conf.d settings:

root@raspberrypi:~# cat /etc/apt/apt.conf.d/50raspi
# never use pdiffs. Current implementation is very slow on low-powered devices
Acquire::PDiffs "0";

# download up to 5 pdiffs:
#Acquire::PDiffs::FileLimit "5";

root@raspberrypi:~# cat /etc/apt/apt.conf.d/70debconf
// Pre-configure all packages with debconf before they are installed.
// If you don't like it, comment it out.
DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";};
root@raspberrypi:~# 

What do you think?

Should this be added to raspbian.sh or this should really be made in our Dockerfile?

ca-certificates-java non deterministic

I am trying to build a Debian buster image that includes the package default-jre. This depends on ca-certificates-java, which, to my understanding generates /etc/ssl/certs/java/cacerts. Multiple invocations of the image creation script yield different versions on cacerts. The delta seem to be a couple of bytes on each one of the certificates. E.g.:

4c4
< 00000030: 2e70 656d 0000 016d 743c a28a 0005 582e  .pem...mt<....X.
---
> 00000030: 2e70 656d 0000 016d 7442 1098 0005 582e  .pem...mtB....X.
40c40
< 00000270: 743c a328 0005 582e 3530 3900 0003 5830  t<.(..X.509...X0
---
> 00000270: 7442 1137 0005 582e 3530 3900 0003 5830  tB.7..X.509...X0
97c97
< 00000600: 016d 743c a2c9 0005 582e 3530 3900 0005  .mt<....X.509...
---
> 00000600: 016d 7442 10d7 0005 582e 3530 3900 0005  .mtB....X.509...
191,192c191,192
< 00000be0: 7261 697a 312e 7065 6d00 0001 6d74 3ca3  raiz1.pem...mt<.
< 00000bf0: 2300 0558 2e35 3039 0000 07d7 3082 07d3  #..X.509....0...
---
> 00000be0: 7261 697a 312e 7065 6d00 0001 6d74 4211  raiz1.pem...mtB.
> 00000bf0: 3100 0558 2e35 3039 0000 07d7 3082 07d3  1..X.509....0...
320,321c320,321
< 000013f0: 745f 6361 2d32 2e70 656d 0000 016d 743c  t_ca-2.pem...mt<
< 00001400: a34d 0005 582e 3530 3900 0006 3330 8206  .M..X.509...30..
---
> 000013f0: 745f 6361 2d32 2e70 656d 0000 016d 7442  t_ca-2.pem...mtB
> 00001400: 115c 0005 582e 3530 3900 0006 3330 8206  .\..X.509...30..
423c423
< 00001a60: 5f63 612e 7065 6d00 0001 6d74 3ca3 2400  _ca.pem...mt<.$.
---
> 00001a60: 5f63 612e 7065 6d00 0001 6d74 4211 3300  _ca.pem...mtB.3.
494c494
< 00001ed0: 016d 743c a2f2 0005 582e 3530 3900 0003  .mt<....X.509...
---
> 00001ed0: 016d 7442 1100 0005 582e 3530 3900 0003  .mtB....X.509...
558c558
< 000022d0: 656d 0000 016d 743c a33b 0005 582e 3530  em...mt<.;..X.50
---
> 000022d0: 656d 0000 016d 7442 114a 0005 582e 3530  em...mtB.J..X.50
625,626c625,626
< 00002700: 6572 5f63 612e 7065 6d00 0001 6d74 3ca2  er_ca.pem...mt<.
< 00002710: 6a00 0558 2e35 3039 0000 042e 3082 042a  j..X.509....0..*

debconf: unable to initialize frontend: Dialog errors

There are error messages

debconf: unable to initialize frontend: Dialog

when trying to build bullseye rootfs on updated bullseye host with commands:

root@mybullseye:/var/tmp# apt-get install debuerreotype debootstrap

root@mybullseye:/var/tmp# debuerreotype-init --non-debian rootfs bullseye http://deb.debian.org/debian/

root@mybullseye:/var/tmp# cat > rootfs/etc/apt/sources.list <<\EOF
> deb http://deb.debian.org/debian/ bullseye main
> deb http://deb.debian.org/debian-security/ bullseye-security main
> deb http://deb.debian.org/debian/ bullseye-updates main
> EOF

root@mybullseye:/var/tmp# debuerreotype-minimizing-config rootfs

root@mybullseye:/var/tmp# debuerreotype-apt-get rootfs update -qq

root@mybullseye:/var/tmp# debuerreotype-apt-get rootfs dist-upgrade -yqq
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 6653 files and directories currently installed.)
Preparing to unpack .../perl-base_5.32.1-4+deb11u1_amd64.deb ...
Unpacking perl-base (5.32.1-4+deb11u1) over (5.32.1-4) ...
Setting up perl-base (5.32.1-4+deb11u1) ...
(Reading database ... 6653 files and directories currently installed.)
Preparing to unpack .../libssl1.1_1.1.1k-1+deb11u1_amd64.deb ...
Unpacking libssl1.1:amd64 (1.1.1k-1+deb11u1) over (1.1.1k-1) ...
Setting up libssl1.1:amd64 (1.1.1k-1+deb11u1) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
(Reading database ... 6653 files and directories currently installed.)
Preparing to unpack .../tzdata_2021a-1+deb11u1_all.deb ...
Unpacking tzdata (2021a-1+deb11u1) over (2021a-1) ...
Setting up tzdata (2021a-1+deb11u1) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype

Current default time zone: 'Etc/UTC'
Local time is now:      Thu Oct  7 14:00:29 UTC 2021.
Universal Time is now:  Thu Oct  7 14:00:29 UTC 2021.
Run 'dpkg-reconfigure tzdata' if you wish to change it.

Processing triggers for libc-bin (2.31-13) ...

root@mybullseye:/var/tmp# debuerreotype-apt-get rootfs install -yqq --no-install-recommends inetutils-ping iproute2
[...]
Setting up iproute2 (5.10.0-4) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Processing triggers for libc-bin (2.31-13) ...

root@mybullseye:/var/tmp# debuerreotype-slimify rootfs

root@mybullseye:/var/tmp# debuerreotype-tar rootfs rootfs.tar

root@mybullseye:/var/tmp# du -sh rootfs.tar
84M     rootfs.tar

Executing

root@mybullseye:/var/tmp# echo 'debconf debconf/frontend select Noninteractive' | debuerreotype-chroot rootfs debconf-set-selections

just after

root@mybullseye:/var/tmp# debuerreotype-init --non-debian rootfs bullseye http://deb.debian.org/debian/

stops these errors.

Versions:

root@mybullseye:/var/tmp# dpkg -s debuerreotype debootstrap | grep Version
Version: 0.10-2
Version: 1.0.123

BTW: can one build (on bullseye host) up to date with deb.debian.org, debuerreotype minimal stable bullseye rootfs with inetutils-ping iproute2 using commands like above or something should be done different/better?

stretch ps: command not found

$ docker run -it --rm debian:jessie ps
  PID TTY          TIME CMD
    1 ?        00:00:00 ps
$ docker run -it --rm debian:stretch ps
docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"ps\": executable file not found in $PATH".

Sorry if this is the wrong place for this discussion but it seemed like the best place to start. Was the removal of ps(1) intentional?
Thanks.

GPG failure during build in Docker image due to old keyring

Disclaimer: I don't fully understand all of this as I'm not an APT/GPG expert.

When attempting to build a Debian Buster (stable) image for today (2019-07-08) using the build.sh script, the build fails with a GPG key error:

+ gpgv --keyring /tmp/tmp.7yhCPypSLj/debian-archive-stable-keyring.gpg output/20190708/amd64/stable/Release.gpg output/20190708/amd64/stable/Release
gpgv: Signature made Sat Jul  6 09:09:55 2019 UTC
gpgv:                using RSA key 16E90B3FDF65EDE3AA7F323C04EE7237B7D453EC
gpgv: Good signature from "Debian Archive Automatic Signing Key (9/stretch) <[email protected]>"
gpgv: Signature made Sat Jul  6 09:09:56 2019 UTC
gpgv:                using RSA key 0146DC6D4A0B2914BDED34DB648ACFD622F3D138
gpgv: Can't check signature: No public key
gpgv: Signature made Sat Jul  6 09:37:15 2019 UTC
gpgv:                using RSA key 067E3C456BAE240ACEE88F6FEF0F382A1A7B6500
gpgv: Good signature from "Debian Stable Release Key (9/stretch) <[email protected]>"
gpgv: Signature made Sat Jul  6 09:37:15 2019 UTC
gpgv:                using RSA key 6D33866EDD8FFA41C0143AEDDCC9EFBF77E11517
gpgv: Can't check signature: No public key

The fix I found was to update the debian-archive-keyring package (2017.5 -> 2017.5+deb9u1) in the Debian Stretch image (now oldstable, this was the latest tag as of writing, stretch-20190610-slim).

I expect this to be fixed as soon as there are new Debian Docker images built, but I'm creating this issue in case others hit this problem. Also, maybe the debian-archive-keyring package could be updated in the Dockerfile?

Thanks for the project 🙏

Update "build.sh" to not waste time building everything twice

I think a diffoscope shows the point best here:

$ diffoscope jessie.tar.xz stable.tar.xz
--- /home/tianon/jessie.tar.xz
+++ /home/tianon/stable.tar.xz
│   --- jessie.tar
├── +++ stable.tar
├── etc/apt/sources.list
│ │ @@ -1,3 +1,3 @@
│ │ -deb http://deb.debian.org/debian jessie main
│ │ -deb http://deb.debian.org/debian jessie-updates main
│ │ -deb http://security.debian.org jessie/updates main
│ │ +deb http://deb.debian.org/debian stable main
│ │ +deb http://deb.debian.org/debian stable-updates main
│ │ +deb http://security.debian.org stable/updates main

At build time, we can build one or the other of each suite, and then either simply copy the tarball with an updated sources.list, or use a Dockerfile that's FROM debian:xxx and updates sources.list (just like jessie-backports, experimental, etc do).

We can scrape the canonical "Suite" and "Codename" from the Release file (which makes the rolling aliases the most attractive build target, given that they'll require less/no manual updating of files at Debian release times).

debuerreotype-debian-sources-list unreasonably assumes EOL means all-in on archive.debian.org

(This is the underlying issue for debuerreotype/docker-debian-eol-artifacts#1, filing here as well in case the fix there ends up being more local to get a fix out sooner than we can re-architect how this script works to fix it here.)

As it turns out, the assumption that "EOL releases live on archive.debian.org, always" is not actually true at all, and the assumption should actually be "EOL releases live on archive.debian.org, eventually" -- for some (indeterminate) period of time, releases will be EOL, but not on archive.debian.org yet (or only partially, as we see in the case of jessie vs jessie-security / jessie-lts).

This also bleeds a little into the assumptions in our Debian version building (in that releases existing in https://deb.debian.org/debian/dists/ means they are still actively supported and not EOL, which isn't completely true), which is very much a closely related bug/assumption, but not quite the same.

debuerreotype-init fails in docker

With the debuerreotype/debuerreotype image from Docker Hub:

$ docker run --cap-add SYS_ADMIN --cap-drop SETFCAP --tmpfs /tmp:dev,exec,suid,noatime debuerreotype/debuerreotype debuerreotype-init /tmp/docker-rootfs buster now
[...]
I: Extracting zlib1g...
W: Failure trying to run: chroot /tmp/docker-rootfs mount -t proc proc /proc
W: See /tmp/docker-rootfs/debootstrap/debootstrap.log for details
[...]
mount: /proc: cannot mount proc read-only.

Curiously, if I build the image locally from current master here and try the same with it, it fails in a different way:

$ docker run --cap-add SYS_ADMIN --cap-drop SETFCAP --tmpfs /tmp:dev,exec,suid,noatime debuerreotype/debuerreotype debuerreotype-init /tmp/docker-rootfs buster now
[...]
I: Configuring libc-bin...
I: Unpacking the base system...
I: Base system installed successfully.
unshare: cannot change root filesystem propagation: Permission denied

This is on Ubuntu 18.04, docker 19.03.8

Building older snapshots of `unstable` now fails: `E: Couldn't find these debs: usr-is-merged`

+ debuerreotype-init --arch amd64 --debian --keyring /tmp/debuerreotype.unstable.8qg8yw1ysr/debian-archive-unstable-keyring.gpg --no-merged-usr /tmp/debuerreotype.unstable.8qg8yw1ysr/rootfs unstable @1483228800
I: Retrieving InRelease 
I: Checking Release signature
I: Valid Release signature (key id 126C0D24BD8A2942CC7DF8AC7638D0442B90D010)
I: Retrieving Packages 
I: Validating Packages 
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Checking component main on http://snapshot.debian.org/archive/debian/20170101T000000Z...
E: Couldn't find these debs: usr-is-merged

See also https://salsa.debian.org/installer-team/debootstrap/-/merge_requests/71 / https://salsa.debian.org/installer-team/debootstrap/-/merge_requests/72.

copyright file getting whacked by slimify

I was experimenting with docker and was running a diff between stretch and stretch-slim, and I noticed that at least one copyright file was getting removed, even though it seems to be contrary to your intent. This file specifically was being removed: /usr/share/doc/libmnl0/copyright - I did see a handful of others.

I found this with the following command:

diff -u <(docker run --rm debian:stretch      bash -c 'find / -xdev -type f | sort') \
        <(docker run --rm debian:stretch-slim bash -c 'find / -xdev -type f | sort')

I apologize if this is intended behavior.

debuerreotype-init fails due to 404

Hi, I'm running this command in a docker container with the latest debuerreotype:

debuerreotype-init /rootfs stretch "2021-07-01T14:35:49Z"

and it always ends this way

warning: no apparent 'stretch/main' for '' on any of the following
  - http://snapshot.debian.org/archive/debian/20210701T143549Z
skipping 'stretch/main' ...
warning: no apparent 'stretch-security/main' for '' on any of the following
  - http://snapshot.debian.org/archive/debian-security/20210701T143549Z
skipping 'stretch-security/main' ...
warning: no apparent 'stretch-updates/main' for '' on any of the following
  - http://snapshot.debian.org/archive/debian/20210701T143549Z
skipping 'stretch-updates/main' ...
error: sources.list ended up empty -- something is definitely wrong
The command '/bin/sh -c debuerreotype-init /rootfs stretch "2021-07-01T14:35:49Z"' returned a non-zero code: 1

note that

http://snapshot.debian.org/archive/debian/20210701T143549Z

gives a 404, but this doesn't:

http://snapshot.debian.org/archive/debian/20210701T143549Z/dists/

full log:

Sending build context to Docker daemon  31.74kB
Step 1/31 : FROM andrewzah/debian-debuerreotype:2021-07-01 as rootfs-stage
 ---> fd7da112d4d3
Step 2/31 : RUN debuerreotype-init /rootfs stretch "2021-07-01T14:35:49Z"
 ---> Running in b6fa0afb7d1b
I: Target architecture can be executed
I: Retrieving InRelease 
I: Retrieving Release 
I: Retrieving Release.gpg 
I: Checking Release signature
I: Valid Release signature (key id 067E3C456BAE240ACEE88F6FEF0F382A1A7B6500)
I: Retrieving Packages 
I: Validating Packages 
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Checking component main on http://snapshot.debian.org/archive/debian/20210701T143549Z...
I: Retrieving libacl1 2.2.52-3+b1
I: Validating libacl1 2.2.52-3+b1
I: Retrieving adduser 3.115
I: Validating adduser 3.115
I: Retrieving apt 1.4.10
I: Validating apt 1.4.10
I: Retrieving libapt-pkg5.0 1.4.10
I: Validating libapt-pkg5.0 1.4.10
I: Retrieving libattr1 1:2.4.47-2+b2
I: Validating libattr1 1:2.4.47-2+b2
I: Retrieving libaudit-common 1:2.6.7-2
I: Validating libaudit-common 1:2.6.7-2
I: Retrieving libaudit1 1:2.6.7-2
I: Validating libaudit1 1:2.6.7-2
I: Retrieving base-files 9.9+deb9u13
I: Validating base-files 9.9+deb9u13
I: Retrieving base-passwd 3.5.43
I: Validating base-passwd 3.5.43
I: Retrieving bash 4.4-5
I: Validating bash 4.4-5
I: Retrieving libbz2-1.0 1.0.6-8.1
I: Validating libbz2-1.0 1.0.6-8.1
I: Retrieving libdebconfclient0 0.227
I: Validating libdebconfclient0 0.227
I: Retrieving coreutils 8.26-3
I: Validating coreutils 8.26-3
I: Retrieving dash 0.5.8-2.4
I: Validating dash 0.5.8-2.4
I: Retrieving libdb5.3 5.3.28-12+deb9u1
I: Validating libdb5.3 5.3.28-12+deb9u1
I: Retrieving debconf 1.5.61
I: Validating debconf 1.5.61
I: Retrieving debian-archive-keyring 2017.5+deb9u1
I: Validating debian-archive-keyring 2017.5+deb9u1
I: Retrieving debianutils 4.8.1.1
I: Validating debianutils 4.8.1.1
I: Retrieving diffutils 1:3.5-3
I: Validating diffutils 1:3.5-3
I: Retrieving dpkg 1.18.25
I: Validating dpkg 1.18.25
I: Retrieving e2fslibs 1.43.4-2+deb9u1
I: Validating e2fslibs 1.43.4-2+deb9u1
I: Retrieving e2fsprogs 1.43.4-2+deb9u1
I: Validating e2fsprogs 1.43.4-2+deb9u1
I: Retrieving libcomerr2 1.43.4-2+deb9u1
I: Validating libcomerr2 1.43.4-2+deb9u1
I: Retrieving libss2 1.43.4-2+deb9u1
I: Validating libss2 1.43.4-2+deb9u1
I: Retrieving findutils 4.6.0+git+20161106-2
I: Validating findutils 4.6.0+git+20161106-2
I: Retrieving gcc-6-base 6.3.0-18+deb9u1
I: Validating gcc-6-base 6.3.0-18+deb9u1
I: Retrieving libgcc1 1:6.3.0-18+deb9u1
I: Validating libgcc1 1:6.3.0-18+deb9u1
I: Retrieving libstdc++6 6.3.0-18+deb9u1
I: Validating libstdc++6 6.3.0-18+deb9u1
I: Retrieving libc-bin 2.24-11+deb9u4
I: Validating libc-bin 2.24-11+deb9u4
I: Retrieving libc6 2.24-11+deb9u4
I: Validating libc6 2.24-11+deb9u4
I: Retrieving multiarch-support 2.24-11+deb9u4
I: Validating multiarch-support 2.24-11+deb9u4
I: Retrieving gpgv 2.1.18-8~deb9u4
I: Validating gpgv 2.1.18-8~deb9u4
I: Retrieving grep 2.27-2
I: Validating grep 2.27-2
I: Retrieving gzip 1.6-5+b1
I: Validating gzip 1.6-5+b1
I: Retrieving hostname 3.18+b1
I: Validating hostname 3.18+b1
I: Retrieving init-system-helpers 1.48
I: Validating init-system-helpers 1.48
I: Retrieving libcap-ng0 0.7.7-3+b1
I: Validating libcap-ng0 0.7.7-3+b1
I: Retrieving libgcrypt20 1.7.6-2+deb9u3
I: Validating libgcrypt20 1.7.6-2+deb9u3
I: Retrieving libgpg-error0 1.26-2
I: Validating libgpg-error0 1.26-2
I: Retrieving libselinux1 2.6-3+b3
I: Validating libselinux1 2.6-3+b3
I: Retrieving libsemanage-common 2.6-2
I: Validating libsemanage-common 2.6-2
I: Retrieving libsemanage1 2.6-2
I: Validating libsemanage1 2.6-2
I: Retrieving libsepol1 2.6-2
I: Validating libsepol1 2.6-2
I: Retrieving lsb-base 9.20161125
I: Validating lsb-base 9.20161125
I: Retrieving liblz4-1 0.0~r131-2+b1
I: Validating liblz4-1 0.0~r131-2+b1
I: Retrieving mawk 1.3.3-17+b3
I: Validating mawk 1.3.3-17+b3
I: Retrieving libncursesw5 6.0+20161126-1+deb9u2
I: Validating libncursesw5 6.0+20161126-1+deb9u2
I: Retrieving libtinfo5 6.0+20161126-1+deb9u2
I: Validating libtinfo5 6.0+20161126-1+deb9u2
I: Retrieving ncurses-base 6.0+20161126-1+deb9u2
I: Validating ncurses-base 6.0+20161126-1+deb9u2
I: Retrieving ncurses-bin 6.0+20161126-1+deb9u2
I: Validating ncurses-bin 6.0+20161126-1+deb9u2
I: Retrieving libpam-modules 1.1.8-3.6
I: Validating libpam-modules 1.1.8-3.6
I: Retrieving libpam-modules-bin 1.1.8-3.6
I: Validating libpam-modules-bin 1.1.8-3.6
I: Retrieving libpam-runtime 1.1.8-3.6
I: Validating libpam-runtime 1.1.8-3.6
I: Retrieving libpam0g 1.1.8-3.6
I: Validating libpam0g 1.1.8-3.6
I: Retrieving libpcre3 2:8.39-3
I: Validating libpcre3 2:8.39-3
I: Retrieving perl-base 5.24.1-3+deb9u7
I: Validating perl-base 5.24.1-3+deb9u7
I: Retrieving sed 4.4-1
I: Validating sed 4.4-1
I: Retrieving sensible-utils 0.0.9+deb9u1
I: Validating sensible-utils 0.0.9+deb9u1
I: Retrieving login 1:4.4-4.1
I: Validating login 1:4.4-4.1
I: Retrieving passwd 1:4.4-4.1
I: Validating passwd 1:4.4-4.1
I: Retrieving libsystemd0 232-25+deb9u12
I: Validating libsystemd0 232-25+deb9u12
I: Retrieving libudev1 232-25+deb9u12
I: Validating libudev1 232-25+deb9u12
I: Retrieving sysvinit-utils 2.88dsf-59.9
I: Validating sysvinit-utils 2.88dsf-59.9
I: Retrieving tar 1.29b-1.1
I: Validating tar 1.29b-1.1
I: Retrieving tzdata 2020a-0+deb9u1
I: Validating tzdata 2020a-0+deb9u1
I: Retrieving libustr-1.0-1 1.0.4-6
I: Validating libustr-1.0-1 1.0.4-6
I: Retrieving bsdutils 1:2.29.2-1+deb9u1
I: Validating bsdutils 1:2.29.2-1+deb9u1
I: Retrieving libblkid1 2.29.2-1+deb9u1
I: Validating libblkid1 2.29.2-1+deb9u1
I: Retrieving libfdisk1 2.29.2-1+deb9u1
I: Validating libfdisk1 2.29.2-1+deb9u1
I: Retrieving libmount1 2.29.2-1+deb9u1
I: Validating libmount1 2.29.2-1+deb9u1
I: Retrieving libsmartcols1 2.29.2-1+deb9u1
I: Validating libsmartcols1 2.29.2-1+deb9u1
I: Retrieving libuuid1 2.29.2-1+deb9u1
I: Validating libuuid1 2.29.2-1+deb9u1
I: Retrieving mount 2.29.2-1+deb9u1
I: Validating mount 2.29.2-1+deb9u1
I: Retrieving util-linux 2.29.2-1+deb9u1
I: Validating util-linux 2.29.2-1+deb9u1
I: Retrieving liblzma5 5.2.2-1.2+b1
I: Validating liblzma5 5.2.2-1.2+b1
I: Retrieving zlib1g 1:1.2.8.dfsg-5
I: Validating zlib1g 1:1.2.8.dfsg-5
I: Chosen extractor for .deb packages: dpkg-deb
I: Extracting libacl1...
I: Extracting libattr1...
I: Extracting libaudit-common...
I: Extracting libaudit1...
I: Extracting base-files...
I: Extracting base-passwd...
I: Extracting bash...
I: Extracting libbz2-1.0...
I: Extracting libdebconfclient0...
I: Extracting coreutils...
I: Extracting dash...
I: Extracting libdb5.3...
I: Extracting debconf...
I: Extracting debianutils...
I: Extracting diffutils...
I: Extracting dpkg...
I: Extracting e2fslibs...
I: Extracting e2fsprogs...
I: Extracting libcomerr2...
I: Extracting libss2...
I: Extracting findutils...
I: Extracting gcc-6-base...
I: Extracting libgcc1...
I: Extracting libc-bin...
I: Extracting libc6...
I: Extracting multiarch-support...
I: Extracting grep...
I: Extracting gzip...
I: Extracting hostname...
I: Extracting init-system-helpers...
I: Extracting libcap-ng0...
I: Extracting libgcrypt20...
I: Extracting libgpg-error0...
I: Extracting libselinux1...
I: Extracting libsemanage-common...
I: Extracting libsemanage1...
I: Extracting libsepol1...
I: Extracting lsb-base...
I: Extracting liblz4-1...
I: Extracting mawk...
I: Extracting libncursesw5...
I: Extracting libtinfo5...
I: Extracting ncurses-base...
I: Extracting ncurses-bin...
I: Extracting libpam-modules...
I: Extracting libpam-modules-bin...
I: Extracting libpam-runtime...
I: Extracting libpam0g...
I: Extracting libpcre3...
I: Extracting perl-base...
I: Extracting sed...
I: Extracting sensible-utils...
I: Extracting login...
I: Extracting passwd...
I: Extracting libsystemd0...
I: Extracting libudev1...
I: Extracting sysvinit-utils...
I: Extracting tar...
I: Extracting tzdata...
I: Extracting libustr-1.0-1...
I: Extracting bsdutils...
I: Extracting libblkid1...
I: Extracting libfdisk1...
I: Extracting libmount1...
I: Extracting libsmartcols1...
I: Extracting libuuid1...
I: Extracting mount...
I: Extracting util-linux...
I: Extracting liblzma5...
I: Extracting zlib1g...
I: Installing core packages...
I: Unpacking required packages...
I: Unpacking libacl1:amd64...
I: Unpacking libattr1:amd64...
I: Unpacking libaudit-common...
I: Unpacking libaudit1:amd64...
I: Unpacking base-files...
I: Unpacking base-passwd...
I: Unpacking bash...
I: Unpacking libbz2-1.0:amd64...
I: Unpacking libdebconfclient0:amd64...
I: Unpacking coreutils...

I: Unpacking dash...
I: Unpacking libdb5.3:amd64...
I: Unpacking debconf...
I: Unpacking debianutils...
I: Unpacking diffutils...
I: Unpacking dpkg...
I: Unpacking e2fslibs:amd64...
I: Unpacking e2fsprogs...
I: Unpacking libcomerr2:amd64...
I: Unpacking libss2:amd64...
I: Unpacking findutils...
I: Unpacking gcc-6-base:amd64...
I: Unpacking libgcc1:amd64...
I: Unpacking libc-bin...
I: Unpacking libc6:amd64...
I: Unpacking multiarch-support...
I: Unpacking grep...
I: Unpacking gzip...
I: Unpacking hostname...
I: Unpacking init-system-helpers...
I: Unpacking libcap-ng0:amd64...
I: Unpacking libgcrypt20:amd64...
I: Unpacking libgpg-error0:amd64...
I: Unpacking libselinux1:amd64...
I: Unpacking libsemanage-common...
I: Unpacking libsemanage1:amd64...
I: Unpacking libsepol1:amd64...
I: Unpacking lsb-base...
I: Unpacking liblz4-1:amd64...
I: Unpacking mawk...
I: Unpacking libncursesw5:amd64...
I: Unpacking libtinfo5:amd64...
I: Unpacking ncurses-base...
I: Unpacking ncurses-bin...
I: Unpacking libpam-modules:amd64...
I: Unpacking libpam-modules-bin...
I: Unpacking libpam-runtime...
I: Unpacking libpam0g:amd64...
I: Unpacking libpcre3:amd64...
I: Unpacking perl-base...
I: Unpacking sed...
I: Unpacking sensible-utils...
I: Unpacking login...
I: Unpacking passwd...
I: Unpacking libsystemd0:amd64...
I: Unpacking libudev1:amd64...
I: Unpacking sysvinit-utils...
I: Unpacking tar...
I: Unpacking tzdata...
I: Unpacking libustr-1.0-1:amd64...
I: Unpacking bsdutils...
I: Unpacking libblkid1:amd64...
I: Unpacking libfdisk1:amd64...
I: Unpacking libmount1:amd64...
I: Unpacking libsmartcols1:amd64...
I: Unpacking libuuid1:amd64...
I: Unpacking mount...
I: Unpacking util-linux...
I: Unpacking liblzma5:amd64...
I: Unpacking zlib1g:amd64...
I: Configuring required packages...
I: Configuring gcc-6-base:amd64...
I: Configuring lsb-base...
I: Configuring sensible-utils...
I: Configuring ncurses-base...
I: Configuring libsemanage-common...
I: Configuring libaudit-common...
I: Configuring libc6:amd64...
I: Configuring libbz2-1.0:amd64...
I: Configuring libgpg-error0:amd64...
I: Configuring libc-bin...
I: Configuring libdebconfclient0:amd64...
I: Configuring diffutils...
I: Configuring libcomerr2:amd64...
I: Configuring libcap-ng0:amd64...
I: Configuring libsepol1:amd64...
I: Configuring libgcc1:amd64...
I: Configuring libustr-1.0-1:amd64...
I: Configuring libsmartcols1:amd64...
I: Configuring libaudit1:amd64...
I: Configuring libtinfo5:amd64...
I: Configuring libudev1:amd64...
I: Configuring libattr1:amd64...
I: Configuring libss2:amd64...
I: Configuring liblzma5:amd64...
I: Configuring base-passwd...
I: Configuring e2fslibs:amd64...
I: Configuring liblz4-1:amd64...
I: Configuring debianutils...
I: Configuring libgcrypt20:amd64...
I: Configuring libncursesw5:amd64...
I: Configuring libdb5.3:amd64...
I: Configuring zlib1g:amd64...
I: Configuring hostname...
I: Configuring multiarch-support...
I: Configuring mawk...
I: Configuring libpcre3:amd64...
I: Configuring base-files...
I: Configuring libselinux1:amd64...
I: Configuring findutils...
I: Configuring libacl1:amd64...
I: Configuring ncurses-bin...
I: Configuring sed...
I: Configuring libsystemd0:amd64...
I: Configuring coreutils...
I: Configuring tar...
I: Configuring libsemanage1:amd64...
I: Configuring dpkg...
I: Configuring perl-base...
I: Configuring grep...
I: Configuring debconf...
I: Configuring tzdata...
I: Configuring gzip...
I: Configuring bsdutils...
I: Configuring dash...
I: Configuring init-system-helpers...
I: Configuring libpam0g:amd64...
I: Configuring libpam-modules-bin...
I: Configuring bash...
I: Configuring libpam-modules:amd64...
I: Configuring libpam-runtime...
I: Configuring passwd...
I: Configuring login...
I: Configuring libuuid1:amd64...
I: Configuring libblkid1:amd64...
I: Configuring libmount1:amd64...
I: Configuring mount...
I: Configuring libfdisk1:amd64...
I: Configuring util-linux...
I: Configuring e2fsprogs...
I: Configuring sysvinit-utils...
I: Configuring libc-bin...
I: Unpacking the base system...
I: Unpacking adduser...
I: Unpacking apt...
I: Unpacking libapt-pkg5.0:amd64...
I: Unpacking debian-archive-keyring...
I: Unpacking libstdc++6:amd64...
I: Unpacking gpgv...
I: Configuring the base system...
I: Configuring gpgv...
I: Configuring debian-archive-keyring...
I: Configuring libstdc++6:amd64...
I: Configuring adduser...
I: Configuring libapt-pkg5.0:amd64...
I: Configuring apt...
I: Configuring libc-bin...
I: Base system installed successfully.
warning: no apparent 'stretch/main' for '' on any of the following
  - http://snapshot.debian.org/archive/debian/20210701T143549Z
skipping 'stretch/main' ...
warning: no apparent 'stretch-security/main' for '' on any of the following
  - http://snapshot.debian.org/archive/debian-security/20210701T143549Z
skipping 'stretch-security/main' ...
warning: no apparent 'stretch-updates/main' for '' on any of the following
  - http://snapshot.debian.org/archive/debian/20210701T143549Z
skipping 'stretch-updates/main' ...
error: sources.list ended up empty -- something is definitely wrong
The command '/bin/sh -c debuerreotype-init /rootfs stretch "2021-07-01T14:35:49Z"' returned a non-zero code: 1

.slimify-excludes break groff functionality

The slim variants (at least buster-slim) break groff by excluding all files below /usr/share/groff/ in /etc/dpkg/dpkg.cfg.d/docker. A bit of digging led me to .slimify-excludes as the source for this.

I ran into the breakage when trying to convert manual pages for a project to HTML. All the groff macros are installed below /usr/share/groff/. Not installing them via the path-exclude completely breaks groff functionality. Even something like groff -man < inputfile works 😮

FTR, for a long time I also believed the content of this directory was not needed 🤦‍♂️

Suggestion: expose the epoch as a file in the rootfs

The epoch is already exposed in /etc/apt/sources.list as comment lines, but hard to parse it robustly:

root@b063b5cba10a:/# cat /etc/apt/sources.list
# deb http://snapshot.debian.org/archive/debian/20220912T000000Z bullseye main
deb http://deb.debian.org/debian bullseye main
# deb http://snapshot.debian.org/archive/debian-security/20220912T000000Z bullseye-security main
deb http://deb.debian.org/debian-security bullseye-security main
# deb http://snapshot.debian.org/archive/debian/20220912T000000Z bullseye-updates main
deb http://deb.debian.org/debian bullseye-updates main

Would it be possible to expose the epoch as a "plain" file too?

root@b063b5cba10a:/# cat /.debuerreotype/epoch
1662940800

root@b063b5cba10a:/# cat /.debuerreotype/snapshot
20220912T000000Z

/tmp mounted as a volume in raspbian.sh

The script raspbian.sh mounts /tmp as a volume in the container :

docker run \
--rm \
"${securityArgs[@]}" \
-v /tmp \
-w /tmp \
-e suite="$suite" \
-e TZ='UTC' -e LC_ALL='C' \
"$raspbianDockerImage" \

All the other scripts (build.sh, steamos.sh and ubuntu.sh) mount it as a tmpfs :

debuerreotype/build.sh

Lines 72 to 83 in 06573aa

docker run \
--rm \
"${securityArgs[@]}" \
--tmpfs /tmp:dev,exec,suid,noatime \
-w /tmp \
-e suite="$suite" \
-e timestamp="$timestamp" \
-e codenameCopy="$codenameCopy" \
-e eol="$eol" -e arch="$arch" -e qemu="$qemu" \
-e TZ='UTC' -e LC_ALL='C' \
--hostname debuerreotype \
"$dockerImage" \

What is the explanation for this difference ?

running it whithout being root

I'm trying to use debuerreotype without being root. I see debootstrap and chroot works fine with fakechroot+fakeroot, so I tried the same. But I got an error on the debootstrap part of the init:

$ PATH=$PATH:/usr/sbin fakechroot fakeroot /usr/sbin/debuerreotype-init rootfs stable `date +%FT%T`
[...]
W: Failure trying to run: chroot "/tmp/rootfs7" mount -t proc proc /proc
W: See /tmp/rootfs7/debootstrap/debootstrap.log for details
W: Failure trying to run: chroot "/tmp/rootfs7" mount -t sysfs sysfs /sys
W: See /tmp/rootfs7/debootstrap/debootstrap.log for details
W: Failure trying to run: chroot "/tmp/rootfs7" /sbin/ldconfig
W: See /tmp/rootfs7/debootstrap/debootstrap.log for details

error: 'debootstrap' failed!

  Full command:

    debootstrap --force-check-gpg --variant=minbase --merged-usr stable rootfs http://snapshot.debian.org/archive/debian/20190712T094924Z
[...]

But if I tried to execute the same debootstrap command independetly of debuerreotype it works fine:

$ fakechroot fakeroot debootstrap --force-check-gpg --variant=minbase --merged-usr stable rootfs http://snapshot.debian.org/archive/debian/20190712T094924Z

I tried to create my fake debootstrap binary:

#!/bin/sh

fakechroot fakeroot debootstrap $@

And then run debuerreotype, and this works fine until debeurretype needs to use unshare:

$ /usr/sbin/debuerreotype-init --debootstrap='fakedebootstrap' rootfs stable `date +%FT%T`
[...]
I: Unpacking the base system...
I: Base system installed successfully.
unshare: unshare failed: Operation not permitted

Weird, somehow fake*root commands are not "passing" the environment well to debootstrap. I tried to add fake*root commands also to the last debuerrotype-init, but fake*root commands don't like to nest and fail.

Any ideas?

Debconf config and template databases

Two related issues to be considered that together increase image size by ~1.5MB each time they are encountered in a Docker image.

  1. whenever a newly installed package has debconf config or templates, the respective database file gets updated: /var/cache/debconf/{config,templates}.dat
  2. these files both have automatic backups -old that are also updated when the regular file is changed

For the first, it might make sense to change debconf to use PackageDir (https://manpages.debian.org/buster/debconf-doc/debconf.conf.5.en.html#DRIVERS) so that each package only touches its own debconf template/config files rather than the two global database files to minimize changes to be just new files across Docker layers.

The second issue can be controlled by adding Backup: false in the specific debconf.conf stanza to not create backups of the debconf template/config database before modification. This should be safe/sane for containers. It may not be necessary to turn off the backups if using PackageDir, since most packages shouldn't be changing other packages debconf templates/config.

Missing man directories in "slim" variants causes some packages to fail to install

For example, postgresql-client-9.4 installs an alternative for psql.1 resulting in this failure to install (apt-get install postgresql-client in a debian:jessie-slim container):

Setting up postgresql-client-9.4 (9.4.12-0+deb8u1) ...                     
update-alternatives: using /usr/share/postgresql/9.4/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode
update-alternatives: error: error creating symbolic link `/usr/share/man/man1/psql.1.gz.dpkg-tmp': No such file or directory
dpkg: error processing package postgresql-client-9.4 (--configure): 
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of postgresql-client:
 postgresql-client depends on postgresql-client-9.4; however:
  Package postgresql-client-9.4 is not configured yet. 
                                                                                                                                                           
dpkg: error processing package postgresql-client (--configure):       
 dependency problems - leaving unconfigured

Leaving the empty directories behind should be enough to fix this, I think.

Use of apt-cacher-ng

Hi there!

It doesn't seem possible right now to use an apt cache like apt-cacher-ng when running debuerreotype-init.

It would be really helpful to save some bandwith :)

Do you think it's feasible?

Thank you!

Possible to source packages from an iso image or a local package repository?

Is it possible to use debuerreotype to create docker images from a (customized) Debian installer iso or a local package mirror? I understand reproducibility would always be given in this case, but it would still be useful to create a base image akin to the official Debian images but based on a custom, audited package source. Any pointers would be appreciated.
(Apologies for opening an issue about this, I could not find a more appropriate channel for questions)

Cannot `apt-get update` on arm64 with debian jessie

Currently running into an issue on arm64 with debian jessie, to reproduce:

root@eli-pet:~/go/src/github.com/docker/cli# docker run --rm debian:jessie apt-get update
Get:1 http://security.debian.org jessie/updates InRelease [44.9 kB]
Ign http://deb.debian.org jessie InRelease
Get:2 http://deb.debian.org jessie-updates InRelease [145 kB]
Get:3 http://deb.debian.org jessie Release.gpg [2420 B]
Get:4 http://deb.debian.org jessie Release [148 kB]
Get:5 http://deb.debian.org jessie-updates/main arm64 Packages [22.8 kB]
Get:6 http://deb.debian.org jessie/main arm64 Packages [8593 kB]
Fetched 8957 kB in 40s (221 kB/s)
W: Failed to fetch http://security.debian.org/debian-security/dists/jessie/updates/InRelease  Unable to find expected entry 'main/binary-arm64/Packages' in Release file (Wrong sources.list entry or malformed file)

E: Some index files failed to download. They have been ignored, or old ones used instead.
docker inspect debian:jessie
[
{
    "Id": "sha256:9245dedf71348bf1492222f329c7fb41ffd4e9a91af3a63179dc245dbd849f72",
        "RepoTags": [
            "debian:jessie"

        ],
        "RepoDigests": [
            "debian@sha256:8ae2506f34500fab08d15ce55b6fd65be34825d7cf8ebc4d6e1f281b234b3446",
        "debian@sha256:d68fe870fe9c7d71d98cf575c42e7c4c3e024c42581eaa116041aa6092430662"

        ],
        "Parent": "",
        "Comment": "",
        "Created": "2018-04-30T23:21:40.227952527Z",
        "Container": "ef873287d2c30508afaf501b4955d41698787408bce6f37f8bec4cce35899179",
        "ContainerConfig": {
            "Hostname": "ef873287d2c3",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

            ],
            "Cmd": [
                "/bin/sh",
            "-c",
            "#(nop) ",
            "CMD [\"bash\"]"

            ],
            "ArgsEscaped": true,
            "Image": "sha256:96a6772651ec9c21e793e387246eb9c7947d601b66b4c7491aefc205fd516e08",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {}

        },
        "DockerVersion": "17.06.2-ce",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

            ],
            "Cmd": [
                "bash"

            ],
            "ArgsEscaped": true,
            "Image": "sha256:96a6772651ec9c21e793e387246eb9c7947d601b66b4c7491aefc205fd516e08",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null

        },
        "Architecture": "arm64",
        "Os": "linux",
        "Size": 120187407,
        "VirtualSize": 120187407,
        "GraphDriver": {
            "Data": {
                "MergedDir": "/var/lib/docker/overlay2/1582423d7e4aca37e639eaf35778f9b27b1a437ffb9b8999010aa0c0c20abb74/merged",
                "UpperDir": "/var/lib/docker/overlay2/1582423d7e4aca37e639eaf35778f9b27b1a437ffb9b8999010aa0c0c20abb74/diff",
                "WorkDir": "/var/lib/docker/overlay2/1582423d7e4aca37e639eaf35778f9b27b1a437ffb9b8999010aa0c0c20abb74/work"

            },
            "Name": "overlay2"

        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:363f5d3921234174b7fc48925aa209e6459eff4d38b70536501fe6a1b0127c7c"

            ]

        },
        "Metadata": {
            "LastTagTime": "0001-01-01T00:00:00Z"

        }

}
]

ping @tianon

debuerreotype-apt-get hangs with interactive commands when script is disowned

executing "debuerreotype-apt-get buster dist-upgrade -yqq" runs normally when a script is running with a tty...however when the script is disowned (& disown)...it just hangs.

debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 6460 files and directories currently installed.)
Preparing to unpack .../tzdata_2020d-0+deb10u1_all.deb ...
Unpacking tzdata (2020d-0+deb10u1) over (2020a-0+deb10u1) ...
Setting up tzdata (2020d-0+deb10u1) ...

Current default time zone: 'Etc/UTC'
Local time is now: Sat Nov 7 00:03:08 UTC 2020.
Universal Time is now: Sat Nov 7 00:03:08 UTC 2020.
Run 'dpkg-reconfigure tzdata' if you wish to change it.

I even added the following to the script:
export TERM=linux
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none

Still continues to hang.

Same issue with:
debuerreotype-apt-get buster install -yqq --no-install-recommends iputils-ping iproute2

Any invocation of debuerreotype-apt-get with a non-interactive response works when disowned. For example:
debuerreotype-apt-get buster update -qq

Trying to build an "oldstable" ("jessie") tarball fails trying to download "gstreamer1.0-libav" (which nothing depends on and shouldn't be pulled in at all)

Somewhere between 20180426 and today, something has changed such that the following failure is 100% reproducible while trying to do something like ./build.sh --codename-copy output oldstable 'today' (where today can be replaced by any recent timestamp).

I've tried a number of things such as #39 which I thought would help because the error looks like a download failure so I was hoping my Squignix hack could help paper over the failure, but looking into it it's much more nefarious than that (see tianon/squignix#2 for where I initially filed a note about this). Here's the failure output with a bunch of context that I'll explain following:

+ debuerreotype-apt-get rootfs-sbuild install -y --no-install-recommends build-essential fakeroot
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  binutils bzip2 cpp cpp-4.9 dpkg-dev g++ g++-4.9 gcc gcc-4.9 libasan1
  libatomic1 libc-dev-bin libc6-dev libcilkrts5 libcloog-isl4 libdpkg-perl
  libfakeroot libgcc-4.9-dev libgdbm3 libgmp10 libgomp1 libisl10 libitm1
  liblsan0 libmpc3 libmpfr4 libquadmath0 libstdc++-4.9-dev libtimedate-perl
  libtsan0 libubsan0 linux-libc-dev make patch perl perl-modules xz-utils
Suggested packages:
  binutils-doc bzip2-doc cpp-doc gcc-4.9-locales debian-keyring g++-multilib
  g++-4.9-multilib gcc-4.9-doc libstdc++6-4.9-dbg gcc-multilib manpages-dev
  autoconf automake libtool flex bison gdb gcc-doc gcc-4.9-multilib
  libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan1-dbg
  liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libquadmath0-dbg
  glibc-doc libstdc++-4.9-doc make-doc ed diffutils-doc perl-doc
  libterm-readline-gnu-perl libterm-readline-perl-perl libb-lint-perl
  libcpanplus-dist-build-perl libcpanplus-perl libfile-checktree-perl
  liblog-message-simple-perl liblog-message-perl libobject-accessor-perl
Recommended packages:
  libalgorithm-merge-perl libfile-fcntllock-perl netbase rename
  libarchive-extract-perl libmodule-pluggable-perl libpod-latex-perl
  libterm-ui-perl libtext-soundex-perl libcgi-pm-perl libmodule-build-perl
  libpackage-constants-perl
The following NEW packages will be installed:
  binutils build-essential bzip2 cpp cpp-4.9 dpkg-dev fakeroot g++ g++-4.9 gcc
  gcc-4.9 libasan1 libatomic1 libc-dev-bin libc6-dev libcilkrts5 libcloog-isl4
  libdpkg-perl libfakeroot libgcc-4.9-dev libgdbm3 libgmp10 libgomp1 libisl10
  libitm1 liblsan0 libmpc3 libmpfr4 libquadmath0 libstdc++-4.9-dev
  libtimedate-perl libtsan0 libubsan0 linux-libc-dev make patch perl
  perl-modules xz-utils
0 upgraded, 39 newly installed, 0 to remove and 0 not upgraded.
Need to get 48.4 MB of archives.
After this operation, 171 MB of additional disk space will be used.
Get:1 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main libgdbm3 amd64 1.8.3-13.1 [30.0 kB]
Get:2 http://snapshot.debian.org/archive/debian-security/20180622T000000Z/ oldstable/updates/main perl-modules all 5.20.2-3+deb8u11 [2547 kB]
Get:3 http://snapshot.debian.org/archive/debian-security/20180622T000000Z/ oldstable/updates/main perl amd64 5.20.2-3+deb8u11 [2642 kB]
Get:4 http://snapshot.debian.org/archive/debian-security/20180622T000000Z/ oldstable/updates/main libasan1 amd64 4.9.2-10+deb8u1 [195 kB]
Get:5 http://snapshot.debian.org/archive/debian-security/20180622T000000Z/ oldstable/updates/main libatomic1 amd64 4.9.2-10+deb8u1 [9014 B]
Get:6 http://snapshot.debian.org/archive/debian-security/20180622T000000Z/ oldstable/updates/main libcilkrts5 amd64 4.9.2-10+deb8u1 [40.1 kB]
Get:7 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main libgmp10 amd64 2:6.0.0+dfsg-6 [253 kB]
Get:8 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main libisl10 amd64 0.12.2-2 [440 kB]
Get:9 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main libcloog-isl4 amd64 0.18.2-1+b2 [61.8 kB]
Get:10 http://snapshot.debian.org/archive/debian-security/20180622T000000Z/ oldstable/updates/main libgomp1 amd64 4.9.2-10+deb8u1 [37.8 kB]
Get:11 http://snapshot.debian.org/archive/debian-security/20180622T000000Z/ oldstable/updates/main libitm1 amd64 4.9.2-10+deb8u1 [29.3 kB]
Get:12 http://snapshot.debian.org/archive/debian-security/20180622T000000Z/ oldstable/updates/main liblsan0 amd64 4.9.2-10+deb8u1 [92.7 kB]
Get:13 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main libmpfr4 amd64 3.1.2-2 [527 kB]
Get:14 http://snapshot.debian.org/archive/debian-security/20180622T000000Z/ oldstable/updates/main libquadmath0 amd64 4.9.2-10+deb8u1 [129 kB]
Get:15 http://snapshot.debian.org/archive/debian-security/20180622T000000Z/ oldstable/updates/main libtsan0 amd64 4.9.2-10+deb8u1 [212 kB]
Get:16 http://snapshot.debian.org/archive/debian-security/20180622T000000Z/ oldstable/updates/main libubsan0 amd64 4.9.2-10+deb8u1 [82.4 kB]
Get:17 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main libmpc3 amd64 1.0.2-1 [39.3 kB]
Get:18 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main bzip2 amd64 1.0.6-7+b3 [46.9 kB]
Get:19 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main patch amd64 2.7.5-1 [109 kB]
Get:20 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main xz-utils amd64 5.1.1alpha+20120614-2+b3 [221 kB]
Get:21 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main binutils amd64 2.25-5+deb8u1 [3496 kB]
Get:22 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main libc-dev-bin amd64 2.19-18+deb8u10 [238 kB]
Get:23 http://snapshot.debian.org/archive/debian-security/20180622T000000Z/ oldstable/updates/main linux-libc-dev amd64 3.16.56-1+deb8u1 [1096 kB]
Get:24 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main libc6-dev amd64 2.19-18+deb8u10 [2003 kB]
Get:25 http://snapshot.debian.org/archive/debian-security/20180622T000000Z/ oldstable/updates/main cpp-4.9 amd64 4.9.2-10+deb8u1 [5002 kB]
Get:26 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main cpp amd64 4:4.9.2-2 [17.3 kB]
Get:27 http://snapshot.debian.org/archive/debian-security/20180622T000000Z/ oldstable/updates/main libgcc-4.9-dev amd64 4.9.2-10+deb8u1 [2066 kB]
Get:28 http://snapshot.debian.org/archive/debian-security/20180622T000000Z/ oldstable/updates/main gcc-4.9 amd64 4.9.2-10+deb8u1 [5184 kB]
Get:29 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main gcc amd64 4:4.9.2-2 [5136 B]
Get:30 http://snapshot.debian.org/archive/debian-security/20180622T000000Z/ oldstable/updates/main libstdc++-4.9-dev amd64 4.9.2-10+deb8u1 [1120 kB]
Get:31 http://snapshot.debian.org/archive/debian-security/20180622T000000Z/ oldstable/updates/main g++-4.9 amd64 4.9.2-10+deb8u1 [17.3 MB]
Get:32 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main g++ amd64 4:4.9.2-2 [1530 B]
Get:33 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main make amd64 4.0-8.1 [349 kB]
Get:34 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main libtimedate-perl all 2.3000-2 [42.2 kB]
Get:35 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main libdpkg-perl all 1.17.27 [1075 kB]
Get:36 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main dpkg-dev all 1.17.27 [1548 kB]
Get:37 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main build-essential amd64 11.7 [7114 B]
Get:38 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main libfakeroot amd64 1.20.2-1 [44.7 kB]
Get:39 http://snapshot.debian.org/archive/debian/20180622T000000Z/ oldstable/main fakeroot amd64 1.20.2-1 [84.7 kB]
Fetched 48.1 MB in 1min 6s (720 kB/s)
E: Failed to fetch http://snapshot.debian.org/archive/debian/20180622T000000Z/pool/main/g/gst-libav1.0/gstreamer1.0-libav_1.4.4-2_amd64.deb  Size mismatch

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

If you're more in-tune than I was the first 20 or so times I looked at this output, you might notice that not only is gstreamer1.0-libav not one of the 39 packages APT tried to download, it's also not listed as a dependency of anything being installed (and this is happening in a pretty standard/faithful minbase chroot -- basically just debuerreotype-init, dist-upgrade, followed by debuerreotype-minimizing-config), so uh, what??

I've tried re-ordering the lines in debuerreotype-gen-sources-list to match the order of https://salsa.debian.org/installer-team/apt-setup/tree/master/generators instead of https://wiki.debian.org/SourcesList#Example_sources.list (silly, but figure it was an easy change to rule out right off).

I've tried reproducing by using the current debian:jessie-slim Docker image and updating its sources.list to use the same exact snapshot.debian.org links (identical sources.list content), no avail.

I've tried removing the tmpfs that we build the rootfs on top of (just in case), no avail.

This is 100% reproducible at this point on several AWS hosts and my local machine, so I don't think it's environmental either.

My next attempt is going to be essentially doing a binary search of snapshot.debian.org timestamps to try and narrow down what's changed in the archive between the known-good and current timestamps to try and glean more clues. 😞

Additional backup files to clean up

Should cleanup remove the following -old backups (part of the :stable image)?

/var/cache/debconf/config.dat-old,templates.dat-old 716kb
/var/lib/dpkg/diversions-old,status-old 77kb
/etc/passwd-
/etc/group-

Also maybe /var/log/apt/* and /var/log/dpkg.log (both not part of the base images)

repository errors - did layout change on snapshot.debian.org?

Since this year our builds with debuerreotype fail, as some repositories seem to have changed on snapshot.debian.org.

For instance this fails now:

debuerreotype-apt-get output/20180109 update -qq
W: The repository 'http://snapshot.debian.org/archive/debian/20180109T000000Z stretch-updates Release' does not have a Release file.
E: Failed to fetch http://snapshot.debian.org/archive/debian-security/20180109T000000Z/dists/stretch/updates/main/binary-amd64/Packages 404 Not Found [IP: 185.17.185.185 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.

With build-all.sh we get similar errors:

wget -O output/20180109/amd64/unstable/Release.gpg http://snapshot.debian.org/archive/debian/20180109T000000Z/dists/unstable/Release.gpg
--2018-01-09 13:02:56-- http://snapshot.debian.org/archive/debian/20180109T000000Z/dists/unstable/Release.gpg
Resolving snapshot.debian.org (snapshot.debian.org)... 185.17.185.185, 2001:1af8:4020:b030:deb::185
Connecting to snapshot.debian.org (snapshot.debian.org)|185.17.185.185|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-01-09 13:02:57 ERROR 404: Not Found.

Remove timestamps from /etc/shadow

/etc/shadow has some columns with timestamps in it. In our case it is the third column which makes some trouble.

If we have two builds, one from day A and one from day B. Even if there are no changes in the packages there is still a change on the timestamps and resulting in a kinda "false" positive diff.

It would be greate if there would be an option to remove those timestamps on the debuerreotype-init script. Something like --patch-shadow.

Right now I'm doing it like here:

awk '{$3 = "0"}1' FS=':' OFS=':' /root/rootfs/etc/shadow > /root/rootfs/etc/shadow.tmp
mv /root/rootfs/etc/shadow.tmp /root/rootfs/etc/shadow
rm /root/rootfs/etec/shadow-

Reproducibility: timestamp of `/proc` changes when using bookworm?

I changed the image to bookworm to be able to build Ubuntu 22.04 images.
It seems that this host change breaks the reproduciblity of the images in a stupid-as-usual way: /proc gets a different mtime (from a buster-image):

 drwxr-xr-x   0        0        0        0 2022-06-11 20:18:32.000000 media/
 drwxr-xr-x   0        0        0        0 2022-06-11 20:18:32.000000 mnt/
 drwxr-xr-x   0        0        0        0 2022-06-11 20:18:32.000000 opt/
-drwxr-xr-x   0        0        0        0 2022-03-19 13:46:00.000000 proc/
+drwxr-xr-x   0        0        0        0 2022-06-11 20:18:32.000000 proc/
 drwx------   0        0        0        0 2022-06-11 20:18:32.000000 root/
 -rw-r--r--   0        0        0      571 2021-04-10 20:00:00.000000 root/.bashrc

Where the green line is from the image built on bullseye. The mtime of the bookworm image corresponds to the InRelease timestamp (I build debian from live repos with --non-debian), so this is done by debuerreotype-fixup. The older time is from the data.tar.xz in the base-files package.

I don't see why bookworm would modify /proc, but bullseye would not. If bullseye would modify /proc, I'd expect it to be moved back to $epoch as well. Any ideas?

make unshare usage optional

Related to #117, it would be useful for some folks (such as in #112) if the usage of unshare were optional somehow -- for example, debootstrap itself has support for running in environments where mount is not allowed, and it would be interesting if debuerreotype did too (so you could have a Dockerfile that builds a fully reproducible rootfs too, for example).

Support other mirrors than snapshot

I'm running into problems related on snapshot.debian.org which let me wish to switch to another mirror during my build process.

E: The repository 'http://snapshot.debian.org/archive/debian-security/20191121T103747Z stable/updates Release' is not signed.

This is now a bit tricky: On one side we want reproducible builds and on the other side we want up2date builds. I would like to see something like a mirror option where I could say "please use this mirror instead of snapshot" which implicates to use "now" as date to fetch packages. This would be reproducible for at least a few hours until one of the packages the image is using is getting updated.

I think this could be done right now by using the --non-debian switch. But this is a bit confusing and more a hack. Like my current hack to override the output of .snapshot-url.sh.

Any thoughts on this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.