On Fri, 2026-11-20 at 06:03 +0100, Johannes Schauer Marin Rodrigues
wrote:
> Hi,
> 
> Quoting Benjamin Drung (2026-11-19 22:42:43)
> > Package: mmdebstrap
> > Version: 1.7.0-5
> > Severity: normal
> > Tags: ftbfs
> 
> I don't think this is the correct tag because this is not mmdebstrap failing 
> to
> build on Ubuntu but mmdebstrap not being able to create chroots for Ubuntu, 
> no?
> 

Yes, that tag is wrong. No idea how I happen to add that.

> > X-Debbugs-Cc: [email protected], [email protected]
> > User: [email protected]
> > Usertags: amd64
> > 
> > Dear Maintainer,
> > 
> > mmdebstrap fails to build images for Ubuntu xenial:
> > 
> > ```
> > $ mmdebstrap xenial xenial.tar http://archive.ubuntu.com/ubuntu
> > I: automatically chosen mode: unshare
> > I: chroot architecture amd64 is equal to the host's architecture
> > I: finding correct signed-by value...
> > done
> > I: automatically chosen format: tar
> > I: using /tmp/mmdebstrap.SPrWJ7eEHl as tempdir
> > I: running apt-get update...
> > done
> > I: downloading packages with apt...
> > done
> > I: extracting archives...
> > done
> > I: installing essential packages...
> > done
> > [...]
> > Setting up systemd (229-4ubuntu21.31) ...
> > Created symlink /etc/systemd/system/getty.target.wants/[email protected], 
> > pointing to /lib/systemd/system/[email protected].
> > Created symlink 
> > /etc/systemd/system/multi-user.target.wants/remote-fs.target, pointing to 
> > /lib/systemd/system/remote-fs.target.
> > Created symlink 
> > /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service, 
> > pointing to /lib/systemd/system/systemd-timesyncd.service.
> > Initializing machine ID from random generator.
> > Adding group `systemd-journal' (GID 101) ...
> > Done.
> > chfn: PAM: Critical error - immediate abort
> > adduser: `/usr/bin/chfn -f systemd Time Synchronization systemd-timesync' 
> > returned error code 1. Exiting.
> > dpkg: error processing package systemd (--install):
> >  subprocess installed post-installation script returned error exit status 1
> 
> Why do you suspect mmdebstrap to be the problem, given the above? Did you
> investigate the reason for chfn exiting with a ciritical error related to pam?

I reported a tracking bug in Ubuntu and thought that I can forward it to
Debian since Debian is affected as well. So it could be in pam or
passwd.

> It reminds me of a problem we used to have six years ago with mmdebstrap
> running in "proot" mode (that mode no longer exists). Under proot, one would
> get the following in the systemd postinst:
> 
> chfn: PAM: System error
> adduser: `/usr/bin/chfn -f systemd Time Synchronization systemd-timesync' 
> returned error code 1. Exiting.
> 
> And here is a similar error with fakechroot
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=745082#75
> 
> And here is the issue with proot: https://github.com/proot-me/PRoot/issues/156
> 
> So in either case it wasn't mmdebstrap doing the wrong thing. Can you present
> evidence that this is actually a bug in mmdebstrap?

Thanks. That was a helpful pointer. I tracked down the upstream change
for pam and tested it: It still did not fix it. After more
investigation, I found a solution for that part: libpam-runtime should
be configured before systemd. Workaround demonstrate that:

mmdebstrap --extract-hook='for f in common-auth common-account common-
session common-password; do printf "auth sufficient
pam_permit.so\naccount sufficient pam_permit.so\nsession sufficient
pam_permit.so\npassword sufficient pam_permit.so\n" > "$1/etc/pam.d/$f";
done' xenial xenial.tar http://archive.ubuntu.com/ubuntu

Is this something that should be done by mmdebstrap?

It now fails at a later stage:

```
I: installing remaining packages inside the chroot...
[...]
Setting up makedev (2.3.1-93ubuntu2~ubuntu16.04.1) ...
grep: /proc/1/environ: Permission denied
mknod: mem-: Operation not permitted
makedev mem c 1 1 root kmem 0640: failed
mknod: kmem-: Operation not permitted
[...]
```

This looks like a bug in the postinst of makedev. makedev has this
check:


if which systemd-detect-virt > /dev/null; then
    if container=$(systemd-detect-virt -c)
    then
        echo "$container container detected, aborting due to container-
managed /dev."
        exit 0
    fi
fi

but this does not seem to take action. As alternative, mmdebstrap could
create those dev devices before configuring makedev (makedev checks with
"test -e /dev/<dev>").

