Your message dated Wed, 07 Oct 2026 16:13:07 +0200
with message-id <179138238776.21057.3351277367467377543@localhost>
and subject line Re: Bug#1004302: mmdebstrap: Unable to specify APT pinning 
(via Dir::Etc::preferencesparts)
has caused the Debian Bug report #1004302,
regarding mmdebstrap: Unable to specify APT pinning (via 
Dir::Etc::preferencesparts)
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1004302: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1004302
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
Hi,

I'm going over old bugs right now.

Quoting Johannes Schauer Marin Rodrigues (2022-01-25 21:22:59)
> > Now I am trying to get this feature working with bdebstrap/mmdebstrap.
> > --simulate can do address point one and three. Point 2 can be done with a
> > custom APT solver.
> 
> No need for a custom apt solver. If you just want to check whether apt 
> installs
> the stuff you expect, then you can make use of /usr/lib/apt/solvers/apt which
> offers an EDSP interface to the apt solver. You could also use dose3 to ask
> whether there exists a valid installation set but I think you want the exact
> solution that apt would choose.  That's where /usr/lib/apt/solvers/apt comes
> in. By feeding it your problem in the EDSP format [1] you can then parse the
> result to find out what solution (if any) apt would go for. The advantage is,
> that the input and output are in a well defined machine readable format and 
> you
> don't have to parse the output of apt-get --simulate which is intended for
> human parsers.

The script /usr/lib/apt/solvers/mmdebstrap-dump-solution exists to provide in a
machine-readable format the solution that apt goes for and avoids having to
parse the output of --simulate which is not meant to be a stable
machine-readable format.

mmdebstrap used this script internally to get the filenames of downloaded
packages until I learned about -oDpkg::Pre-Install-Pkgs::=cat

I'm closing this bug. Please re-open if there is more to discuss.

Thanks!

cheers, josch

Attachment: signature.asc
Description: signature


--- End Message ---

Reply via email to