Package: mmdebstrap
Version: 0.7.5-2.2
Severity: normal

Hi,

I want to use mmdebstrap combined with APT pinning in a consistent way
(i.e. that mmdebstrap behaves the same in normal and dry-run mode), but
I failed to do so. To demonstrate the issue, I constructed a simple test
case: This test case defines bullseye and bookworm as mirrors and has an
APT pinning config to set the priority of bookworm packages below the
priority of bullseye packages. Without the pinning, the bookworm
packages will be newer and installed. With pinning, the bullseye
packages will be installed instead. Then install the package
`python3-minimal` from bullseye and let APT select the package version
for `python3`. Both packages need to be installed from the same release.
Otherwise APT will complain. That way the used pinning can be tested.

APT pinning is configured in `/etc/apt/preferences` and
`/etc/apt/preferences.d`. The location can be configured with the
settings `Dir::Etc::preferences` and `Dir::Etc::preferencesparts`. In
the test case, I am setting `Dir::Etc::preferencesparts`.

APT pinning `preferences.d/bookworm.pref`:

```
Package: *
Pin: release l=Debian,n=bookworm
Pin-Priority: 400
```

Here is the `pinning.yaml` configuration as YAML file for bdebstrap:

```
---
mmdebstrap:
  aptopts:
    - Dir::Etc::preferencesparts "$CURDIR/preferences.d/"
  essential-hooks:
    - copy-in preferences.d/bookworm.pref /etc/apt/preferences.d
  keyrings:
    - /usr/share/keyrings/debian-archive-keyring.gpg
  mirrors:
    - deb http://deb.debian.org/debian bullseye main
    - deb http://deb.debian.org/debian bookworm main
  packages:
    - python3-minimal/bullseye
    - python3
  suite: bullseye
  target: root.tar
  variant: minbase
name: pinning-example
```

You have to set `$CURDIR` in the example above to the absolute path of your
current working directory.

1) If I specify a relative directory in `Dir::Etc::preferencesparts`, the
configuration is ignored.

2) If I set `Dir::Etc::preferencesparts` to an absolute path, it works in
`--dry-run`, but fails in the normal mode:

```
I: installing remaining packages inside the chroot...
Reading package lists...
Building dependency tree...
mawk is already the newest version (1.3.4.20200120-2).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3 : PreDepends: python3-minimal (= 3.9.7-1) but 3.9.2-3 is to be 
installed
           Depends: python3.9 (>= 3.9.7-0~) but it is not going to be installed
           Depends: libpython3-stdlib (= 3.9.7-1) but it is not going to be 
installed
W: Unable to read /home/user/path/to/preferences.d/ - DirectoryExists (2: No 
such file or directory)
```

I tested this in a minimal Debian schroot:

```
apt -y install mmdebstrap
mkdir -p preferences.d
printf 'Package: *\nPin: release l=Debian,n=bookworm\nPin-Priority: 400\n' > 
preferences.d/bookworm.pref
mmdebstrap -v --variant=minbase \
  --aptopt="Dir::Etc::preferencesparts \"$(pwd)/preferences.d/\"" \
  --include=python3-minimal/bullseye,python3 \
  --essential-hook="copy-in preferences.d/bookworm.pref /etc/apt/preferences.d" 
\
  bullseye root.tar \
  "deb http://deb.debian.org/debian bullseye main" \
  "deb http://deb.debian.org/debian bookworm main"
```

It fails on a Debian bullseye schroot, but succeeds on an unstable
schroot. Since the mmdebstrap version from unstable needs a newer APT
version, there is no easy way for backporting.

Is setting `Dir::Etc::preferencesparts` to an absolute path the way to
go forward? In this case it would be nice if I could set
`Dir::Etc::preferencesparts` to something like "$CURDIR/preferences.d/"
and let mmdebstrap resolve it to the absolute path.

-- 
Benjamin Drung

Senior DevOps Engineer and Debian & Ubuntu Developer
Compute Platform Operations Cloud

IONOS SE | Revaler Str. 30 | 10245 Berlin | Deutschland
E-Mail: [email protected] | Web: www.ionos.de

Hauptsitz Montabaur, Amtsgericht Montabaur, HRB 24498

Vorstand: Hüseyin Dogan, Dr. Martin Endreß, Claudia Frese, Henning
Kettler, Arthur Mai, Britta Schmidt, Achim Weiß
Aufsichtsratsvorsitzender: Markus Kadelke


Member of United Internet

Reply via email to