> > The systemd package calls:
> > 
> > adduser --quiet --system --group --no-create-home --home /run/systemd \
> >     --gecos "systemd Time Synchronization" systemd-timesync
> > 
> > Then adduser calls /usr/bin/chfn from passwd.
> > 
> > I compared xenial with bionic: on xenial systemd is installed as part of
> > the essential packages, but on bionic systemd is part of the remaining
> > packages.
> 
> Still sounds like a bug in one of the involved packages to me and not like a
> bug in mmdebstrap.
> 
> > mmdebstrap also fails to build images for Ubuntu trusty:
> > 
> > ```
> > $ mmdebstrap trusty trusty.tar http://archive.ubuntu.com/ubuntu
> > I: automatically chosen mode: unshare
> > I: chroot architecture amd64 is equal to the host's architecture
> > I: finding correct signed-by value...
> > done
> > I: automatically chosen format: tar
> > I: using /tmp/mmdebstrap.w0v46VeV27 as tempdir
> > I: running apt-get update...
> > done
> > I: downloading packages with apt...
> > done
> > I: extracting archives...
> > done
> > I: installing essential packages...
> > done
> > dpkg: error: failed to open package info file `/var/lib/dpkg/available' for 
> > reading: No such file or directory
> 
> /var/lib/dpkg/available is no longer needed since dpkg 1.17.11, so mmdebstrap
> stopped writing it. For creating chroots for older releases, have a look at 
> the
> jessie-or-older hooks shipped by mmdebstrap. Using these you can create 
> chroots
> for Debian unstable going as far back as 2006-08-04 using snapshot.debian.org.
> That should be more than sufficient for Ubuntu, no?

Thanks for this pointer. I tried:

mmdebstrap trusty trusty.tar "deb [trusted=yes] 
http://de.archive.ubuntu.com/ubuntu trusty main universe
deb [trusted=yes] http://de.archive.ubuntu.com/ubuntu trusty-updates main 
universe" -v --hook-dir=/usr/share/mmdebstrap/hooks/jessie-or-older

The jessie-or-older/extract01.sh scripts fails with dpkg complaining
about a missing awk. Attached a tested patch for mmedebstrap to also try
to install mawk. I successfully tested that the jessie command from the
man page still works.

With this patch trusty gets as far as the xenial case mentioned above.

> > I know that these are old Ubuntu releases, but they still get paid
> > support by Canonical. I like to use sbuild unshare to build package for
> > these releases.
> 
> I'm not here to volunteer my freetime for Canonical. If somebody is paying
> money for this, then they should pay a person to fix these things. I hope I 
> was
> able to give you sufficient feedback for such a thing to happen.

Thanks. Your feedback was very helpful to help me move this topic
further. Feedback on my comments above will be appreciated.

-- 
Benjamin Drung
Debian & Ubuntu Developer
From 985c5f9f709dec11384141002006ee5bad8e0dea Mon Sep 17 00:00:00 2001
From: Benjamin Drung <[email protected]>
Date: Tue, 24 Nov 2026 16:30:46 +0100
Subject: [PATCH] hooks/jessie-or-older: also install mawk (for Ubuntu)

Ubuntu 14.04 LTS "trusty" needs the jessie-or-older hook. In contrast to
Debian jessie, Ubuntu's base-files pre-depends on awk (and mawk provides
awk).

Bug: https://bugs.debian.org/1154510
---
 hooks/jessie-or-older/extract01.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hooks/jessie-or-older/extract01.sh b/hooks/jessie-or-older/extract01.sh
index 43f1540..9be8ba3 100755
--- a/hooks/jessie-or-older/extract01.sh
+++ b/hooks/jessie-or-older/extract01.sh
@@ -25,6 +25,7 @@ fi
 fname_base_passwd=
 fname_base_files=
 fname_dpkg=
+fname_mawk=
 for pkg in $MMDEBSTRAP_ESSENTIAL; do
 	pkgname=$(dpkg-deb --show --showformat='${Package}' "$TARGET/$pkg")
 	# shellcheck disable=SC2034
@@ -32,10 +33,11 @@ for pkg in $MMDEBSTRAP_ESSENTIAL; do
 		base-passwd) fname_base_passwd=$pkg;;
 		base-files)  fname_base_files=$pkg;;
 		dpkg)        fname_dpkg=$pkg;;
+		mawk)        fname_mawk=$pkg;;
 	esac
 done
 
-for var in base_passwd base_files dpkg; do
+for var in mawk base_passwd base_files dpkg; do
 	eval 'val=$fname_'"$var"
 	[ -z "$val" ] && continue
 	chroot "$TARGET" dpkg --install --force-depends "$val"
-- 
2.53.0

Reply via email to