• DEP 17: Improve support for directory aliasing in dpkg

    From Helmut Grohne@21:1/5 to All on Mon Apr 3 14:10:01 2023
    XPost: linux.debian.maint.dpkg

    Hi,

    I have been looking into the aliasing problems in dpkg on behalf of
    Freexian's Debian funding. To that end I proposed a possible way forward
    last year (https://lists.debian.org/debian-dpkg/2022/11/msg00007.html),
    but the feedback I got was not particularly helpful in determining
    consensus. A little later, Simon Richter also looked into the problem (https://lists.debian.org/debian-dpkg/2022/12/msg00023.html), but
    remained silent after the initial post. Little happened since then. Now
    Raphael Hertzog proposed to use the DEP process to get this thing
    unstuck and with the help of Emilio Pozuelo Monfort I created a draft
    for discussion. I allocate number 17 via debian-project@l.d.o. What
    follows is the draft text. Please consider it to be a piece of best
    intentions at reconciling feedback wherever I could. At the time of this writing it certainly is not consensus, but consensus is what I seek
    here. Without further ado, the full DEP text follows after my name
    while it also is available at https://salsa.debian.org/dep-team/deps/-/merge_requests/5

    Helmut

    Introduction
    ============

    At its core, `dpkg` assumes that every filename uniquely refers to a
    file on disk. The situation where two distinct filenames refer to the
    same file on disk is referred to as aliasing. Violating this assumption
    leads to undefined behaviour such as file loss. The assumption is
    commonly violated when a leading directory component contains a symbolic
    link. A situation where this is known to cause file loss happens when a
    file is moved from one binary package to another binary package while at
    the same time changing the filename in a way that retains its final
    location. In this situation, `dpkg` may first unpack the new replacing location and then remove the replaced package thus unknowingly remove
    the aliased file. Other components such as `dpkg-divert` or `update-alternatives` are likely affected in similar ways.

    The purpose of this DEP is selecting and implementing a change to `dpkg`
    to improve the way it handles such situations that affect typical Debian installations.

    Naive solution
    ==============

    In theory, `dpkg` could resolve this automatically. For every file it
    touches, it could canonicalize the location using the actual filesystem
    and check whether any other installed file has the same canonicalized
    location. Unfortunately, `dpkg` cannot know which filenames can
    collide, so it would check every filename in its database. For canonicalization, it would `stat()` every component of every filename.
    This easily amounts to a million or more `stat()` calls on larger installations. Caching could reduce the impact somewhat, but since
    Debian introduces aliases during maintainer scripts, it would have to invalidate the cache after maintainer scripts have been run. The
    resulting performance would be unacceptable.

    Proposal
    ========

    In order to handle aliasing efficiently, `dpkg` gains new options
    `--add-alias <symlink>`, `--remove-alias <symlink>` and
    `--list-aliases`. When creating symbolic links that cause aliasing
    effects, the creating entity is supposed to inform `dpkg` using an
    appropriate invocation. Doing so records the aliasing information in a
    new mapping inside its administrative directory. No existing
    administrative files are modified as a result of this operation. When
    `dpkg` operates on paths, it can compute a canonicalized version using a
    pure function without the need to `stat()` files on disk thus greatly
    improving performance. Canonicalized paths are only needed when
    determining whether a file conflict exists. In all other cases,
    original paths continue to be used as symbolic links will be followed by filesystem operations. The `--add-alias` operation records the target
    of the symbolic link that must exist prior to invocation. The
    `--remove-alias` operation fails if any files are still installed in the aliased location.

    Rejected proposals
    ==================

    Hardcoding aliases into dpkg
    ----------------------------

    It was suggested to include a static aliasing mapping into the `dpkg`
    source code. Since `dpkg` is used by multiple projects in different
    ways (not necessarily Debian-derivatives), this approach would break
    other consumers. Also note that Debian's `dpkg` can be used to operate
    on an installation using different aliases via the `--root` flag. As
    such the alias mapping needs to be a property of the installation.

    Modifying package lists in place
    --------------------------------

    `dpkg` could rewrite the extracted `.list` files from `control.tar` and
    store paths in canonicalized form. Canonicalization would happen as
    when a `control.tar` is extracted. It would also happen either as a
    one-time conversion during the upgrade of `dpkg` or whenever a `.list`
    file is read. Given canonicalized list files, string comparison on
    files would support conflict detection. Other pieces to be updated in a similar way include `alternatives`, `diversions`, `statoverride`, and `triggers`.

    This would affect the output of `dpkg -S`, which would then output canonicalized paths. Packages generated by `dpkg-repack` would have
    their contents canonicalized as well.

    Managing the aliasing mapping using a control file --------------------------------------------------

    It was suggested that the mapping could be managed via a special control
    file `canonical`. Given that aliasing is not a common operation, the
    benefit of handling it declaratively is minor. Beyond that, aliasing
    can also happen as an customization issued by an administrator.
    Therefore, a command line based approach is preferred.

    Having dpkg move files and create symbolic links ------------------------------------------------

    When instructed with `--add-alias`, `dpkg` could also create the
    corresponding symbolic links and move the affected files to their new
    location. While that would be convenient, doing so is non-trivial in an
    atomic way. Sometimes, the underlying filesystem does not fully conform
    to POSIX (e.g. `overlayfs`) and such corner cases need to be managed individually. Since such an implementation already exists outside
    `dpkg` and its complexity is non-trivial, the moving of files shall
    remain external. In case aliases are setup in a bootstrap setting, no
    moves are necessary.

    Implement aliasing after metadata tracking ------------------------------------------

    The [metadata tracking](https://wiki.debian.org/Teams/Dpkg/Spec/MetadataTracking)
    feature enhances `dpkg` with knowledge about filesystem metadata for
    installed files. This includes knowledge of symbolic links, which would
    help with tracking aliasing. Unfortunately, progress on this is fairly
    slow and we think that aliasing support is more urgent.

    Proposal internals
    ==================

    A new file `aliases` is added to the administrative directory. Pairs of
    lines containing link name and destination indicate an alias. Within
    this file, no link name or destination may contain another link name.
    The `--add-alias` and `--remove-alias` options change this file only and
    must ensure that the properties are retained. This leads to a trivial algorithm for canonicalizing paths. A given path can be scanned for
    recorded link names as sub path and have them replaced with the recorded destination. This process is repeated until a scan passes without
    performing a substitution. Usually, two scan passes will be sufficient.

    Much of the internal work has been prototyped by [Simon Richter](https://salsa.debian.org/sjr/dpkg/-/tree/wip-canonical-paths)
    and can be used. It demonstrates how the `fsys_namenode` can be
    augmented with a canonicalized path and how `fsys_hash_find_node` can be extended with a new flag to differentiate between lookups considering
    aliases or exact names. It differs from what is proposed here in the
    API to configure aliases and in possibly storing partially canonicalized versions of file names.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Raphael Hertzog@21:1/5 to Helmut Grohne on Fri Apr 21 15:10:02 2023
    XPost: linux.debian.maint.dpkg

    Hello,

    I'd like to offer some food for thoughts on this issue.

    From what I have understood, Guillem would rather avoid committing
    to a new public interface for this specific use-case, i.e. the
    fact that the DEP is suggesting "dpkg --add-alias" is problematic
    because that feature will be useless when we will have moved
    to .deb shipping files in /usr only.

    However the problem of file loss through aliased directories is a broader problem, it is not specific to this transition. It's quite possible that a package is shipping a symlink pointing to a directory and to have other packages installing files through that symlink (and then move those files between binary packages and between their two possible locations).

    Let's try to tackle that problem in a generic way without requiring
    any external information... it ought to be doable. You did consider
    it partly already:

    On Mon, 03 Apr 2023, Helmut Grohne wrote:
    Naive solution
    ==============

    In theory, `dpkg` could resolve this automatically. For every file it touches, it could canonicalize the location using the actual filesystem
    and check whether any other installed file has the same canonicalized location. Unfortunately, `dpkg` cannot know which filenames can
    collide, so it would check every filename in its database. For canonicalization, it would `stat()` every component of every filename.
    This easily amounts to a million or more `stat()` calls on larger installations. Caching could reduce the impact somewhat, but since
    Debian introduces aliases during maintainer scripts, it would have to invalidate the cache after maintainer scripts have been run. The
    resulting performance would be unacceptable.

    Here you are considering all files, but for the purpose of our issue,
    we can restrict ourselves to the directories known by dpkg. We really
    only care about directories that have been turned into symlinks (or
    packaged symlinks that are pointing to directories). That's a a much lower number of paths that we would have to check.

    You are speaking of having some sort of cache and I certainly agree
    that it would make sense to have such a cache.

    We could decide that /var/lib/dpkg/aliases is that cache, it would
    be the result of a scan of all directories known by dpkg (i.e. all
    paths known by dpkg where files are installed through that path) and
    it would list the target directory in case that path is a symlink.
    The absence of a directory in that file would mean that, according to
    dpkg, the directory ought to be a real directory.

    Thus this time-consuming operation would be done once, the first
    time that the updated dpkg starts and when /var/lib/dpkg/aliases
    does not yet exist.

    That cache file would be kept up-to-date by the various dpkg invocations:
    - when you install a new .deb containing a symlink pointing to a
    directory, that new "aliased path" is added to this file
    - when dpkg removes a symlink that is listed in the aliases file, we drop
    it too

    We don't add any new public interface to dpkg, but we also have the
    possibility to remove to /var/lib/dpkg/aliases to force an new scan
    (some sort of "dpkg --refresh-aliases" without an official name).

    It might still be cleaner to have that "dpkg --refresh-aliases" command
    so that we can invoke it for example in "dpkg-maintscript-helper symlink_to_dir/dir_to_symlink" when we are voluntarily turning a directory
    into a symlink (or vice-versa).

    In any case, now that you have a database of aliases, you can do the other modifications to detect conflicting files and avoid file losses.

    How does that sound?

    Implement aliasing after metadata tracking ------------------------------------------

    The [metadata tracking](https://wiki.debian.org/Teams/Dpkg/Spec/MetadataTracking)
    feature enhances `dpkg` with knowledge about filesystem metadata for installed files. This includes knowledge of symbolic links, which would
    help with tracking aliasing. Unfortunately, progress on this is fairly
    slow and we think that aliasing support is more urgent.

    The proposal I made above is not a real database in the sense that we
    don't record what was shipped by the .deb when we installed the files...
    it's rather the opposite, it analyzes the system to detect possible
    conflicts with dpkg's view of the system.

    It can be seen as complimentary to it. In any case, I don't see how implementing metadata tracking would help to solve the problem that we
    have today. dpkg would know that all .deb have /bin as a directory and
    not as a symlink, and it would be able to conclude that the directory
    has been replaced by a symlink by something external, but that's it.

    It should still accept that replacement and do its best to work with it.

    Cheers,
    --
    ⢀⣴⠾⠻⢶⣦⠀ Raphaël Hertzog <hertzog@debian.org>
    ⣾⠁⢠⠒⠀⣿⡁
    ⢿⡄⠘⠷⠚⠋ The Debian Handbook: https://debian-handbook.info/get/
    ⠈⠳⣄⠀⠀⠀⠀ Debian Long Term Support: https://deb.li/LTS

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Raphael Hertzog@21:1/5 to Helmut Grohne on Fri Apr 21 14:20:01 2023
    XPost: linux.debian.maint.dpkg

    Hello,

    On Mon, 03 Apr 2023, Helmut Grohne wrote:
    Please consider it to be a piece of best
    intentions at reconciling feedback wherever I could. At the time of this writing it certainly is not consensus, but consensus is what I seek
    here. Without further ado, the full DEP text follows after my name
    while it also is available at https://salsa.debian.org/dep-team/deps/-/merge_requests/5

    I'd like to express some disappointment that nobody replied publicly
    sofar. Last year's developer survey concluded that "Debian should complete
    the merged-/usr transition" was the most important project for Debian [1] (among those proposed in the survey). That's what we are trying to do
    here and it would be nice to build some sort of consensus on what it means
    in terms of changes for dpkg.

    I know that Guillem (dpkg's maintainer) is generally opposed to the
    approach that Debian has followed to implement merged-/usr but I have
    yet to read his concerns on the changes proposed here (besides the fact
    that they ought to not be needed because we should redo the transition
    in another way, but that's a ship that has sailed a long time ago...).

    The rough project consensus seems to be that we should modify dpkg to
    avoid the cases where some files can disappear upon upgrades. Most people
    don't really care how we modify dpkg for this, and I can't blame them, but given that dpkg's maintainer seems unwilling to work on this problem,
    someone else has to come up with a design, implement it and get it applied
    on Debian's version of dpkg.

    We are committed to work on the design and implementation but we want to
    make sure the design is sound and agreed upon by the persons who are technically knowledgeable on this issue and who have thought a lot on this issue. There aren't that many persons in that set but it is also not empty.
    So please read the DEP and share your feedback, even if it's just "I have
    read it and it sounds fine", it will definitely help.

    Thank you!

    [1] page 28-32 of https://debian.pages.debian.net/dd-surveys/dd-survey-analysis-2022.pdf
    --
    ⢀⣴⠾⠻⢶⣦⠀ Raphaël Hertzog <hertzog@debian.org>
    ⣾⠁⢠⠒⠀⣿⡁
    ⢿⡄⠘⠷⠚⠋ The Debian Handbook: https://debian-handbook.info/get/
    ⠈⠳⣄⠀⠀⠀⠀ Debian Long Term Support: https://deb.li/LTS

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luca Boccassi@21:1/5 to Raphael Hertzog on Fri Apr 21 16:50:03 2023
    XPost: linux.debian.maint.dpkg

    On Fri, 21 Apr 2023 at 13:16, Raphael Hertzog <hertzog@debian.org> wrote:

    Hello,

    On Mon, 03 Apr 2023, Helmut Grohne wrote:
    Please consider it to be a piece of best
    intentions at reconciling feedback wherever I could. At the time of this writing it certainly is not consensus, but consensus is what I seek
    here. Without further ado, the full DEP text follows after my name
    while it also is available at https://salsa.debian.org/dep-team/deps/-/merge_requests/5

    I'd like to express some disappointment that nobody replied publicly
    sofar. Last year's developer survey concluded that "Debian should complete the merged-/usr transition" was the most important project for Debian [1] (among those proposed in the survey). That's what we are trying to do
    here and it would be nice to build some sort of consensus on what it means
    in terms of changes for dpkg.

    I know that Guillem (dpkg's maintainer) is generally opposed to the
    approach that Debian has followed to implement merged-/usr but I have
    yet to read his concerns on the changes proposed here

    There was an answer from the maintainer, 2 weeks ago: https://lists.debian.org/debian-dpkg/2023/04/msg00001.html
    Essentially, the answer was "no", so...

    After Bookworm ships I plan to propose a policy change to the CTTE and
    policy maintainers to forbid shipping files in the legacy directories altogether, followed by a debhelper change to adjust any stragglers automatically at build time and a mass rebuild, plus MBF for the small
    % that does not use dh and a piuparts test to stop migration for
    anything that is uploaded and doesn't comply. That should bring the
    matter to an end, without needing to modify dpkg.

    Kind regards,
    Luca Boccassi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon Richter@21:1/5 to Raphael Hertzog on Fri Apr 21 19:30:02 2023
    XPost: linux.debian.maint.dpkg

    Hi,

    On 21.04.23 15:03, Raphael Hertzog wrote:

    Here you are considering all files, but for the purpose of our issue,
    we can restrict ourselves to the directories known by dpkg. We really
    only care about directories that have been turned into symlinks (or
    packaged symlinks that are pointing to directories). That's a a much lower number of paths that we would have to check.

    Having all paths in the database is cheaper, because doubling the number
    of paths multiplies the (average) cost by log_{262144} 2 only, and we do significantly more lookups than inserts.

    The other problem is that we do not know all of these paths, because the
    file system has been modified externally without informing dpkg. The
    closest thing we can do is scan everything that is supposed to be a
    directory.

    As an additional complication, dpkg silently resolves
    symlink-vs-directory conflicts in favour of the directory (which happens seldom, but third-party tools sometimes generate broken packages like
    that, so it is useful to keep it that way).

    Thus this time-consuming operation would be done once, the first
    time that the updated dpkg starts and when /var/lib/dpkg/aliases
    does not yet exist.

    That is still a public interface. :/

    In any case, now that you have a database of aliases, you can do the other modifications to detect conflicting files and avoid file losses.

    How does that sound?

    Alas, that is the easy part. My branch already implements most of that, including the logic to trigger a reload after a maintainer script if the
    stat information changed (like for diversions).

    The proposal I made above is not a real database in the sense that we
    don't record what was shipped by the .deb when we installed the files...
    it's rather the opposite, it analyzes the system to detect possible
    conflicts with dpkg's view of the system.

    That is going to be slow, and it changes dpkg's public interface to a
    more complex one where our tight loop that handles unpacking files gains additional error states.

    It can be seen as complimentary to it. In any case, I don't see how implementing metadata tracking would help to solve the problem that we
    have today. dpkg would know that all .deb have /bin as a directory and
    not as a symlink, and it would be able to conclude that the directory
    has been replaced by a symlink by something external, but that's it.

    It should still accept that replacement and do its best to work with it.

    That means there are two sources of truth: packages and the file system.
    We then need a (lowercase) policy how to resolve conflicts between
    these, which becomes our public interface, and thus part of (uppercase)
    Policy.

    I'd also single out the usrmerge transition here. This package operates
    in a grey area of Policy where technically a grave bug is warranted
    because it manipulates files belonging to other packages without going
    through one of the approved interfaces, but since we accidentally
    shipped that, we need to deal with it now. That does not mean this is acceptable, it just wasn't enforced.

    To me it would also be acceptable to just hardcode "if usrmerge or usr-is-merged is installed, take over the known aliases and silently
    discard that package", then salt the earth in dak that no package of
    this name can ever be shipped again until bookworm+3.

    That would be significantly easier than finding a generic solution that
    covers all existing use cases.

    Simon

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Luca Boccassi on Sat Apr 22 13:00:01 2023
    XPost: linux.debian.maint.dpkg

    Hi Luca,

    On Fri, Apr 21, 2023 at 03:29:33PM +0100, Luca Boccassi wrote:
    After Bookworm ships I plan to propose a policy change to the CTTE and
    policy maintainers to forbid shipping files in the legacy directories altogether, followed by a debhelper change to adjust any stragglers automatically at build time and a mass rebuild, plus MBF for the small
    % that does not use dh and a piuparts test to stop migration for
    anything that is uploaded and doesn't comply. That should bring the
    matter to an end, without needing to modify dpkg.

    I agree with the goal of removing aliases by moving files to their
    canonical locations. However, I do not quite see us getting there in the
    way you see it, but maybe I am missing something. As long as dpkg does
    not understand the effects of aliasing, we cannot safely move those
    files and thus the file move moratorium will have to be kept in place.
    And while moving the files would bring the matter to an end, we cannot
    do so without either modifying dpkg or rolling back the transition and
    starting over. I hope that we all agree that rolling back would be too
    insane to even consider, but I fail to see how you safely move files
    without dpkg being changed. Can you elaborate on that aspect?

    I'd also be interested on how you plan to move important files in
    essential packages. This is an aspect raised by Simon Richter and where
    I do not see an obvious answer yet.

    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon McVittie@21:1/5 to Luca Boccassi on Sat Apr 22 12:50:01 2023
    XPost: linux.debian.maint.dpkg

    On Fri, 21 Apr 2023 at 15:29:33 +0100, Luca Boccassi wrote:
    After Bookworm ships I plan to propose a policy change to the CTTE and
    policy maintainers to forbid shipping files in the legacy directories altogether, followed by a debhelper change to adjust any stragglers automatically at build time and a mass rebuild

    That seems quite likely to trigger the scenario Helmut is trying to avoid, which if I understand correctly is this:

    * foo_12.0 in Debian 12 ships /lib/abcd
    * bar_13.0 takes over /lib/abcd from foo, but because of either your
    proposed change or a manual action by the maintainer, it is actually in
    the data.tar as ./usr/lib/abcd (not ./lib/abcd like it was in foo_12.0)
    * the maintainer of bar didn't add the correct Breaks/Replaces on foo
    * a user upgrading from Debian 12 to 13 installs bar_13.0, perhaps pulled
    in as a dependency
    * expected result: dpkg refuses to unpack bar ("trying to overwrite ..."),
    the upgrade is cancelled, and the user reports a RC bug in bar
    * actual result: /usr/lib/abcd in bar quietly overwrites /lib/abcd from foo
    * if bar is subsequently removed, then dpkg (and therefore apt) thinks foo
    is fully functional, but in fact /{usr/,}lib/abcd is missing

    (For simplicity I've described that scenario in terms of files directly
    shipped in the data.tar, but dpkg also tracks the ownership of files
    created by dpkg-divert or alternatives, and similar things can happen
    to those.)

    I had hoped that the last section of technical committee resolution
    #994388 (which concerns this situation) would become irrelevant in Debian
    13, but it's looking as though without the sort of dpkg changes discussed
    in this thread, the concern about files moving between packages would
    remain a valid concern.

    However, as far as I can see, the other reasons not to do this that were mentioned in the last section of #994388 *do* become irrelevant in Debian
    13, so solving the files-moved-between-packages thing is the last major
    blocker for doing what you propose. (Unless someone has a reason why this
    is not the case?)

    You might reasonably say that "the maintainer of bar didn't add the
    correct Breaks/Replaces on foo" is a RC bug in bar - and it is! - but
    judging by the number of "missing Breaks/Replaces" bug reports that have
    to be opened by unstable users (sometimes me), it's a very easy mistake
    to make.

    One thing that's particularly tricky about this is that the move from
    / into /usr and the move from foo to bar might be 18 months apart if
    they happen to occur at opposite ends of our stable release cycle. In particular, if the move from / into /usr is done as soon as the Debian 13
    cycle opens, we cannot predict whether the packages that have undergone
    that move will also need to undergo a package split/merge at some point
    in the following 18 months (but it's reasonable to assume that at least
    some of them will).

    smcv

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Raphael Hertzog on Sat Apr 22 13:00:01 2023
    XPost: linux.debian.maint.dpkg

    Hi Raphal,

    On Fri, Apr 21, 2023 at 03:03:10PM +0200, Raphael Hertzog wrote:
    Here you are considering all files, but for the purpose of our issue,
    we can restrict ourselves to the directories known by dpkg. We really
    only care about directories that have been turned into symlinks (or
    packaged symlinks that are pointing to directories). That's a a much lower number of paths that we would have to check.

    Considering just sid amd64 main, I count around 140000 directories,
    which clearly is less than millions. A typical installation will only
    have a fraction of that, probably less than 50000. I think this is the
    number of stat() calls we'd have to do. I timed this on a reasonably
    fast system (admittedly using Python but I think the overhead is not
    huge) and this can complete in around 0.1s (with a hot vfs cache). So
    depending on the cache invalidation strategy this may be viable or not.

    This is looking at it from a performance point of view. Guillem also
    raised that this is changing the source of truth from the dpkg database
    to the actual filesystem, which Guillem considers wrong and I find that
    vaguely agreeable.

    We don't add any new public interface to dpkg, but we also have the possibility to remove to /var/lib/dpkg/aliases to force an new scan
    (some sort of "dpkg --refresh-aliases" without an official name).

    Can I rephrase this as your cache invalidation strategy is that any
    external entity (such as a maintainer script) introducing aliases should explicitly invalidate the cache.

    It might still be cleaner to have that "dpkg --refresh-aliases" command
    so that we can invoke it for example in "dpkg-maintscript-helper symlink_to_dir/dir_to_symlink" when we are voluntarily turning a directory into a symlink (or vice-versa).

    If you put it this way, it is not that different from the --add-alias/--remove-alias proposal. It is a different interface to
    dpkg, but the semantics are roughly the same:

    In both cases, something external to dpkg is responsible for performing
    the moves and creating the symbolic links followed by informing dpkg
    about the alias (explicitly or implicitly via scanning directories).

    Would you agree with me that this is a minor adaption of DEP17? In
    essence what changes is the way that a user communicates aliases to
    dpkg, but the assumption that a user must communicate aliases to dpkg is
    not affected. I'd be fine with changing this aspect in principle, but I
    still consider this a new public interface to dpkg with much the same
    effects to long term maintenance.

    In any case, now that you have a database of aliases, you can do the other modifications to detect conflicting files and avoid file losses.

    How does that sound?

    It sounds all the same as DEP17 with a different color to me. Hope I got
    it right.

    What I tried ruling out as naive solution is eliminating the need to
    tell dpkg about aliasing changes and then we'd have to incur this 0.1s
    delay after every maintainer script invocation, which would amount to 5
    minutes of stat()ing on a typical dist-upgrade assuming a hot vfs cache
    on a fast x86 CPU.

    The proposal I made above is not a real database in the sense that we
    don't record what was shipped by the .deb when we installed the files...
    it's rather the opposite, it analyzes the system to detect possible
    conflicts with dpkg's view of the system.

    I think that Guillem considers this a bad property as he has expressed
    in his reply on debian-dpkg, that .debs should be the source of truth.

    It can be seen as complimentary to it. In any case, I don't see how implementing metadata tracking would help to solve the problem that we
    have today. dpkg would know that all .deb have /bin as a directory and
    not as a symlink, and it would be able to conclude that the directory
    has been replaced by a symlink by something external, but that's it.

    Let me put it subtly different. As we currently do not ship the aliasing symbolic links in any data.tar, metadata tracking will not tell dpkg
    about the aliasing and therefore metadata tracking cannot help resolve
    the current situation (as singular measure). We can only add the
    symbolic links to a data.tar after the aliasing has been resolved (see
    Simon Richter's mails on how dpkg resolves directory vs symlink) and
    thus metadata tracking can only help with resolving the situation after
    we have fully resolved the situation. I don't see a way to resolve this
    vicious circle and shall update the DEP17 text.

    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Simon Richter on Sat Apr 22 13:00:01 2023
    XPost: linux.debian.maint.dpkg

    Hi Simon,

    On Fri, Apr 21, 2023 at 06:05:27PM +0200, Simon Richter wrote:
    The first thing we need consensus on, IMO, is the definition of "complete".

    I honestly had hoped that we did have consensus on this point.

    The maintainers of the usrmerge package consider the status quo an
    acceptable technical solution, so their definition of "complete" is to roll out the change to the remaining users.

    I find this description inaccurate. As is evident from this very thread,
    Luca Boccassi considers that there is more work to do and intends to do
    some of it.

    For clarity let me propose the following requirements for the definition
    of done:
    * All files shipped in Debian packages are shipped in their canonical
    location rather than an aliased path.
    * The symbolic links are part of some essential package.
    * Therefore no special handling code is needed in bootstrapping tools
    for future releases.

    Would anyone disagree with this?

    The alternative would be a consensus that dpkg is simply not expected to always leave the system in a useful state if it encounters certain invalid situations, and hoping that we will also be able to point to a few million installations where that has not exploded and call it a success, but that would need to be communicated.

    This is a view that I had initially ruled out as absurd, but I see how
    it has some appeal. In essence, our strategy would be based on extensive testing (and occasionally getting it wrong). It would also be based on considering the undefined behaviour area of dpkg and integral part of
    our solution, which would make modifying dpkg very difficult (as any
    innocuous change to dpkg might break things). However, if we can get
    past that period, we'd be able to leave the transition behind without
    turning dpkg into a Jenga tower (as Guillem put it). I am still not
    convinced of this option. My main reason for disliking it is that it
    shifts the effort from the proponents to everyone else. The aliasing
    effects consume so much mental capacity of regular package maintainers
    that I find it difficult to justify enduring that any longer and the
    approach essentially encodes this as the way forward.

    Testing alone will be an absolute nightmare because we can enter invalid states through multiple avenues, for example, if I have a conflict

    a.deb: /bin/test
    b.deb: /usr/bin/test
    c.deb: /bin -> /usr/bin

    Arguably, we can rule out a lot of test cases by policy. We already have
    policy that forbids the combination of a.deb and b.deb in Debian. This
    property can relatively simply be checked on a distribution level and
    therefore I think we can entirely skip this case. So while I agree that
    testing will be a difficult part of it, I also think that reducing the
    test matrix to what we really need is key to keeping it manageable.

    The latter case is also what should happen if b declares "Replaces: a".

    # move file to /usr, install symlink, then remove symlink, move back
    dpkg -i a.deb c.deb
    dpkg --remove c.deb

    Again, I think c.deb would likely be essential and since removal of
    essential packages is undefined, we can remove such cases from our test
    matrix.

    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luca Boccassi@21:1/5 to Helmut Grohne on Sat Apr 22 14:30:01 2023
    XPost: linux.debian.maint.dpkg

    On Sat, 22 Apr 2023 at 11:50, Helmut Grohne <helmut@subdivi.de> wrote:

    Hi Luca,

    On Fri, Apr 21, 2023 at 03:29:33PM +0100, Luca Boccassi wrote:
    After Bookworm ships I plan to propose a policy change to the CTTE and policy maintainers to forbid shipping files in the legacy directories altogether, followed by a debhelper change to adjust any stragglers automatically at build time and a mass rebuild, plus MBF for the small
    % that does not use dh and a piuparts test to stop migration for
    anything that is uploaded and doesn't comply. That should bring the
    matter to an end, without needing to modify dpkg.

    I agree with the goal of removing aliases by moving files to their
    canonical locations. However, I do not quite see us getting there in the
    way you see it, but maybe I am missing something. As long as dpkg does
    not understand the effects of aliasing, we cannot safely move those
    files and thus the file move moratorium will have to be kept in place.
    And while moving the files would bring the matter to an end, we cannot
    do so without either modifying dpkg or rolling back the transition and starting over. I hope that we all agree that rolling back would be too
    insane to even consider, but I fail to see how you safely move files
    without dpkg being changed. Can you elaborate on that aspect?

    Moving files within _the same_ package is actually fine as far as I
    know. It's moving between location _and_ packages within the same
    upgrade that is problematic. The piuparts test I added is overzealous,
    but it doesn't need to be.

    I'd also be interested on how you plan to move important files in
    essential packages. This is an aspect raised by Simon Richter and where
    I do not see an obvious answer yet.

    Do you have a pointer? Not sure I follow what "important" files means
    here, doesn't ring a bell.

    Kind regards,
    Luca Boccassi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luca Boccassi@21:1/5 to Simon McVittie on Sat Apr 22 14:30:01 2023
    XPost: linux.debian.maint.dpkg

    On Sat, 22 Apr 2023 at 11:41, Simon McVittie <smcv@debian.org> wrote:

    On Fri, 21 Apr 2023 at 15:29:33 +0100, Luca Boccassi wrote:
    After Bookworm ships I plan to propose a policy change to the CTTE and policy maintainers to forbid shipping files in the legacy directories altogether, followed by a debhelper change to adjust any stragglers automatically at build time and a mass rebuild

    That seems quite likely to trigger the scenario Helmut is trying to avoid, which if I understand correctly is this:

    * foo_12.0 in Debian 12 ships /lib/abcd
    * bar_13.0 takes over /lib/abcd from foo, but because of either your
    proposed change or a manual action by the maintainer, it is actually in
    the data.tar as ./usr/lib/abcd (not ./lib/abcd like it was in foo_12.0)
    * the maintainer of bar didn't add the correct Breaks/Replaces on foo
    * a user upgrading from Debian 12 to 13 installs bar_13.0, perhaps pulled
    in as a dependency
    * expected result: dpkg refuses to unpack bar ("trying to overwrite ..."),
    the upgrade is cancelled, and the user reports a RC bug in bar
    * actual result: /usr/lib/abcd in bar quietly overwrites /lib/abcd from foo
    * if bar is subsequently removed, then dpkg (and therefore apt) thinks foo
    is fully functional, but in fact /{usr/,}lib/abcd is missing

    (For simplicity I've described that scenario in terms of files directly shipped in the data.tar, but dpkg also tracks the ownership of files
    created by dpkg-divert or alternatives, and similar things can happen
    to those.)

    I had hoped that the last section of technical committee resolution
    #994388 (which concerns this situation) would become irrelevant in Debian
    13, but it's looking as though without the sort of dpkg changes discussed
    in this thread, the concern about files moving between packages would
    remain a valid concern.

    However, as far as I can see, the other reasons not to do this that were mentioned in the last section of #994388 *do* become irrelevant in Debian
    13, so solving the files-moved-between-packages thing is the last major blocker for doing what you propose. (Unless someone has a reason why this
    is not the case?)

    You might reasonably say that "the maintainer of bar didn't add the
    correct Breaks/Replaces on foo" is a RC bug in bar - and it is! - but
    judging by the number of "missing Breaks/Replaces" bug reports that have
    to be opened by unstable users (sometimes me), it's a very easy mistake
    to make.

    One thing that's particularly tricky about this is that the move from
    / into /usr and the move from foo to bar might be 18 months apart if
    they happen to occur at opposite ends of our stable release cycle. In particular, if the move from / into /usr is done as soon as the Debian 13 cycle opens, we cannot predict whether the packages that have undergone
    that move will also need to undergo a package split/merge at some point
    in the following 18 months (but it's reasonable to assume that at least
    some of them will).

    We already have piuparts tests detecting files moving, it should be
    easy enough to extend that to check that the appropriate
    Breaks/Replaces have been added. Correct me if I'm wrong, but I
    believe it's already against policy to do this without
    Breaks/Replaces, so it's not a use case that we need to support, no?
    If someone does that by mistake, the package will not migrate to
    testing.

    Kind regards,
    Luca Boccassi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon McVittie@21:1/5 to Helmut Grohne on Sat Apr 22 15:50:02 2023
    XPost: linux.debian.maint.dpkg

    On Sat, 22 Apr 2023 at 12:43:09 +0200, Helmut Grohne wrote:
    Guillem also
    raised that this is changing the source of truth from the dpkg database
    to the actual filesystem, which Guillem considers wrong and I find that vaguely agreeable.

    To be fair, dpkg does already have at least one case where it treats
    the filesystem as the source of truth, namely a local sysadmin (or
    even a package, I think?) substituting a symlink-to-directory for a
    "real" directory. It has supported this for a long time, and requires
    specific action to avoid that behaviour (usually the dir-to-symlink and symlink-to-dir maintscript actions). The strategy used in the usrmerge
    package wouldn't have worked otherwise.

    I believe the original use-case for this was offloading large
    subtrees to a secondary filesystem, like a symlink
    /usr/share/games -> /srv/large-secondary-disk/games (which is better
    achieved with bind-mounts, or perhaps btrfs subvolumes if you use btrfs,
    on modern systems).

    If I understand correctly, this feature is considered vaguely deprecated,
    but is also quite entrenched, to the extent that we even have wording in
    Policy specifically to make it work better, namely the rule about symlinks within a top-level directory (/usr/lib/foo/data -> ../../share/foo/data)
    being relative, while symlinks between separate top-level directories (/usr/bin/foo -> /etc/alternatives/foo -> /usr/bin/foo-full) are absolute.

    The key difference in how usrmerge uses this dpkg feature is that
    traditionally the target directory would be somewhere non-dpkg-managed
    (meaning that the resulting path aliasing doesn't affect dpkg's
    behaviour), whereas in usrmerge, both the symlink and the target directory
    are in the subset of the filesystem tree that is managed by dpkg (meaning
    that the resulting path aliasing becomes significant).

    smcv

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Raphael Hertzog@21:1/5 to Helmut Grohne on Mon Apr 24 11:40:01 2023
    XPost: linux.debian.maint.dpkg

    Hello,

    On Sat, 22 Apr 2023, Helmut Grohne wrote:
    This is looking at it from a performance point of view. Guillem also
    raised that this is changing the source of truth from the dpkg database
    to the actual filesystem, which Guillem considers wrong and I find that vaguely agreeable.

    smcv already replied to that part.


    We don't add any new public interface to dpkg, but we also have the possibility to remove to /var/lib/dpkg/aliases to force an new scan
    (some sort of "dpkg --refresh-aliases" without an official name).

    Can I rephrase this as your cache invalidation strategy is that any
    external entity (such as a maintainer script) introducing aliases should explicitly invalidate the cache.

    Yes and no. Sticking to the idea that .deb should be the source of truth,
    we make the assumptions that external entities should not do that and if
    they do it, they use the already existing interfaces (either shipping
    symlinks in a .deb or calling dpkg-maintscript-helper to convert a
    directory in a symlink or the opposite, depending on the history of said
    path).

    If you put it this way, it is not that different from the --add-alias/--remove-alias proposal. It is a different interface to
    dpkg, but the semantics are roughly the same:

    In both cases, something external to dpkg is responsible for performing
    the moves and creating the symbolic links followed by informing dpkg
    about the alias (explicitly or implicitly via scanning directories).

    I don't consider "dpkg-maintscript-helper" as external to dpkg. Quite
    on the opposite, it's an ugly hack that is part of dpkg so that it can
    evolve together with dpkg relying on internal implementation details that nobody else can rely on.

    Would you agree with me that this is a minor adaption of DEP17? In

    It is an adaptation of DEP17 that tries to not create a new public
    interface for users. Whether that change is minor or not, I leave that
    up to Guillem to decide. My hope is that the restricted scope makes
    it acceptable to him.

    The proposal I made above is not a real database in the sense that we
    don't record what was shipped by the .deb when we installed the files... it's rather the opposite, it analyzes the system to detect possible conflicts with dpkg's view of the system.

    I think that Guillem considers this a bad property as he has expressed
    in his reply on debian-dpkg, that .debs should be the source of truth.

    I understood this but at the same time dpkg has supported an exception
    already, this is only about improving how we detect issues related
    to that supported exception.

    Cheers,
    --
    ⢀⣴⠾⠻⢶⣦⠀ Raphaël Hertzog <hertzog@debian.org>
    ⣾⠁⢠⠒⠀⣿⡁
    ⢿⡄⠘⠷⠚⠋ The Debian Handbook: https://debian-handbook.info/get/
    ⠈⠳⣄⠀⠀⠀⠀ Debian Long Term Support: https://deb.li/LTS

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Luca Boccassi on Tue Apr 25 21:10:01 2023
    XPost: linux.debian.maint.dpkg

    Hi Luca,

    On Sat, Apr 22, 2023 at 01:06:18PM +0100, Luca Boccassi wrote:
    On Sat, 22 Apr 2023 at 11:50, Helmut Grohne <helmut@subdivi.de> wrote:
    On Fri, Apr 21, 2023 at 03:29:33PM +0100, Luca Boccassi wrote:
    After Bookworm ships I plan to propose a policy change to the CTTE and policy maintainers to forbid shipping files in the legacy directories altogether, followed by a debhelper change to adjust any stragglers automatically at build time and a mass rebuild, plus MBF for the small
    % that does not use dh and a piuparts test to stop migration for
    anything that is uploaded and doesn't comply. That should bring the matter to an end, without needing to modify dpkg.

    I agree with the goal of removing aliases by moving files to their canonical locations. However, I do not quite see us getting there in the way you see it, but maybe I am missing something. As long as dpkg does
    not understand the effects of aliasing, we cannot safely move those
    files and thus the file move moratorium will have to be kept in place.
    And while moving the files would bring the matter to an end, we cannot
    do so without either modifying dpkg or rolling back the transition and starting over. I hope that we all agree that rolling back would be too insane to even consider, but I fail to see how you safely move files without dpkg being changed. Can you elaborate on that aspect?

    Moving files within _the same_ package is actually fine as far as I
    know. It's moving between location _and_ packages within the same
    upgrade that is problematic. The piuparts test I added is overzealous,
    but it doesn't need to be.

    You got me interested to dig deeper. I looked into that piuparts
    check[1]. From what I understand, it does something differently from
    what you suggest here. It detects files moved between / and /usr (which
    is what is going to happen according to your plan) and it does not
    detect files being moved between packages (which would actually be
    problematic here). It also does not produce an error (merely a warning),
    so it doesn't halt testing migration and in particular, it doesn't
    detect the problematic situation at all. That's kinda disappointing.

    You also side stepped the question of how to handle the situation where
    we've moved files from / to /usr and then need to move files between
    packages in a safe way, though your other response to Simon McVittie
    suggests you have an idea there.

    On Sat, 22 Apr 2023 13:03:01 +0100, Luca Boccassi wrote:
    We already have piuparts tests detecting files moving, it should be
    easy enough to extend that to check that the appropriate
    Breaks/Replaces have been added. Correct me if I'm wrong, but I
    believe it's already against policy to do this without
    Breaks/Replaces, so it's not a use case that we need to support, no?
    If someone does that by mistake, the package will not migrate to
    testing.

    Yeah, we agree that you need Breaks+Replaces. The issue here is that due
    to dpkg not knowing about the aliasing, Breaks+Replaces is insufficient.
    Due to the insufficiency the CTTE enacted the moratorium.

    My impression is that you believe that with bookworm, the moratorium is
    being lifted and thus we can start moving files. Unfortunately, the
    underlying problem does not go away just because we've released
    bookworm. It's a problem that is unique to merged installations and
    those are not going to go away in bookworm.

    So yeah, we all want these files moved to their canonical locations and
    I kinda like the simplicity of your approach, but thus far my
    understanding is that it is plain broken and doesn't work. Well, yeah it
    does work in the sense that we break user installations during upgrade
    and notice so late in the freeze without any good options to fix.

    On Sat, Apr 22, 2023 at 01:06:18PM +0100, Luca Boccassi wrote:
    I'd also be interested on how you plan to move important files in
    essential packages. This is an aspect raised by Simon Richter and where
    I do not see an obvious answer yet.

    Do you have a pointer? Not sure I follow what "important" files means
    here, doesn't ring a bell.

    In <669234b3-555b-4e2a-ccc7-dd5510b6e9c1@debian.org>, Simon Richter
    said:
    Dpkg already has defined behaviour for directory vs symlink: the directory wins. In principle a future version of dpkg could change that, but /lib/ld-linux.so.2 is just too special, we'd never want to have a package that
    actually moves it.

    This and /bin/sh is the kind of files I'd consider important. And then
    upon thinking further it became more and more difficult for me to make
    sense of the objection. On a merged system, we can just move that file
    to its canonical location without having any trouble even with an
    unmodified dpkg. So from my pov, the question about important files can
    be disregarded. I hope Simon Richter agrees.

    Let us circle back to your "broken" approach. It sure is simple (just
    move all the files and be done) and if we could just skip over the
    upgrade issues and have all the files moved without having to modify
    dpkg, that would actually be a better result than DEP 17. Just how do we
    avoid the issue of file loss arising from the aliasing in your scenario?

    There kinda is an obvious solution here. We just need to tell dpkg that
    it needs to remove the package containing the file that is being moved
    before unpacking the replacing package. This semantic actually exists
    and we call it "Conflicts". So instead of using Breaks+Replaces, the
    solution is to use Conflicts! Problem solved, right?

    Yeah, I think this solves a number of cases, but there are two areas
    where it does not:
    * We generally prefer Breaks over Conflicts for a reason. It gives the
    dependency resolver more freedom and in taking this freedom away, it
    may fail to find solutions to complex upgrades. (Which is why Breaks
    got introduced in the first place.)
    * We cannot use Conflicts inside the transitively essential set.

    So if we move all those files, in 90% (number made up) of the cases it
    will go well (since we don't move between packages) and in 90% (number
    made up) of the remaining 10%, we can use Conflicts, but what do we do
    about that remaining 1%?

    If we look deeper into the dpkg toolbox, we pause at diversions. What if
    the new package were to add a (--no-rename) diversion for files that are
    at risk of being accidentally deleted in newpkg.preinst and then remove
    that diversion in newpkg.postinst? Any such diversion will cause package removal of the oldpkg to skip removal of the diverted file (and instead
    deleted the non-existent path that we diverted to). Thus we retain the
    files we were interested in.

    This way, we can just move the files as you suggested.
    * For 90% of the packages, this will just work.
    * For 9% of the packages, we'll need to turn Breaks+Replaces into
    Conflicts.
    * And for 1% of the packages, we'll need to add complex diversions to
    maintainer scripts.

    And while this sounds super ugly in the 1% of cases, it's a complexity
    that maybe isn't necessary at all and we can remove it after trixie
    unlike the complexity being added in DEP 17.

    In order to better understand the mechanics at hand (and due to Simon
    Richter's call for test cases), I sat down and wrote some. So in this
    mail you find 4 files attached:
    * runtest.sh is a wrapper script to run each case inside a fresh
    chroot created by mmdebstrap (as you don't want to mess your system).
    * case1.sh demonstrates the file loss problem with Breaks+Replaces and
    thus fails.
    * case2.sh demonstrates how Conflicts fix the problem.
    * case3.sh demonstrates how diversions fix the problem.

    In sincerely hope that this fixed-up plan doesn't have any serious
    issues. If you find any please tell.

    And before closing this mail, I would like to express my gratitude and
    thanks to Emilio Pozuelo Monfort for enduring me in numerous discussions
    on this matter and providing so many of the key insights captured in
    this mail.

    Helmut

    #!/bin/shset -euxTESTCASE="$1"MIRROR="${2:-http://deb.debian.org/debian}"mmdebstrap --hook-dir=/usr/share/mmdebstrap/hooks/merged-usr unstable /dev/null "$MIRROR" --variant=apt --include=dpkg-dev --customize-hook="upload '$TESTCASE' /testcase" --
    customize-hook='chroot "$1" sh /testcase'
    #!/bin/shset -euxmkdir -p pkga/DEBIAN pkga/libcat >pkga/DEBIAN/control <<EOFPackage: pkgaArchitecture: allVersion: 0Maintainer: none@noneDescription: pkgaEOFtouch pkga/lib/canarydpkg-deb -b pkgamkdir -p pkgb/DEBIAN pkgb/usr/libcat >pkgb/
    DEBIAN/control <<EOFPackage: pkgbArchitecture: allVersion: 0Breaks: pkgaReplaces: pkgaMaintainer: none@noneDescription: pkgbEOFtouch pkgb/usr/lib/canarydpkg-deb -b pkgbdpkg -i pkga.debstat /usr/lib/canarydpkg --auto-deconfigure --unpack
    pkgb.debstat /usr/lib/canary || :dpkg -r pkgastat /usr/lib/canary || :dpkg --configure -astat /usr/lib/canary
    #!/bin/shset -euxmkdir -p pkga/DEBIAN pkga/libcat >pkga/DEBIAN/control <<EOFPackage: pkgaArchitecture: allVersion: 0Maintainer: none@noneDescription: pkgaEOFtouch pkga/lib/canarydpkg-deb -b pkgamkdir -p pkgb/DEBIAN pkgb/usr/libcat >pkgb/
    DEBIAN/control <<EOFPackage: pkgbArchitecture: allVersion: 0Conflicts: pkgaMaintainer: none@noneDescription: pkgbEOFtouch pkgb/usr/lib/canarydpkg-deb -b pkgbdpkg -i pkga.debstat /usr/lib/canaryapt-get -y install ./pkgb.debstat /usr/lib/
    canary
    #!/bin/shset -euxmkdir -p pkga/DEBIAN pkga/libcat >pkga/DEBIAN/control <<EOFPackage: pkgaArchitecture: allVersion: 0Maintainer: none@noneDescription: pkgaEOFtouch pkga/lib/canarydpkg-deb -b pkgamkdir -p pkgb/DEBIAN pkgb/usr/libcat >pkgb/
    DEBIAN/control <<EOFPackage: pkgbArchitecture: allVersion: 0Maintainer: none@noneDescription: pkgbEOFcat >pkgb/DEBIAN/preinst <<EOF#!/bin/shdpkg-divert --add --no-rename --divert /lib/canary.usrmerged /lib/canaryEOFcat >pkgb/DEBIAN/postinst <<
    EOF#!/bin/shdpkg-divert --remove --no-rename /lib/canaryEOFchmod +x pkgb/DEBIAN/preinst pkgb/DEBIAN/postinsttouch pkgb/usr/lib/canarydpkg-deb -b pkgbdpkg -i pkga.debstat /usr/lib/canarydpkg --auto-deconfigure --unpack pkgb.debstat /usr/lib/
    canarydpkg -r pkgastat /usr/lib/canarydpkg --configure -astat /usr/lib/canary

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luca Boccassi@21:1/5 to Helmut Grohne on Tue Apr 25 22:40:01 2023
    XPost: linux.debian.maint.dpkg

    On Tue, 25 Apr 2023 at 20:07, Helmut Grohne <helmut@subdivi.de> wrote:

    Hi Luca,

    On Sat, Apr 22, 2023 at 01:06:18PM +0100, Luca Boccassi wrote:
    On Sat, 22 Apr 2023 at 11:50, Helmut Grohne <helmut@subdivi.de> wrote:
    On Fri, Apr 21, 2023 at 03:29:33PM +0100, Luca Boccassi wrote:
    After Bookworm ships I plan to propose a policy change to the CTTE and policy maintainers to forbid shipping files in the legacy directories altogether, followed by a debhelper change to adjust any stragglers automatically at build time and a mass rebuild, plus MBF for the small % that does not use dh and a piuparts test to stop migration for anything that is uploaded and doesn't comply. That should bring the matter to an end, without needing to modify dpkg.

    I agree with the goal of removing aliases by moving files to their canonical locations. However, I do not quite see us getting there in the way you see it, but maybe I am missing something. As long as dpkg does not understand the effects of aliasing, we cannot safely move those
    files and thus the file move moratorium will have to be kept in place. And while moving the files would bring the matter to an end, we cannot
    do so without either modifying dpkg or rolling back the transition and starting over. I hope that we all agree that rolling back would be too insane to even consider, but I fail to see how you safely move files without dpkg being changed. Can you elaborate on that aspect?

    Moving files within _the same_ package is actually fine as far as I
    know. It's moving between location _and_ packages within the same
    upgrade that is problematic. The piuparts test I added is overzealous,
    but it doesn't need to be.

    You got me interested to dig deeper. I looked into that piuparts
    check[1]. From what I understand, it does something differently from
    what you suggest here. It detects files moved between / and /usr (which
    is what is going to happen according to your plan) and it does not
    detect files being moved between packages (which would actually be problematic here). It also does not produce an error (merely a warning),
    so it doesn't halt testing migration and in particular, it doesn't
    detect the problematic situation at all. That's kinda disappointing.

    It was a while ago, but from my recollection it did check both things,
    and it did fail the run. I'll check again when I have a moment (or
    better: MRs welcome ;-) ).
    Did you run it with any specific cases/packages to check this?

    You also side stepped the question of how to handle the situation where
    we've moved files from / to /usr and then need to move files between
    packages in a safe way, though your other response to Simon McVittie
    suggests you have an idea there.

    On Sat, 22 Apr 2023 13:03:01 +0100, Luca Boccassi wrote:
    We already have piuparts tests detecting files moving, it should be
    easy enough to extend that to check that the appropriate
    Breaks/Replaces have been added. Correct me if I'm wrong, but I
    believe it's already against policy to do this without
    Breaks/Replaces, so it's not a use case that we need to support, no?
    If someone does that by mistake, the package will not migrate to
    testing.

    Yeah, we agree that you need Breaks+Replaces. The issue here is that due
    to dpkg not knowing about the aliasing, Breaks+Replaces is insufficient.
    Due to the insufficiency the CTTE enacted the moratorium.

    My impression is that you believe that with bookworm, the moratorium is
    being lifted and thus we can start moving files. Unfortunately, the underlying problem does not go away just because we've released
    bookworm. It's a problem that is unique to merged installations and
    those are not going to go away in bookworm.

    Not quite, from my point of view I don't see a problem with keeping
    the moratorium in place for bookworm, personally.
    In practice, it would mean it applies to everything that currently
    ships files in bin/sbin/lib, as all of those are moved automatically
    and thus can no longer move to another package at the same time, which
    is of course a non-trivial constraint.
    But it sounds like you came up with an even better way:

    So yeah, we all want these files moved to their canonical locations and
    I kinda like the simplicity of your approach, but thus far my
    understanding is that it is plain broken and doesn't work. Well, yeah it
    does work in the sense that we break user installations during upgrade
    and notice so late in the freeze without any good options to fix.

    On Sat, Apr 22, 2023 at 01:06:18PM +0100, Luca Boccassi wrote:
    I'd also be interested on how you plan to move important files in essential packages. This is an aspect raised by Simon Richter and where
    I do not see an obvious answer yet.

    Do you have a pointer? Not sure I follow what "important" files means
    here, doesn't ring a bell.

    In <669234b3-555b-4e2a-ccc7-dd5510b6e9c1@debian.org>, Simon Richter
    said:
    Dpkg already has defined behaviour for directory vs symlink: the directory wins. In principle a future version of dpkg could change that, but /lib/ld-linux.so.2 is just too special, we'd never want to have a package that
    actually moves it.

    This and /bin/sh is the kind of files I'd consider important. And then
    upon thinking further it became more and more difficult for me to make
    sense of the objection. On a merged system, we can just move that file
    to its canonical location without having any trouble even with an
    unmodified dpkg. So from my pov, the question about important files can
    be disregarded. I hope Simon Richter agrees.

    Let us circle back to your "broken" approach. It sure is simple (just
    move all the files and be done) and if we could just skip over the
    upgrade issues and have all the files moved without having to modify
    dpkg, that would actually be a better result than DEP 17. Just how do we avoid the issue of file loss arising from the aliasing in your scenario?

    There kinda is an obvious solution here. We just need to tell dpkg that
    it needs to remove the package containing the file that is being moved
    before unpacking the replacing package. This semantic actually exists
    and we call it "Conflicts". So instead of using Breaks+Replaces, the
    solution is to use Conflicts! Problem solved, right?

    Yeah, I think this solves a number of cases, but there are two areas
    where it does not:
    * We generally prefer Breaks over Conflicts for a reason. It gives the
    dependency resolver more freedom and in taking this freedom away, it
    may fail to find solutions to complex upgrades. (Which is why Breaks
    got introduced in the first place.)
    * We cannot use Conflicts inside the transitively essential set.

    So if we move all those files, in 90% (number made up) of the cases it
    will go well (since we don't move between packages) and in 90% (number
    made up) of the remaining 10%, we can use Conflicts, but what do we do
    about that remaining 1%?

    If we look deeper into the dpkg toolbox, we pause at diversions. What if
    the new package were to add a (--no-rename) diversion for files that are
    at risk of being accidentally deleted in newpkg.preinst and then remove
    that diversion in newpkg.postinst? Any such diversion will cause package removal of the oldpkg to skip removal of the diverted file (and instead deleted the non-existent path that we diverted to). Thus we retain the
    files we were interested in.

    This way, we can just move the files as you suggested.
    * For 90% of the packages, this will just work.
    * For 9% of the packages, we'll need to turn Breaks+Replaces into
    Conflicts.
    * And for 1% of the packages, we'll need to add complex diversions to
    maintainer scripts.

    And while this sounds super ugly in the 1% of cases, it's a complexity
    that maybe isn't necessary at all and we can remove it after trixie
    unlike the complexity being added in DEP 17.

    In order to better understand the mechanics at hand (and due to Simon Richter's call for test cases), I sat down and wrote some. So in this
    mail you find 4 files attached:
    * runtest.sh is a wrapper script to run each case inside a fresh
    chroot created by mmdebstrap (as you don't want to mess your system).
    * case1.sh demonstrates the file loss problem with Breaks+Replaces and
    thus fails.
    * case2.sh demonstrates how Conflicts fix the problem.
    * case3.sh demonstrates how diversions fix the problem.

    In sincerely hope that this fixed-up plan doesn't have any serious
    issues. If you find any please tell.

    And before closing this mail, I would like to express my gratitude and
    thanks to Emilio Pozuelo Monfort for enduring me in numerous discussions
    on this matter and providing so many of the key insights captured in
    this mail.

    Brilliant! Would never have thought of using divert like that.

    So, what work would need to happen to make this reality? Do we need tooling/scripts/build changes to support the divert scheme, or is it
    "simply" a matter of documenting and testing?

    Kind regards,
    Luca Boccassi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luca Boccassi@21:1/5 to Simon Richter on Wed Apr 26 11:40:01 2023
    XPost: linux.debian.maint.dpkg

    On Wed, 26 Apr 2023 at 10:11, Simon Richter <sjr@debian.org> wrote:

    Hi,

    On Tue, Apr 25, 2023 at 09:07:28PM +0200, Helmut Grohne wrote:

    This and /bin/sh is the kind of files I'd consider important. And then
    upon thinking further it became more and more difficult for me to make sense of the objection. On a merged system, we can just move that file
    to its canonical location without having any trouble even with an unmodified dpkg. So from my pov, the question about important files can
    be disregarded. I hope Simon Richter agrees.

    Yes, the relevant code at

    https://github.com/guillemj/dpkg/blob/main/src/main/unpack.c#L749

    already handles moving a file inside the same package, and that has
    existed for some time, that's why I use two packages for the PoC.

    I have not looked for more issues beyond that, so there might be others lurking in the depths of this code.

    What I'm mostly concerned about (read: have not verified either way)
    with /lib/ld.so and /bin/sh is what happens when dpkg learns of /bin and
    /lib as symlinks -- because right now, the symlinks created by usrmerge
    are protected by the rule that if dpkg expects a directory and finds a symlink, that is fine because that is obviously an action taken by the
    admin.

    But if dpkg sees a package containing these as symlinks, then this is
    entered into the dpkg database, and subject to conflict resolution, and
    for that, a separate rule exists that directory-symlink conflicts are resolved in favour of the directory, so the interaction between a newer base-files packages shipping /lib as a symlink and an older or
    third-party package containing /lib as a directory (e.g. a kernel
    package from a hosting provider) could overwrite the /lib symlink.

    It might be possible to avoid that by never shipping /lib as a symlink
    and always creating it externally, but I still think that's kind of
    wobbly.

    IMHO we should not ship the top-level symlinks in a package. The
    reason for that is to allow the use case where /usr is a separate
    vendor partition and / is either a luks volume or a tmpfs, and thus
    the top-level symlinks are ephemeral and re-created on boot on the
    fly. If they were part of a package, that would get awkward to say the
    least.
    I really would like to move toward the direction of having exclusively
    /usr and /etc shipped in data.tar, and everything else created locally
    as needed, and that includes files in /.

    Kind regards,
    Luca Boccassi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon Richter@21:1/5 to Helmut Grohne on Wed Apr 26 11:20:01 2023
    XPost: linux.debian.maint.dpkg

    Hi,

    On Tue, Apr 25, 2023 at 09:07:28PM +0200, Helmut Grohne wrote:

    This and /bin/sh is the kind of files I'd consider important. And then
    upon thinking further it became more and more difficult for me to make
    sense of the objection. On a merged system, we can just move that file
    to its canonical location without having any trouble even with an
    unmodified dpkg. So from my pov, the question about important files can
    be disregarded. I hope Simon Richter agrees.

    Yes, the relevant code at

    https://github.com/guillemj/dpkg/blob/main/src/main/unpack.c#L749

    already handles moving a file inside the same package, and that has
    existed for some time, that's why I use two packages for the PoC.

    I have not looked for more issues beyond that, so there might be others
    lurking in the depths of this code.

    What I'm mostly concerned about (read: have not verified either way)
    with /lib/ld.so and /bin/sh is what happens when dpkg learns of /bin and
    /lib as symlinks -- because right now, the symlinks created by usrmerge
    are protected by the rule that if dpkg expects a directory and finds a
    symlink, that is fine because that is obviously an action taken by the
    admin.

    But if dpkg sees a package containing these as symlinks, then this is
    entered into the dpkg database, and subject to conflict resolution, and
    for that, a separate rule exists that directory-symlink conflicts are
    resolved in favour of the directory, so the interaction between a newer base-files packages shipping /lib as a symlink and an older or
    third-party package containing /lib as a directory (e.g. a kernel
    package from a hosting provider) could overwrite the /lib symlink.

    It might be possible to avoid that by never shipping /lib as a symlink
    and always creating it externally, but I still think that's kind of
    wobbly.

    If we look deeper into the dpkg toolbox, we pause at diversions. What if
    the new package were to add a (--no-rename) diversion for files that are
    at risk of being accidentally deleted in newpkg.preinst and then remove
    that diversion in newpkg.postinst? Any such diversion will cause package removal of the oldpkg to skip removal of the diverted file (and instead deleted the non-existent path that we diverted to). Thus we retain the
    files we were interested in.

    O_O

    Yes. Hahahahaha yes.

    Brittle, but it could work. What is a bit annoying is that we'd have to
    keep this for an entire cycle.

    Simon

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Raphael Hertzog@21:1/5 to Luca Boccassi on Wed Apr 26 15:20:01 2023
    XPost: linux.debian.maint.dpkg

    On Tue, 25 Apr 2023, Luca Boccassi wrote:
    Brilliant! Would never have thought of using divert like that.

    +1 Nice trick.

    So, what work would need to happen to make this reality? Do we need tooling/scripts/build changes to support the divert scheme, or is it
    "simply" a matter of documenting and testing?

    I would suggest to implement it with "dpkg-maintscript-helper" and
    document what needs to be documented as part of the associated manual
    page documentation.

    After all it's a hack to work around a dpkg limitation and it fits
    well with the purpose of that helper tool.

    Cheers,
    --
    ⢀⣴⠾⠻⢶⣦⠀ Raphaël Hertzog <hertzog@debian.org>
    ⣾⠁⢠⠒⠀⣿⡁
    ⢿⡄⠘⠷⠚⠋ The Debian Handbook: https://debian-handbook.info/get/
    ⠈⠳⣄⠀⠀⠀⠀ Debian Long Term Support: https://deb.li/LTS

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sam Hartman@21:1/5 to All on Wed Apr 26 15:20:01 2023
    XPost: linux.debian.maint.dpkg

    "Simon" == Simon McVittie <smcv@debian.org> writes:

    Simon> You might reasonably say that "the maintainer of bar didn't
    Simon> add the correct Breaks/Replaces on foo" is a RC bug in bar -
    Simon> and it is! - but judging by the number of "missing
    Simon> Breaks/Replaces" bug reports that have to be opened by
    Simon> unstable users (sometimes me), it's a very easy mistake to
    Simon> make.

    Is adding the correct breaks/replaces enough to solve things?
    I could believe adding a versioned conflicts would be sufficient, but it
    is not obvious to me that breaks/replaces is enough given that dpkg
    doesn't understand aliasing.

    My intuition (and I have not worked through this as much as you) is that
    any time you can have files moving where both packages are unpacked can
    create problems.
    I think that can happen with breaks/replaces but not without a conflicts (without replaces?)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bastien ROUCARIES@21:1/5 to All on Wed Apr 26 16:50:01 2023
    XPost: linux.debian.maint.dpkg

    Le mar. 25 avr. 2023 à 19:08, Helmut Grohne <helmut@subdivi.de> a écrit :

    Hi Luca,

    On Sat, Apr 22, 2023 at 01:06:18PM +0100, Luca Boccassi wrote:
    On Sat, 22 Apr 2023 at 11:50, Helmut Grohne <helmut@subdivi.de> wrote:
    On Fri, Apr 21, 2023 at 03:29:33PM +0100, Luca Boccassi wrote:
    After Bookworm ships I plan to propose a policy change to the CTTE and policy maintainers to forbid shipping files in the legacy directories altogether, followed by a debhelper change to adjust any stragglers automatically at build time and a mass rebuild, plus MBF for the small % that does not use dh and a piuparts test to stop migration for anything that is uploaded and doesn't comply. That should bring the matter to an end, without needing to modify dpkg.

    I agree with the goal of removing aliases by moving files to their canonical locations. However, I do not quite see us getting there in the way you see it, but maybe I am missing something. As long as dpkg does not understand the effects of aliasing, we cannot safely move those
    files and thus the file move moratorium will have to be kept in place. And while moving the files would bring the matter to an end, we cannot
    do so without either modifying dpkg or rolling back the transition and starting over. I hope that we all agree that rolling back would be too insane to even consider, but I fail to see how you safely move files without dpkg being changed. Can you elaborate on that aspect?

    Moving files within _the same_ package is actually fine as far as I
    know. It's moving between location _and_ packages within the same
    upgrade that is problematic. The piuparts test I added is overzealous,
    but it doesn't need to be.

    You got me interested to dig deeper. I looked into that piuparts
    check[1]. From what I understand, it does something differently from
    what you suggest here. It detects files moved between / and /usr (which
    is what is going to happen according to your plan) and it does not
    detect files being moved between packages (which would actually be problematic here). It also does not produce an error (merely a warning),
    so it doesn't halt testing migration and in particular, it doesn't
    detect the problematic situation at all. That's kinda disappointing.

    You also side stepped the question of how to handle the situation where
    we've moved files from / to /usr and then need to move files between
    packages in a safe way, though your other response to Simon McVittie
    suggests you have an idea there.

    On Sat, 22 Apr 2023 13:03:01 +0100, Luca Boccassi wrote:
    We already have piuparts tests detecting files moving, it should be
    easy enough to extend that to check that the appropriate
    Breaks/Replaces have been added. Correct me if I'm wrong, but I
    believe it's already against policy to do this without
    Breaks/Replaces, so it's not a use case that we need to support, no?
    If someone does that by mistake, the package will not migrate to
    testing.

    Yeah, we agree that you need Breaks+Replaces. The issue here is that due
    to dpkg not knowing about the aliasing, Breaks+Replaces is insufficient.
    Due to the insufficiency the CTTE enacted the moratorium.

    My impression is that you believe that with bookworm, the moratorium is
    being lifted and thus we can start moving files. Unfortunately, the underlying problem does not go away just because we've released
    bookworm. It's a problem that is unique to merged installations and
    those are not going to go away in bookworm.

    So yeah, we all want these files moved to their canonical locations and
    I kinda like the simplicity of your approach, but thus far my
    understanding is that it is plain broken and doesn't work. Well, yeah it
    does work in the sense that we break user installations during upgrade
    and notice so late in the freeze without any good options to fix.

    On Sat, Apr 22, 2023 at 01:06:18PM +0100, Luca Boccassi wrote:
    I'd also be interested on how you plan to move important files in essential packages. This is an aspect raised by Simon Richter and where
    I do not see an obvious answer yet.

    Do you have a pointer? Not sure I follow what "important" files means
    here, doesn't ring a bell.

    In <669234b3-555b-4e2a-ccc7-dd5510b6e9c1@debian.org>, Simon Richter
    said:
    Dpkg already has defined behaviour for directory vs symlink: the directory wins. In principle a future version of dpkg could change that, but /lib/ld-linux.so.2 is just too special, we'd never want to have a package that
    actually moves it.

    This and /bin/sh is the kind of files I'd consider important. And then
    upon thinking further it became more and more difficult for me to make
    sense of the objection. On a merged system, we can just move that file
    to its canonical location without having any trouble even with an
    unmodified dpkg. So from my pov, the question about important files can
    be disregarded. I hope Simon Richter agrees.

    Let us circle back to your "broken" approach. It sure is simple (just
    move all the files and be done) and if we could just skip over the
    upgrade issues and have all the files moved without having to modify
    dpkg, that would actually be a better result than DEP 17. Just how do we avoid the issue of file loss arising from the aliasing in your scenario?

    There kinda is an obvious solution here. We just need to tell dpkg that
    it needs to remove the package containing the file that is being moved
    before unpacking the replacing package. This semantic actually exists
    and we call it "Conflicts". So instead of using Breaks+Replaces, the
    solution is to use Conflicts! Problem solved, right?

    Yeah, I think this solves a number of cases, but there are two areas
    where it does not:
    * We generally prefer Breaks over Conflicts for a reason. It gives the
    dependency resolver more freedom and in taking this freedom away, it
    may fail to find solutions to complex upgrades. (Which is why Breaks
    got introduced in the first place.)
    * We cannot use Conflicts inside the transitively essential set.

    So if we move all those files, in 90% (number made up) of the cases it
    will go well (since we don't move between packages) and in 90% (number
    made up) of the remaining 10%, we can use Conflicts, but what do we do
    about that remaining 1%?

    If we look deeper into the dpkg toolbox, we pause at diversions. What if
    the new package were to add a (--no-rename) diversion for files that are
    at risk of being accidentally deleted in newpkg.preinst and then remove
    that diversion in newpkg.postinst? Any such diversion will cause package removal of the oldpkg to skip removal of the diverted file (and instead deleted the non-existent path that we diverted to). Thus we retain the
    files we were interested in.

    This way, we can just move the files as you suggested.
    * For 90% of the packages, this will just work.
    * For 9% of the packages, we'll need to turn Breaks+Replaces into
    Conflicts.
    * And for 1% of the packages, we'll need to add complex diversions to
    maintainer scripts.

    Do we have a tool to classify the packages ?

    Bastien

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sven Joachim@21:1/5 to Luca Boccassi on Wed Apr 26 18:30:01 2023
    XPost: linux.debian.maint.dpkg

    On 2023-04-26 10:34 +0100, Luca Boccassi wrote:

    On Wed, 26 Apr 2023 at 10:11, Simon Richter <sjr@debian.org> wrote:

    What I'm mostly concerned about (read: have not verified either way)
    with /lib/ld.so and /bin/sh is what happens when dpkg learns of /bin and
    /lib as symlinks -- because right now, the symlinks created by usrmerge
    are protected by the rule that if dpkg expects a directory and finds a
    symlink, that is fine because that is obviously an action taken by the
    admin.

    But if dpkg sees a package containing these as symlinks, then this is
    entered into the dpkg database, and subject to conflict resolution, and
    for that, a separate rule exists that directory-symlink conflicts are
    resolved in favour of the directory, so the interaction between a newer
    base-files packages shipping /lib as a symlink and an older or
    third-party package containing /lib as a directory (e.g. a kernel
    package from a hosting provider) could overwrite the /lib symlink.

    No, this does not change anything. The dpkg database currently does not
    even record if a pathname in it corresponds to a symlink, a directory or something else. See also Policy 6.6.4 :

    ,----
    | A directory will never be replaced by a symbolic link to a directory or
    | vice versa; instead, the existing state (symlink or not) will be left
    | alone and "dpkg" will follow the symlink if there is one.
    `----

    It might be possible to avoid that by never shipping /lib as a symlink
    and always creating it externally, but I still think that's kind of
    wobbly.

    IMHO we should not ship the top-level symlinks in a package. The
    reason for that is to allow the use case where /usr is a separate
    vendor partition and / is either a luks volume or a tmpfs, and thus
    the top-level symlinks are ephemeral and re-created on boot on the
    fly. If they were part of a package, that would get awkward to say the
    least.
    I really would like to move toward the direction of having exclusively
    /usr and /etc shipped in data.tar, and everything else created locally
    as needed, and that includes files in /.

    This means that you need special code in dpkg to preserve these top
    level symlinks, as otherwise they are going to disappear with the last
    package that contained these as directories, instantly hosing your installation. I am pretty sure the dpkg maintainer will not like this.

    Cheers,
    Sven

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Helmut Grohne on Thu Apr 27 00:50:01 2023
    XPost: linux.debian.maint.dpkg

    On Tue, Apr 25, 2023 at 09:07:28PM +0200, Helmut Grohne wrote:
    In sincerely hope that this fixed-up plan doesn't have any serious
    issues. If you find any please tell.

    Thanks for the praise, but problems I found and I'm pretty sure this is
    only the tip of the iceberg.

    So for one thing, let us imagine merged /usr was mandatory in bullseye
    already and we were now moving all the files to /usr for bookworm. This
    is what is on the table for trixie, but since there is no trixie yet, we
    can try to use the current freeze to see what would happen.

    To that end, let's look at /lib/systemd/system-generators/systemd-bless-boot-generator. This file
    was part of systemd in bullseye and has been split out to systemd-boot
    in bookworm. If it were moved to its canonical location, it could be
    unpacked by dpkg before upgrading systemd and thus the systemd-bless-boot-generator would vanish from the system despite
    correct Breaks+Replaces. This is a situation where we'd have to use
    Conflicts instead.

    There are actually many more such situations such as:
    * /bin/fusermount: fuse -> fuse3
    * /bin/rksh93: ksh -> ksh93u+m
    * /lib/systemd/system/dbus.socket: dbus -> dbus-system-bus-common
    * /lib/systemd/system/dhcpcd.service: dhcpcd5 -> dhcpcd
    * /lib/systemd/system/polkit.service: policykit-1 -> polkitd
    * /lib/systemd/system/systemd-resolved.service: systemd -> systemd-resolved
    * /sbin/hwclock: util-linux -> util-linux-extra
    * ...

    This really is a common situation and given the number of systemd units affected, we now also see why not allowing them to move to /usr was a
    smart thing to do.

    And that's just the ones where correct Breaks+Replaces have been added.
    We also have a number of situations where Breaks+Replaces are missing.

    Ok, let's move on. I've proposed diversions as a cure, but in reality diversions are a problem themselves. Consider that
    cryptsetup-nuke-password diverts /lib/cryptsetup/askpass, which is
    usually owned by cryptsetup. If cryptsetup were to move that file to
    /usr, the diversion would not cover it anymore and the actual content of askpass would depend on the unpack order. That's very bad and none of
    what I proposed earlier is going to fix this.

    And of course, this is not some special example, it's a pattern:
    * /lib/udev/rules.d/60-cdrom_id.rules: udev -> amazon-ec2-utils
    * /sbin/dhclient: isc-dhcp-client -> isc-dhcp-client-ddns
    * /bin/systemd-sysusers: systemd -> opensysusers
    * ...

    So how do we fix diversions? Let's have a look into the dpkg toolbox
    again. I've got an idea. Diversions. What you say? How do you fix
    diversions with diversions? Quite obviously, you divert
    /usr/bin/dpkg-divert! And whenever dpkg-divert is instructed to add a
    diversion for a non-canonical path, you forward that call to the real dpkg-divert, but also call it with a canonicalized version such that
    both locations are covered. When initially deploying the diversion of /usr/bin/dpkg-divert, we also need to transform existing diversions.
    Other than that, things should work after doubling down on diversions.
    Sorry, I don't have a test case for this yet.

    I have a bad feeling about this. I think some dpkg maintainer warned us
    that diversions would break. Let's peek at his list again. He also said update-alternatives would be broken. I admit not having dug into this
    yet, but my gut feeling already is that update-alternatives will become
    "funny" as well though I guess we cannot fix update-alternatives by
    adding alternatives.

    So we started with moving some files to their canonical location. We
    learned that Breaks+Replaces are sometimes insufficient and we can fix
    that with Conflicts. Then we learned that Conflicts cannot always be
    used and we can work around that using diversions. Now we learned that diversions are also broken and we can work around that as well. The
    amount of complexity we are piling up here becomes non-trivial.

    At some point the question becomes: Do we want that complexity inside
    dpkg (aka DEP 17 or some variant of it) or outside of dpkg (i.e. what
    we're talking about here). It seems clear at this time, that complexity
    is unavoidable.

    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Sam Hartman on Thu Apr 27 00:50:01 2023
    XPost: linux.debian.maint.dpkg

    On Wed, Apr 26, 2023 at 07:11:10AM -0600, Sam Hartman wrote:
    "Simon" == Simon McVittie <smcv@debian.org> writes:

    Simon> You might reasonably say that "the maintainer of bar didn't
    Simon> add the correct Breaks/Replaces on foo" is a RC bug in bar -
    Simon> and it is! - but judging by the number of "missing
    Simon> Breaks/Replaces" bug reports that have to be opened by
    Simon> unstable users (sometimes me), it's a very easy mistake to
    Simon> make.

    Indeed, I was thinking that we correctly to Breaks and Replaces. I now
    know better and files an initial batch of four rc bugs for missing
    cases. So yeah, quite clearly we need to fix this more systematically,
    but I think that's technically possible:

    1. Download all Contents and Packages files for stable and testing.
    2. Generate candidates for file conflicts from the Contents.
    3. Skip cases covered by Breaks+Replaces or Conflicts.
    3b. Optionally also parse binarycontrol.d.n data to be able to skip
    known diversions.
    4. Create a fresh stable chroot and install the "old" package.
    5. Update sources.list to testing and download the "new" package.
    6. dpkg --auto-configure --unpack new.pkg.
    7. Check output for "trying to overwrite".

    Is adding the correct breaks/replaces enough to solve things?
    I could believe adding a versioned conflicts would be sufficient, but it
    is not obvious to me that breaks/replaces is enough given that dpkg
    doesn't understand aliasing.

    It is not.

    My intuition (and I have not worked through this as much as you) is that
    any time you can have files moving where both packages are unpacked can create problems.

    This is exactly the situation that caused the moratorium.

    I think that can happen with breaks/replaces but not without a conflicts (without replaces?)

    Yes, Conflicts can in situations where Breaks+Replaces would fail due to
    the aliasing issue. My mail from yesterday goes into more detail and
    also explains when you cannot use Conflicts.

    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon Richter@21:1/5 to Helmut Grohne on Thu Apr 27 08:00:02 2023
    XPost: linux.debian.maint.dpkg

    Hi,

    On Thu, Apr 27, 2023 at 12:34:06AM +0200, Helmut Grohne wrote:

    At some point the question becomes: Do we want that complexity inside
    dpkg (aka DEP 17 or some variant of it) or outside of dpkg (i.e. what
    we're talking about here). It seems clear at this time, that complexity
    is unavoidable.

    My gut feeling is that returning to "dpkg's model is an accurate
    representation of the file system" will be less complex to manage
    long-term. For this to work, the model needs to be able to express
    reality, so I guess we can't avoid updating dpkg.

    I'm also not convinced that the current filesystem layout will remain as
    it is, for example I can see a use case for installing kernel modules
    outside of /usr. It would be great to have a generic mechanism here, and
    be able to do transitions like these without inventing new tools every
    time.

    Also, the more we can do in a descriptive framework, the better we can
    do static checks. The main reason we can argue about what packages are
    affected is that we have a database of what files are installed where,
    and that still accurately reflects reality, so we can apply a
    transformation onto this data and check for conflicts -- but we cannot
    see diversions in this database as these are created from imperative
    code.

    So my fear is that if we create a workaround here that is implemented as imperative code in pre/postinst, this will be invisible to whoever plans
    the next transition, so this would create immense technical debt.

    Simon

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marc Haber@21:1/5 to All on Thu Apr 27 11:00:01 2023
    On Thu, 27 Apr 2023 07:58:35 +0200, Simon Richter <sjr@debian.org>
    wrote:
    On Thu, Apr 27, 2023 at 12:34:06AM +0200, Helmut Grohne wrote:
    At some point the question becomes: Do we want that complexity inside
    dpkg (aka DEP 17 or some variant of it) or outside of dpkg (i.e. what
    we're talking about here). It seems clear at this time, that complexity
    is unavoidable.

    My gut feeling is that returning to "dpkg's model is an accurate >representation of the file system" will be less complex to manage
    long-term. For this to work, the model needs to be able to express
    reality, so I guess we can't avoid updating dpkg.

    My gut feeling is that we are wasting prescious time of numerous
    skilled Debian Developers to find ugly workarounds to something that
    should be done in dpkg, but isnt being done because one dpkg
    maintainer has decided to not go the way the project has decided to
    go.

    This inability to find consensus, to take decisions, accept and follow
    them is one of the most central problems that Debian has.

    Greetings
    Marc
    --
    -------------------------------------- !! No courtesy copies, please !! ----- Marc Haber | " Questions are the | Mailadresse im Header Mannheim, Germany | Beginning of Wisdom " |
    Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 621 72739834

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Marc Haber on Thu Apr 27 13:00:01 2023
    Hi Marc,

    On Thu, Apr 27, 2023 at 10:58:46AM +0200, Marc Haber wrote:
    My gut feeling is that we are wasting prescious time of numerous
    skilled Debian Developers to find ugly workarounds to something that
    should be done in dpkg, but isnt being done because one dpkg
    maintainer has decided to not go the way the project has decided to
    go.

    I find this mail of yours very disappointing and possibly even failing
    our Code of Conduct on multiple accounts.

    The origin of this thread was a proposal to adapt dpkg. Your mail
    appears to imply that you are in favour of that approach. Yet, you
    describe this as wasting time. Can you redirect your energy at reviewing
    DEP 17 and thus building consensus instead?

    I would also like to remind you of constitution section 2.1.1. Clearly,
    Guillem does not like the approach Debian has chosen and chooses to not implement the necessary changes. However, nobody else has done so
    either. The closest thing to a working patch is what Simon Richter did
    and even he does not consider it ready for inclusion at the time of this writing. As such, I find the implied accusation disrespectful.

    This inability to find consensus, to take decisions, accept and follow
    them is one of the most central problems that Debian has.

    This thread precisely is about finding consensus about a way to move
    forward. We evaluate multiple different approaches to contain the
    necessary complexity in parallel. I think this is fine. Your
    contribution to this process is not constructive. Please reconsider your involvement in this debate.

    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Holger Levsen@21:1/5 to Marc Haber on Thu Apr 27 14:00:01 2023
    On Thu, Apr 27, 2023 at 10:58:46AM +0200, Marc Haber wrote:
    My gut feeling is that we are wasting prescious time of numerous
    skilled Debian Developers to find ugly workarounds to something that
    should be done in dpkg, but isnt being done because one dpkg
    maintainer has decided to not go the way the project has decided to
    go.

    fwiw, I largely agree with this.

    Constitution 2.1.1 is great, however we don't really have a mechanism how to deal with people flat out ignoring Constitution 6 aka the tech-ctte and doubting
    and activly working against it's decisions.


    --
    cheers,
    Holger

    ⢀⣴⠾⠻⢶⣦⠀
    ⣾⠁⢠⠒⠀⣿⡁ holger@(debian|reproducible-builds|layer-acht).org
    ⢿⡄⠘⠷⠚⠋⠀ OpenPGP: B8BF54137B09D35CF026FE9D 091AB856069AAA1C
    ⠈⠳⣄

    It ain't no revolution, just because you can dance to it.

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEuL9UE3sJ01zwJv6dCRq4VgaaqhwFAmRKY0AACgkQCRq4Vgaa qhy/IA//UeC83jeNjuCCe4oJikqLq1Jf0dm95b6GqBlLshVtI+bVMX0dHgnZmRXP 1Apo6EMKELP866YVQHhswGKzLTuGotp9xql3IKiM9VMBh8wGWNKvNM/y8EfqEwSY EiZuP4kJchqwBja7etUVRATkHmiJQAEOtfT3KgSEi/9RjN0IlSxz8ISMbzU/fF5V uUHcEXc85RJ3R3lRzqlYYtFdsyK6p0VWHLyZ/AKATB4YONbkoi+X/I0zZH5egtBX 1sLrY10B0okZWHeLdlGOVhC6CFpO6w57IirpxNLPI/xnSi34c/oOGihJyM/KmYOr m80PNwMNLPfDTcOym8kN1DDYVk+YI0N9He1JS/+YXGnXV2TCkYjNpI/4KnXBfvcW C1j0zUYDkbFbWUHiEK+D7QWayqrgq+VQDcnbXbzrFm/KBfz6V8Ivu8t/mVc19j+W kwrpjQXB0Qe3hgFIKKWrCjggbORqOq96gdQiY2tdrjAMC5RYm7A1lCOsWBt2j3IB iASyHS0DaYIXTitb33qtUFW6CyByKptIFZ9pqw1ulC469VOG5aD9RM7A2hOju7ox vSqmDhIV1q9aCaXl2qzC8tcbpt13Yp42lamZqODySOZDvVEg8HdLxSG
  • From Helmut Grohne@21:1/5 to Simon McVittie on Thu Apr 27 15:40:01 2023
    XPost: linux.debian.maint.dpkg

    Hi Simon,

    On Sat, Apr 22, 2023 at 11:41:29AM +0100, Simon McVittie wrote:
    You might reasonably say that "the maintainer of bar didn't add the
    correct Breaks/Replaces on foo" is a RC bug in bar - and it is! - but
    judging by the number of "missing Breaks/Replaces" bug reports that have
    to be opened by unstable users (sometimes me), it's a very easy mistake
    to make.

    That number seemed quite vague to me and I wanted to get a better handle
    on it. The rough idea here should be that we have some package from
    bullseye and "upgrade" it to a different package from bookworm.
    Generating useful candidates for this can be done using Contents. Given candidates, I've attached a validation script:

    ./check_conflicts.sh $OLDPKG bullseye $NEWPKG bookworm

    In order to draw value from it, the output must be parsed. The exit code
    can be non-zero for various reasons. As for candidate generation, I
    think one can either just try them all (which takes a bit longer on the validation phase) or reduce their number by ignoring existing
    Breaks+Replaces, but I haven't found an elegant solution for the latter
    yet.

    In any case, unstable has around:
    * 5700 Breaks
    * 6500 Replaces
    * 100 unpack errors due to missing Breaks+Replaces

    That latter number has just been turned into rc bugs...

    So maybe it isn't as bad as we think it is, but it definitely is an
    aspect that may require a more automated solution.

    In any case, that also gives us a rough idea on how many Breaks+Replaces
    we'd have to convert to Conflicts. 6000 likely is an upper bound. I
    expect that it is probably below 1000 since we can ignore conflicting
    paths that reside below /usr only. I'm not sure whether these numbers
    argue in favour or against the projected approach.

    Helmut

    #!/bin/shset -euxif test -n "${CONFLICT_TEST_CASE_INNER:+set}"; then cd "$1" sed -i -e "s/ $CONFLICT_TEST_CASE_FROMDIST / $CONFLICT_TEST_CASE_TODIST /" ./etc/apt/sources.list test "$CONFLICT_TEST_CASE_TODIST" = bookworm && sed -i -e 's/ non-free/&
    non-free-firmware/' ./etc/apt/sources.list APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-get update C=$(APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-cache show --no-all-versions "$CONFLICT_TEST_CASE_TOPKG" | sed -n '/^Conflicts:/p') PD=$(APT_CONFIG="$MMDEBSTRAP_
    APT_CONFIG" apt-cache show --no-all-versions "$CONFLICT_TEST_CASE_TOPKG" | sed -n 's/^Pre-Depends://p') if test -n "$C" -o -n "$PD"; then set -- test -n "$C" && set -- "$@" "$C" test -n "$PD" && set -- "$@" "$PD" # apt-get satisfy behaves
    differently when not chrooted. Unknown cause. chroot . apt-get satisfy -y "$@" fi APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-get download "$CONFLICT_TEST_CASE_TOPKG" # cannot use dpkg --root due to https://lists.debian.org/debian-dpkg/2023/03/msg00003.
    html chroot . dpkg --auto-deconfigure --unpack ./*.debelse export CONFLICT_TEST_CASE_INNER=yes export CONFLICT_TEST_CASE_FROMPKG=$1 export CONFLICT_TEST_CASE_FROMDIST=$2 export CONFLICT_TEST_CASE_TOPKG=$3 export CONFLICT_TEST_CASE_TODIST=$4
    export CONFLICT_TEST_CASE_MIRROR=${5:-http://deb.debian.org/debian} mmdebstrap \ --verbose \ --variant=apt \ --hook-dir=/usr/share/mmdebstrap/hooks/maybe-merged-usr \ --include="$CONFLICT_TEST_CASE_FROMPKG" \ --components=main,contrib,non-
    free \ --customize-hook="$(realpath "$0")" \ "$CONFLICT_TEST_CASE_FROMDIST" \ /dev/null \ "$CONFLICT_TEST_CASE_MIRROR"fi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marco d'Itri@21:1/5 to Helmut Grohne on Thu Apr 27 15:40:01 2023
    On Apr 27, Helmut Grohne <helmut@subdivi.de> wrote:

    The origin of this thread was a proposal to adapt dpkg. Your mail
    No, Marc is right. The origin of this thread is trying to find
    workaround because the dpkg maintainer refused long ago to implement
    a simpler solution.

    --
    ciao,
    Marco

    -----BEGIN PGP SIGNATURE-----

    iHUEABYIAB0WIQQnKUXNg20437dCfobLPsM64d7XgQUCZEp7DQAKCRDLPsM64d7X gZByAQDLxbJ/veeWGHluGaM2FLpvmxfMItbzx49oSZchcd8fFAEA8r8rJo1/hH5E SsCbHzRWhoIliCfbZDle/5O1mfCtwA4=
    =09q8
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon Richter@21:1/5 to Holger Levsen on Thu Apr 27 17:00:01 2023
    Hi,

    On Thu, Apr 27, 2023 at 11:57:58AM +0000, Holger Levsen wrote:

    Constitution 2.1.1 is great, however we don't really have a mechanism how to deal with people flat out ignoring Constitution 6 aka the tech-ctte and doubting
    and activly working against it's decisions.

    We have: we can find a new maintainer and transfer the package. For that
    to happen, someone would have to step up and volunteer to either develop
    the necessary functionality, or accept a patch that does so, and then
    continue as maintainer.

    This has not happened.

    I also doubt it will happen, because anyone capable of maintaining a
    core system component such as dpkg is aware that nothing implemented so
    far is of sufficient quality that they want to be responsible for its
    continued maintenance.

    The tech-ctte decision mainly adds an additional constraint on proposed solutions: they may not require a temporary rollback (through
    dpkg-usrunmess or similar), but must accept transitioned and half-
    transitioned systems as they are, and bring them to a fully-transitioned
    and consistent state. It's unclear if it also means that dpkg need not
    provide a way to remove aliases.

    This adds a moderate amount of additional complexity as we need to add
    more checks to hot paths in dpkg, and we need to verify that these code
    paths work. In my opinion, having these paths will add robustness to
    dpkg, so we want them anyway, so this doesn't add further delay.

    The core problem remains however: the tech-ctte decision has not made
    code appear, and the Constitution is also powerless to do so.

    Simon

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marc Haber@21:1/5 to All on Thu Apr 27 18:40:01 2023
    On Thu, 27 Apr 2023 12:53:31 +0200, Helmut Grohne <helmut@subdivi.de>
    wrote:
    failing
    our Code of Conduct

    The thread went CoC and died. End of discussion for me.

    --
    -------------------------------------- !! No courtesy copies, please !! ----- Marc Haber | " Questions are the | Mailadresse im Header Mannheim, Germany | Beginning of Wisdom " |
    Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 621 72739834

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Helmut Grohne on Fri Apr 28 10:10:01 2023
    XPost: linux.debian.maint.dpkg

    On Thu, Apr 27, 2023 at 12:34:06AM +0200, Helmut Grohne wrote:
    Ok, let's move on. I've proposed diversions as a cure, but in reality diversions are a problem themselves. Consider that
    cryptsetup-nuke-password diverts /lib/cryptsetup/askpass, which is
    usually owned by cryptsetup. If cryptsetup were to move that file to
    /usr, the diversion would not cover it anymore and the actual content of askpass would depend on the unpack order. That's very bad and none of
    what I proposed earlier is going to fix this.

    And of course, this is not some special example, it's a pattern:
    * /lib/udev/rules.d/60-cdrom_id.rules: udev -> amazon-ec2-utils
    * /sbin/dhclient: isc-dhcp-client -> isc-dhcp-client-ddns
    * /bin/systemd-sysusers: systemd -> opensysusers
    * ...

    So how do we fix diversions? Let's have a look into the dpkg toolbox
    again. I've got an idea. Diversions. What you say? How do you fix
    diversions with diversions? Quite obviously, you divert
    /usr/bin/dpkg-divert! And whenever dpkg-divert is instructed to add a diversion for a non-canonical path, you forward that call to the real dpkg-divert, but also call it with a canonicalized version such that
    both locations are covered. When initially deploying the diversion of /usr/bin/dpkg-divert, we also need to transform existing diversions.
    Other than that, things should work after doubling down on diversions.
    Sorry, I don't have a test case for this yet.

    I still don't have a test case, but I have data. Using
    binarycontrol.d.n, I identified packages setting up diversions in
    preinst (this seems most common, but dash for instance sets up a
    diversion in postinst instead, so there are some false negatives). And
    while I initially tried to parse those preinst scripts, solving the
    halting problem seemed just too hard, so I opted for just running them.
    I'm attaching the relevant scripts and showing the affected diversions:

    diversion of /lib/udev/rules.d/60-cdrom_id.rules to /lib/udev/rules.d/60-cdrom_id.rules.disabled by amazon-ec2-utils in stable, testing, unstable
    diversion of /sbin/coldreboot to /lib/container/divert/coldreboot.orig by bfh-container in testing, unstable
    diversion of /sbin/halt to /lib/container/divert/halt.orig by bfh-container in testing, unstable
    diversion of /sbin/poweroff to /lib/container/divert/poweroff.orig by bfh-container in testing, unstable
    diversion of /sbin/reboot to /lib/container/divert/reboot.orig by bfh-container in testing, unstable
    diversion of /sbin/shutdown to /lib/container/divert/shutdown.orig by bfh-container in testing, unstable
    diversion of /lib/cryptsetup/askpass to /lib/cryptsetup/askpass.cryptsetup by cryptsetup-nuke-password in testing, unstable
    diversion of /sbin/dhclient to /sbin/dhclient-noddns by isc-dhcp-client-ddns in stable, testing, unstable
    diversion of /sbin/coldreboot to /lib/molly-guard/coldreboot by molly-guard in stable, testing, unstable
    diversion of /sbin/halt to /lib/molly-guard/halt by molly-guard in stable, testing, unstable
    diversion of /sbin/poweroff to /lib/molly-guard/poweroff by molly-guard in stable, testing, unstable
    diversion of /sbin/reboot to /lib/molly-guard/reboot by molly-guard in stable, testing, unstable
    diversion of /sbin/shutdown to /lib/molly-guard/shutdown by molly-guard in stable, testing, unstable
    diversion of /bin/systemd-sysusers to /bin/systemd-sysusers.real by opensysusers in stable, testing, unstable
    diversion of /sbin/coldreboot to /lib/open-infrastructure/container/divert/coldreboot.orig by progress-linux-container in stable, testing, unstable
    diversion of /sbin/halt to /lib/open-infrastructure/container/divert/halt.orig by progress-linux-container in stable, testing, unstable
    diversion of /sbin/poweroff to /lib/open-infrastructure/container/divert/poweroff.orig by progress-linux-container in stable, testing, unstable
    diversion of /sbin/reboot to /lib/open-infrastructure/container/divert/reboot.orig by progress-linux-container in stable, testing, unstable
    diversion of /sbin/shutdown to /lib/open-infrastructure/container/divert/shutdown.orig by progress-linux-container in stable, testing, unstable
    diversion of /bin/zcat to /bin/zcat.gzip by zutils in stable, testing, unstable diversion of /bin/zcmp to /bin/zcmp.gzip by zutils in stable, testing, unstable diversion of /bin/zdiff to /bin/zdiff.gzip by zutils in stable, testing, unstable
    diversion of /bin/zegrep to /bin/zegrep.gzip by zutils in stable, testing, unstable
    diversion of /bin/zfgrep to /bin/zfgrep.gzip by zutils in stable, testing, unstable
    diversion of /bin/zgrep to /bin/zgrep.gzip by zutils in stable, testing, unstable

    All other diversion affect /etc or /usr and I think we're not going to
    move any files from /usr to /. So this is a complete list as of today
    and I have to say, I expected it to be longer. In effect, we're talking
    about merely 8 packages.

    For completeness sake, I also looked at the other packages mentioning dpkg-divert in their preinst to catch false negatives. I'll skip
    diversions inside /usr as well as removals of diversions here:
    * amazon-ec2-net-utils: diversion inside /etc
    * angband: comment about diversions
    * arpwatch: comment about diversions
    * dash: complex use of conditional diversions via postinst
    * dist: comment about diversions
    * gpr: conditional diversion (inside /usr)
    * iputils-arping: check for an existing diversion
    * iputils-clockdiff: check for an existing diversion
    * iputils-ping: check for an existing diversion
    * ld10k1: comment about diversions
    * mailagent: comment about diversions
    * oping: checks for an existing diversion
    * psgml: comment about diversions
    * ucf: comment about diversions
    * wireshark-common: checks for an existing diversion

    So yeah, with the exception of dash, this looks fairly good. Let me also
    dive into dash. Unlike the majority of diverters, it diverts in postinst
    rather than preinst to allow controlling /bin/sh via debconf. A similar technique is in effect by gpr. In any case, this is special, because
    dash diverts its own files, so when moving dash's file, its diversions
    can be migrated at the same time. It merely means, that we cannot have debhelper just move files (as that would horribly break dash) and
    instead have to move files on a package-by-package way. We could also
    opt for removing dash's diversion in the default case and there even is
    a patch for doing so (#989632) since almost two years. Too bad we didn't
    apply it. In any case, as long as the file moving is not forced via
    debhelper, dash should be harmless.

    With this number, another option is on the table. Rather than divert dpkg-divert, we could just fix these 8 packages to duplicate their
    diversions for /usr and then when moving the underlying files add
    versioned Conflicts to the old version of diverters (none of which are essential). So this is an order of 15 uploads (8 diverters, 6 diverted packages, dash).

    Luca Boccassi kindly pointed me at config-package-dev though. This is a
    tool for generating local packages and it also employs dpkg-divert.
    There is a significant risk of breaking this use case. If we were to
    divert dpkg-divert and automatically duplicate diversions, this use case
    were automatically covered.

    I am unsure how to proceed here and request assistance from the
    debathena project to evaluate the situation. If possible, I'd like to
    avoid the complexity of wrapping dpkg-divert.

    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luca Boccassi@21:1/5 to Helmut Grohne on Fri Apr 28 11:40:01 2023
    XPost: linux.debian.maint.dpkg

    On Fri, 28 Apr 2023 at 09:09, Helmut Grohne <helmut@subdivi.de> wrote:

    On Thu, Apr 27, 2023 at 12:34:06AM +0200, Helmut Grohne wrote:
    Ok, let's move on. I've proposed diversions as a cure, but in reality diversions are a problem themselves. Consider that
    cryptsetup-nuke-password diverts /lib/cryptsetup/askpass, which is
    usually owned by cryptsetup. If cryptsetup were to move that file to
    /usr, the diversion would not cover it anymore and the actual content of askpass would depend on the unpack order. That's very bad and none of
    what I proposed earlier is going to fix this.

    And of course, this is not some special example, it's a pattern:
    * /lib/udev/rules.d/60-cdrom_id.rules: udev -> amazon-ec2-utils
    * /sbin/dhclient: isc-dhcp-client -> isc-dhcp-client-ddns
    * /bin/systemd-sysusers: systemd -> opensysusers
    * ...

    So how do we fix diversions? Let's have a look into the dpkg toolbox
    again. I've got an idea. Diversions. What you say? How do you fix diversions with diversions? Quite obviously, you divert /usr/bin/dpkg-divert! And whenever dpkg-divert is instructed to add a diversion for a non-canonical path, you forward that call to the real dpkg-divert, but also call it with a canonicalized version such that
    both locations are covered. When initially deploying the diversion of /usr/bin/dpkg-divert, we also need to transform existing diversions.
    Other than that, things should work after doubling down on diversions. Sorry, I don't have a test case for this yet.

    I still don't have a test case, but I have data. Using
    binarycontrol.d.n, I identified packages setting up diversions in
    preinst (this seems most common, but dash for instance sets up a
    diversion in postinst instead, so there are some false negatives). And
    while I initially tried to parse those preinst scripts, solving the
    halting problem seemed just too hard, so I opted for just running them.
    I'm attaching the relevant scripts and showing the affected diversions:

    diversion of /lib/udev/rules.d/60-cdrom_id.rules to /lib/udev/rules.d/60-cdrom_id.rules.disabled by amazon-ec2-utils in stable, testing, unstable
    diversion of /sbin/coldreboot to /lib/container/divert/coldreboot.orig by bfh-container in testing, unstable
    diversion of /sbin/halt to /lib/container/divert/halt.orig by bfh-container in testing, unstable
    diversion of /sbin/poweroff to /lib/container/divert/poweroff.orig by bfh-container in testing, unstable
    diversion of /sbin/reboot to /lib/container/divert/reboot.orig by bfh-container in testing, unstable
    diversion of /sbin/shutdown to /lib/container/divert/shutdown.orig by bfh-container in testing, unstable
    diversion of /lib/cryptsetup/askpass to /lib/cryptsetup/askpass.cryptsetup by cryptsetup-nuke-password in testing, unstable
    diversion of /sbin/dhclient to /sbin/dhclient-noddns by isc-dhcp-client-ddns in stable, testing, unstable
    diversion of /sbin/coldreboot to /lib/molly-guard/coldreboot by molly-guard in stable, testing, unstable
    diversion of /sbin/halt to /lib/molly-guard/halt by molly-guard in stable, testing, unstable
    diversion of /sbin/poweroff to /lib/molly-guard/poweroff by molly-guard in stable, testing, unstable
    diversion of /sbin/reboot to /lib/molly-guard/reboot by molly-guard in stable, testing, unstable
    diversion of /sbin/shutdown to /lib/molly-guard/shutdown by molly-guard in stable, testing, unstable
    diversion of /bin/systemd-sysusers to /bin/systemd-sysusers.real by opensysusers in stable, testing, unstable
    diversion of /sbin/coldreboot to /lib/open-infrastructure/container/divert/coldreboot.orig by progress-linux-container in stable, testing, unstable
    diversion of /sbin/halt to /lib/open-infrastructure/container/divert/halt.orig by progress-linux-container in stable, testing, unstable
    diversion of /sbin/poweroff to /lib/open-infrastructure/container/divert/poweroff.orig by progress-linux-container in stable, testing, unstable
    diversion of /sbin/reboot to /lib/open-infrastructure/container/divert/reboot.orig by progress-linux-container in stable, testing, unstable
    diversion of /sbin/shutdown to /lib/open-infrastructure/container/divert/shutdown.orig by progress-linux-container in stable, testing, unstable
    diversion of /bin/zcat to /bin/zcat.gzip by zutils in stable, testing, unstable
    diversion of /bin/zcmp to /bin/zcmp.gzip by zutils in stable, testing, unstable
    diversion of /bin/zdiff to /bin/zdiff.gzip by zutils in stable, testing, unstable
    diversion of /bin/zegrep to /bin/zegrep.gzip by zutils in stable, testing, unstable
    diversion of /bin/zfgrep to /bin/zfgrep.gzip by zutils in stable, testing, unstable
    diversion of /bin/zgrep to /bin/zgrep.gzip by zutils in stable, testing, unstable

    All other diversion affect /etc or /usr and I think we're not going to
    move any files from /usr to /. So this is a complete list as of today
    and I have to say, I expected it to be longer. In effect, we're talking
    about merely 8 packages.

    For completeness sake, I also looked at the other packages mentioning dpkg-divert in their preinst to catch false negatives. I'll skip
    diversions inside /usr as well as removals of diversions here:
    * amazon-ec2-net-utils: diversion inside /etc
    * angband: comment about diversions
    * arpwatch: comment about diversions
    * dash: complex use of conditional diversions via postinst
    * dist: comment about diversions
    * gpr: conditional diversion (inside /usr)
    * iputils-arping: check for an existing diversion
    * iputils-clockdiff: check for an existing diversion
    * iputils-ping: check for an existing diversion
    * ld10k1: comment about diversions
    * mailagent: comment about diversions
    * oping: checks for an existing diversion
    * psgml: comment about diversions
    * ucf: comment about diversions
    * wireshark-common: checks for an existing diversion

    This is great data - indeed, 8 packages seems eminently fixable.

    So yeah, with the exception of dash, this looks fairly good. Let me also
    dive into dash. Unlike the majority of diverters, it diverts in postinst rather than preinst to allow controlling /bin/sh via debconf. A similar technique is in effect by gpr. In any case, this is special, because
    dash diverts its own files, so when moving dash's file, its diversions
    can be migrated at the same time. It merely means, that we cannot have debhelper just move files (as that would horribly break dash) and
    instead have to move files on a package-by-package way. We could also
    opt for removing dash's diversion in the default case and there even is
    a patch for doing so (#989632) since almost two years. Too bad we didn't apply it. In any case, as long as the file moving is not forced via debhelper, dash should be harmless.

    If I understand correctly, by "forced via debhelper" you mean the
    proposal of fixing the paths at build time, right? But if not via
    that, it means having to fix all of them by hand, which is a lot - is
    it possible to fix dash instead? Or else, we could add an opt-out via
    one of the usual dh mechanisms, and use it only in dash perhaps?

    With this number, another option is on the table. Rather than divert dpkg-divert, we could just fix these 8 packages to duplicate their
    diversions for /usr and then when moving the underlying files add
    versioned Conflicts to the old version of diverters (none of which are essential). So this is an order of 15 uploads (8 diverters, 6 diverted packages, dash).

    Luca Boccassi kindly pointed me at config-package-dev though. This is a
    tool for generating local packages and it also employs dpkg-divert.
    There is a significant risk of breaking this use case. If we were to
    divert dpkg-divert and automatically duplicate diversions, this use case
    were automatically covered.

    I am unsure how to proceed here and request assistance from the
    debathena project to evaluate the situation. If possible, I'd like to
    avoid the complexity of wrapping dpkg-divert.

    Which part of config-package-dev causes a conflict here? Is it
    something that can be fixed? Given it's declarative, an upload + rdeps
    rebuild should be all that's needed, assuming we know what the issue
    is and how to fix it. As far as I can remember, it's a build-time
    utility and everything it does is embedded in the target package's
    maintainer scripts. But it's been a few years since I last used it, so
    I might remember wrongly.

    Kind regards,
    Luca Boccassi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Timo =?utf-8?Q?R=C3=B6hling?=@21:1/5 to All on Fri Apr 28 12:00:01 2023
    XPost: linux.debian.maint.dpkg

    * Luca Boccassi <bluca@debian.org> [2023-04-28 10:12]:
    Which part of config-package-dev causes a conflict here? Is it
    something that can be fixed? Given it's declarative, an upload + rdeps >rebuild should be all that's needed, assuming we know what the issue
    is and how to fix it. As far as I can remember, it's a build-time
    utility and everything it does is embedded in the target package's
    maintainer scripts. But it's been a few years since I last used it, so
    I might remember wrongly.

    You remember correctly. It is relatively straight-forward to patch config-package-dev to create additional diversions for files in /
    and /usr (if we decide that is the way forward), but admins will
    have to rebuild their local config packages for these changes to
    take effect.


    Cheers
    Timo

    --
    ⢀⣴⠾⠻⢶⣦⠀ ╭────────────────────────────────────────────────────╮
    ⣾⠁⢠⠒⠀⣿⡁ │ Timo Röhling │
    ⢿⡄⠘⠷⠚⠋⠀ │ 9B03 EBB9 8300 DF97 C2B1 23BF CC8C 6BDD 1403 F4CA │
    ⠈⠳⣄⠀⠀⠀⠀ ╰────────────────────────────────────────────────────╯

    -----BEGIN PGP SIGNATURE-----

    iQGzBAEBCgAdFiEEJvtDgpxjkjCIVtam+C8H+466LVkFAmRLl+kACgkQ+C8H+466 LVn3GAv/bBoFzkbb8E2fARRc4gJ+rkTObRffHkYrb1mtHYvD2MnE8R+9clqGqyXP w2LNNg6XZ9I7Sf8vzJcVMjdNbYQhsugB66fPV3OITIgklFv2gMqzUYvMwoS7T7c+ 1wbdeuZlgsXaO4CPOGiOCbt+TIEI/kSYRxwcEIobcLB8D8kgK07niNgPmkPHH6KL U4zJDH+fvEXuLsmjZeglVwpu2apZg3KPh2fJbZBZCfAEi6X1GDyUn9wRkmsSM48e fI1lNnzcbscdo3NATOf5K0un9dNp4E+hmr8R/oRbdeg1hXcsL+F1sgHzwbo83K2o isHDGjsKX4glbFx7IIiF3y5Q4Vu6/hvJmA0kfsA7kcb
  • From Simon Richter@21:1/5 to Helmut Grohne on Fri Apr 28 14:10:01 2023
    XPost: linux.debian.maint.dpkg

    Hi,

    On Thu, Apr 27, 2023 at 12:34:06AM +0200, Helmut Grohne wrote:

    Ok, let's move on. I've proposed diversions as a cure, but in reality diversions are a problem themselves. Consider that
    cryptsetup-nuke-password diverts /lib/cryptsetup/askpass, which is
    usually owned by cryptsetup. If cryptsetup were to move that file to
    /usr, the diversion would not cover it anymore and the actual content of askpass would depend on the unpack order. That's very bad and none of
    what I proposed earlier is going to fix this.

    Another question: how would this interact with a patch that teaches dpkg
    to do aliases properly, because such a patch would affect diversion
    handling as well -- specifically, aliases mean that diversions are also
    aliased (I believe my patch implicitly does this right, but I think I
    just got 60 more testcases to write), and that diversion targets are
    implicitly redirected to a resolved form (I don't do that yet, but it's
    simple to add to my patch).

    I think the "divert, but do not rename" approach itself should be fairly
    safe, because all it does is make a deletion fail. Registering the
    diversion to the new package should be sufficient to make sure the newly unpacked file is not diverted. This probably needs some additional undo operations for failed installs/upgrades, so the diversion is properly
    removed in these cases (there is no guarantee that postinst will be
    called after preinst, we could also end up in postrm).

    So how do we fix diversions? Let's have a look into the dpkg toolbox
    again. I've got an idea. Diversions. What you say? How do you fix
    diversions with diversions? Quite obviously, you divert
    /usr/bin/dpkg-divert! And whenever dpkg-divert is instructed to add a diversion for a non-canonical path, you forward that call to the real dpkg-divert, but also call it with a canonicalized version such that
    both locations are covered. When initially deploying the diversion of /usr/bin/dpkg-divert, we also need to transform existing diversions.

    Ouch, if you deploy that, I will definitely need to add diversion
    merging code to alias registration. That's another 60 testcases, but we
    need defined behaviour for that anyway.

    Transforming existing diversions: yes, if you can find out about them
    without looking at dpkg internal files. It may very well be necessary to
    update the file format on one of these, and if that would cause your
    script to create nonsense diversions, that'd be another thing we'd have
    to work around while building real aliasing support.

    My current mood is "I'd rather focus on a proper solution, not another
    hack that needs to be supported by the proper solution."

    Anything we build here that is not aliasing support for dpkg, but
    another "shortcut" will delay aliasing support for dpkg because it adds
    more possible code paths that all need to be tested.

    Keep in mind that we're here because someone took a shortcut, after all.

    Simon

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Simon Richter on Fri Apr 28 15:50:02 2023
    XPost: linux.debian.maint.dpkg

    Hi Simon,

    On Fri, Apr 28, 2023 at 02:07:33PM +0200, Simon Richter wrote:
    Transforming existing diversions: yes, if you can find out about them
    without looking at dpkg internal files. It may very well be necessary to update the file format on one of these, and if that would cause your
    script to create nonsense diversions, that'd be another thing we'd have
    to work around while building real aliasing support.

    My current mood is "I'd rather focus on a proper solution, not another
    hack that needs to be supported by the proper solution."

    Anything we build here that is not aliasing support for dpkg, but
    another "shortcut" will delay aliasing support for dpkg because it adds
    more possible code paths that all need to be tested.

    Keep in mind that we're here because someone took a shortcut, after all.

    I think we have a misunderstanding here. As far as I understand it, the
    core idea of Luca's approach is that we move all files to their
    canonical locations and then - when nothing is left in directories such
    as /bin or /lib - there is no aliasing anymore, which is why we do not
    have to teach dpkg about aliasing and never patch it.

    From my point of view the only reason to try and solve this with a pile
    of hacks is get us to a state that the current dpkg can deal well with
    again (because all aliasing is gone). And while I've argued earlier that
    dpkg will need to support aliasing, I'm trying to get myself convinced
    that this is not necessary. Personally, I don't have a final conclusion
    on this yet. Can I ask you to go into more detail as to why you think
    that patching dpkg is ultimately necessary?

    At the point where we conclude that no, we cannot move forward without
    patching dpkg, I fully agree with you that taking more shortcuts is only
    going to make it worse.

    Please do understand my research as evaluating all possible approaches
    (and their consequences) in parallel. I'm not trying to push a
    particular approach other than trying to move the whole matter forward.
    Once we have a better understanding, we'll have to build consensus
    around one of these approaches somehow.

    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From James Addison@21:1/5 to Helmut Grohne on Fri Apr 28 16:00:01 2023
    On Thu, 27 Apr 2023 at 14:37, Helmut Grohne <helmut@subdivi.de> wrote:

    Hi Simon,

    On Sat, Apr 22, 2023 at 11:41:29AM +0100, Simon McVittie wrote:
    You might reasonably say that "the maintainer of bar didn't add the
    correct Breaks/Replaces on foo" is a RC bug in bar - and it is! - but judging by the number of "missing Breaks/Replaces" bug reports that have
    to be opened by unstable users (sometimes me), it's a very easy mistake
    to make.

    That number seemed quite vague to me and I wanted to get a better handle
    on it. The rough idea here should be that we have some package from
    bullseye and "upgrade" it to a different package from bookworm.
    Generating useful candidates for this can be done using Contents. Given candidates, I've attached a validation script:

    ./check_conflicts.sh $OLDPKG bullseye $NEWPKG bookworm

    In order to draw value from it, the output must be parsed. The exit code
    can be non-zero for various reasons. As for candidate generation, I
    think one can either just try them all (which takes a bit longer on the validation phase) or reduce their number by ignoring existing Breaks+Replaces, but I haven't found an elegant solution for the latter
    yet.

    In any case, unstable has around:
    * 5700 Breaks
    * 6500 Replaces
    * 100 unpack errors due to missing Breaks+Replaces

    That latter number has just been turned into rc bugs...

    Hi Helmut,

    To make sure we don't miss any packages out accidentally: could you
    confirm that those hundred-or-so errors occurred from 27 or so
    distinct packages?

    (looking at RC bugs created within the past week, I currently find 27
    bugs with 'Breaks+Replaces' in the title)

    https://udd.debian.org/bugs.cgi?release=na&merged=ign&keypackages=only&fnewer=only&fnewerval=7&flastmodval=7&rc=1&cpopcon=1&chints=1&ckeypackage=1&ctags=1&cdeferred=1&caffected=1&sortby=last_modified&sorto=asc&format=html#results

    Thanks,
    James

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jochen Sprickerhof@21:1/5 to All on Fri Apr 28 19:00:01 2023
    Hi James,

    * James Addison <jay@jp-hosting.net> [2023-04-28 14:54]:
    To make sure we don't miss any packages out accidentally: could you
    confirm that those hundred-or-so errors occurred from 27 or so
    distinct packages?

    (looking at RC bugs created within the past week, I currently find 27
    bugs with 'Breaks+Replaces' in the title)

    https://udd.debian.org/bugs.cgi?release=na&merged=ign&keypackages=only&fnewer=only&fnewerval=7&flastmodval=7&rc=1&cpopcon=1&chints=1&ckeypackage=1&ctags=1&cdeferred=1&caffected=1&sortby=last_modified&sorto=asc&format=html#results

    That's only key packages. Here is the full list:

    https://bugs.debian.org/cgi-bin/pkgreport.cgi?dist=unstable;include=subject%3Amissing+Breaks%2BReplaces;submitter=helmut%40subdivi.de

    Cheers Jochen

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEc7KZy9TurdzAF+h6W//cwljmlDMFAmRL+bAACgkQW//cwljm lDMfxA//RJu1ZEz7ZfR4TB6IcoOsE+pfmwSnT6Y4ywGfoh+TBjIF3EDQDVktVGwV PeUX9XqRIzf1cEMnFkrlWyFzYA8uIMBZnk23XoT/SbKFsFv/I/FsNOv23xkjjCEL EFjxVMLznz0LZV6GzFDbDjFl1D8B3bjRetZSr0xcXTkIC07xk7vH6mFQ4MSb6/fi CSnwI7A5f9CFXd9n2QWTD5txmabGDBU+CVW9HkdM0EQ/fXkU+hRhpGprJ8iWul+q lpr/WsVzqfo9qNKUBuBfr7Iyl3i4NHWf1M04tXrfVHQ1We1QYguxsIFzu0SXDFqg WBoUDq8LL3kExduvK9t9nSWcmsNxVB409II2LpcuZRoT4z4FB2X6m1xyxSc+AlHj hHC+OyIRr+h+WCigO29fnqLSX6nplIT/pw+1s2HEv+r/X4yepPMY4FX0ezawIZzR ZdR+WFruda7SXomM50uwrH9CiUmMsE8Ey9Wd66bdo47TM6+/lBgOHSmGd4mna85a YVs72amnnkAGd1JH1GUuut0Nd8hg7f7sVIwQF3j23zcHdM9xtnTMo5H5qTC77Ff5 F7nTN1ft8ScRHU17ezK8NBEmLnFY3JOminHnygX1kIxag78XVxIlWhzrFCsuoLsr 8N/MLmu+wAynbFYUdMk8YJpWVaBdW5GwgAnHpvVs1qqskC1AFuI=
    =C11J
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From James Addison@21:1/5 to Jochen Sprickerhof on Fri Apr 28 19:20:01 2023
    On Fri, 28 Apr 2023 at 17:52, Jochen Sprickerhof <jspricke@debian.org> wrote:

    Hi James,

    * James Addison <jay@jp-hosting.net> [2023-04-28 14:54]:
    To make sure we don't miss any packages out accidentally: could you
    confirm that those hundred-or-so errors occurred from 27 or so
    distinct packages?

    (looking at RC bugs created within the past week, I currently find 27
    bugs with 'Breaks+Replaces' in the title)

    https://udd.debian.org/bugs.cgi?release=na&merged=ign&keypackages=only&fnewer=only&fnewerval=7&flastmodval=7&rc=1&cpopcon=1&chints=1&ckeypackage=1&ctags=1&cdeferred=1&caffected=1&sortby=last_modified&sorto=asc&format=html#results

    That's only key packages. Here is the full list:

    https://bugs.debian.org/cgi-bin/pkgreport.cgi?dist=unstable;include=subject%3Amissing+Breaks%2BReplaces;submitter=helmut%40subdivi.de

    Cheers Jochen

    Ah, typical user error from me. Anyway - glad to find that they've
    all been filed. Thank you, Jochen!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Russ Allbery@21:1/5 to Helmut Grohne on Fri Apr 28 21:10:01 2023
    Helmut Grohne <helmut@subdivi.de> writes:
    On Thu, Apr 27, 2023 at 10:58:46AM +0200, Marc Haber wrote:

    My gut feeling is that we are wasting prescious time of numerous
    skilled Debian Developers to find ugly workarounds to something that
    should be done in dpkg, but isnt being done because one dpkg maintainer
    has decided to not go the way the project has decided to go.

    I find this mail of yours very disappointing and possibly even failing
    our Code of Conduct on multiple accounts.

    I am unhappy to see the Code of Conduct used in this way.

    Marc's message was not a personal attack. It did not assume bad faith, or indeed make any statements about motives at all. He expressed his opinion about project priorities and put it in the context of his personal
    judgment of the facts of the situation as he sees them.

    You may disagree with his summary of facts, or his opinion about or
    evaluation of the current situation, or even the usefulness of him raising
    this point due to lack of resources. It is certainly appropriate to raise those disagreements in response, or even to ignore the message if you
    don't think it's a constructive line of discussion. (In particular, I
    think Marc assumes that a solution in dpkg would be more straightforward, something that I think is debatable on technical grounds.)

    But to say that this is possibly a violation of the Code of Conduct is to
    say that this message doesn't meet the bar for civil discussion on our
    lists, and I think it is unreasonable to expect anyone to be more civil or even-handed than Marc was in his summary of behavior that he strongly
    disagrees with. (And, to state the obvious, I don't believe that message
    was a violation of our Code of Conduct.) Trying to set the bar higher
    than this would have the effect of forbidding particular types of hard conversations, which is not healthy for the project.

    We have to be able to talk about interpersonal disagreements and problems
    of alignment of motives and goals among the people working on the project. Sometimes those discussions are going to be uncomfortable, but we can't
    ignore them and never discuss them because they're uncomfortable. We are
    a collection of humans working together collaboratively, which means there
    will be tension and conflict and we have to deal with that, constructively
    but honestly and forthrightly.

    Part of working collaboratively with other people is that those people get
    to criticize how you are doing your work, as long as they do so
    respectfully and assuming good faith. Sometimes that includes saying that
    one believes the actions of another developer are causing a misallocation
    of project resources or time. Whether or not we end up agreeing that is
    true, this is a valid topic for discussion, and sometimes it is feedback
    that other developers need to hear so that they can do some introspection
    and evaluate whether that may indeed be the case.

    --
    Russ Allbery (rra@debian.org) <https://www.eyrie.org/~eagle/>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Helmut Grohne on Fri Apr 28 22:20:01 2023
    XPost: linux.debian.maint.dpkg

    Please excuse the volume of mails I am producing at this time, but I
    still think this adds to the discussion.

    On Thu, Apr 27, 2023 at 12:34:06AM +0200, Helmut Grohne wrote:
    I have a bad feeling about this. I think some dpkg maintainer warned us
    that diversions would break. Let's peek at his list again. He also said update-alternatives would be broken. I admit not having dug into this
    yet, but my gut feeling already is that update-alternatives will become "funny" as well though I guess we cannot fix update-alternatives by
    adding alternatives.

    Sometimes, feelings can be wrong. I admit not having done much with alternatives, so let me roughly summarize the relevant aspects and then evaluate the aliasing effects.

    Every alternative has an "alternative name". This name is the one inside /etc/alternatives. When it refers to a binary in $PATH, usually that
    binary name also is the name of the alternative. Consequently, it is
    very unlikely for us to have a conflict on this name due to aliasing.

    Every alternative also has "generic name", which is the primary path of
    the symlink installed. This can be /bin/something or /usr/bin/something
    or something else entirely. I looked through the various paths I could
    find in alternatives and never found two distinct alternatives using
    aliased paths, so this much will very likely go without problems.

    I looked around for possible non-canonical paths in alternatives (by
    installing lots of packages and discovered these:
    * /bin/bsd-csh is shipped by csh and is provided as primary target for
    the csh alternative
    * /bin/csh is a generic name for the csh alternative
    * /bin/ed is shipped by ed and is provided as primary target for the
    editor alternative
    * /bin/elvis-tiny is shipped by elvis-tiny and is provided as primary
    target for the editor alternative
    * /bin/more is shipped by util-linux and is provided as primary target
    for the pager alternative
    * /bin/ksh is a generic name for the ksh alternative
    * /bin/ksh93 is shipped by ksh93u+m and is provided as primary target
    for the ksh alternative
    * /bin/mksh is shipped by mksh and is provided both as primary and as
    slave target for the ksh alternative
    * /bin/mksh-static is shipped by mksh and is provided both as primary
    and as slave target for the ksh alternative
    * /bin/mt is a generic name for the mt alternative
    * /bin/mt-gnu is shipped by cpio and is provided as primary target
    for the mt alternative
    * /bin/mt-st is shipped by mt-st and is provided as primary target
    for the mt alternative
    * /bin/nano is shipped by nano and is provided as primary target
    for the editor alternative
    * /bin/nano-tiny is shipped by nano-tiny and is provided as primary
    target for the editor alternative
    * /bin/nc is a generic name for the nc alternative
    * /bin/nc.openbsd is shipped by netcat-openbsd and is provided as
    primary target and slave target for the nc alternative
    * /bin/nc.traditional is shipped by netcat-traditional and is provided
    as primary target and slave target for the nc alternative
    * /bin/netcat is a slave link for the nc alternative
    * /bin/rc is a generic name for the rc alternative and installed by
    9base
    * /bin/rksh is a slave link for the ksh alternative
    * /bin/rksh93 is shipped by ksh93u+m and is provided as slave target
    for the ksh alternative
    * /bin/tcsh is shipped by tcsh and is provided as a primary target for
    the csh alternative
    * /bin/true is not shipped by uim, but installed as primary target for
    the uim-toolbar alternative
    * /lib/cpp is a generic name for the cpp alternative and installed by
    cpp
    * /lib/systemd/system/ipset.service is a generic name for the
    ipset.service alternative
    * /lib/systemd/system/iptables.service is a generic name for the
    iptables.service alternative
    * /lib/systemd/system/netfilter-persistent.service is shipped by
    iptables-persistent and provided as primary target and slave target
    for the iptables.service and ipset.service alternatives by
    iptables-persistent and ipset-persistent respectively
    * /lib/systemd/system/ip6tables.service is a slave link for the
    iptables.service alternative
    * /lib/firmware/regulatory.db is a generic name for the regulartory.db
    alternative
    * /lib/firmware/regulatory.db.p7s is a slave link for the
    regulatory.db alternative
    * /lib/firmware/regulatory.db.p7s-debian is shipped by wireless-regdb
    and is provided as slave target for the regulatory.db alternative
    * /lib/firmware/regulatory.db.p7s-upstream is shipped by wireless-regdb
    and is provided as slave target for the regulatory.db alternative
    * /lib/firmware/regulatory.db-debian is shipped by wireless-regdb and
    is provided as primary alternative for the regulatory.db alternative
    * /lib/firmware/regulatory.db-upstream is shipped by wireless-regdb and
    is provided as primary alternative for the regulatory.db alternative

    I think ideally, we'd want these to become canonicalized eventually. And
    this is where things get ugly. There is three cases to consider:

    1. Updating the generic name. This can only be done if coordinated by
    all the packages updating the alternative together. There is a
    significant risk to loosing the user selection when doing so. Also
    users may programmatically (e.g. ansible/puppet) change alternatives
    and we break that too. So I think it is best to leave these as is
    eternally.

    2. The link target for the generic name. Just changing this will add a
    new alternative without removing the other one. So the old link
    target would have to be removed. When doing that, user selection is
    probably lost and in a similar way, we break users who do this
    programmatically (e.g. ansible/puppet). So best leave this as is
    eternally.

    3. Link targets for slave links. As far as I can see, we can just
    change these and on the next package update running
    update-alternatives --install will work despite printing

    update-alternatives: warning: forcing reinstallation of alternative ... because link group pager is broken

    None of these seems convertible at ease and the third category has
    basically no items, so I think we should probably just do nothing about alternatives and let them continue to use non-canonical paths. As far as
    I can see, that should just work. Does anyone disagree with that
    judgement?

    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luca Boccassi@21:1/5 to Luca Boccassi on Sat Apr 29 02:50:02 2023
    XPost: linux.debian.maint.dpkg

    On Fri, 28 Apr 2023 at 10:12, Luca Boccassi <bluca@debian.org> wrote:

    On Fri, 28 Apr 2023 at 09:09, Helmut Grohne <helmut@subdivi.de> wrote:
    So yeah, with the exception of dash, this looks fairly good. Let me also dive into dash. Unlike the majority of diverters, it diverts in postinst rather than preinst to allow controlling /bin/sh via debconf. A similar technique is in effect by gpr. In any case, this is special, because
    dash diverts its own files, so when moving dash's file, its diversions
    can be migrated at the same time. It merely means, that we cannot have debhelper just move files (as that would horribly break dash) and
    instead have to move files on a package-by-package way. We could also
    opt for removing dash's diversion in the default case and there even is
    a patch for doing so (#989632) since almost two years. Too bad we didn't apply it. In any case, as long as the file moving is not forced via debhelper, dash should be harmless.

    If I understand correctly, by "forced via debhelper" you mean the
    proposal of fixing the paths at build time, right? But if not via
    that, it means having to fix all of them by hand, which is a lot - is
    it possible to fix dash instead? Or else, we could add an opt-out via
    one of the usual dh mechanisms, and use it only in dash perhaps?

    Also as pointed out by the maintainer the debconf machinery was
    dropped from dash, last year: https://salsa.debian.org/debian/dash/-/commit/c322a1c9fc6be11d7eb4439

    This should hopefully simplify things?

    Kind regards,
    Luca Boccassi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marvin Renich@21:1/5 to All on Sat Apr 29 20:20:02 2023
    XPost: linux.debian.maint.dpkg

    * Helmut Grohne <helmut@subdivi.de> [230428 09:50]:
    I think we have a misunderstanding here. As far as I understand it, the
    core idea of Luca's approach is that we move all files to their
    canonical locations and then - when nothing is left in directories such
    as /bin or /lib - there is no aliasing anymore, which is why we do not
    have to teach dpkg about aliasing and never patch it.

    My understanding from following this thread (and others) is that dpkg
    has a bug that can easily be triggered by a sysadmin replacing a
    directory with a symlink (and some other necessary conditions that don't
    happen very often), which is explicitly allowed by policy. This bug is
    the one that is causing the problem with the approach that was chosen by
    the people implementing usrmerge, even though they were aware of this
    problem and a different approach that would have taken two release
    cycles and would not have triggered this bug was considered and
    rejected.

    If this is correct, then Luca's approach may fix the problem for
    usrmerge, but does not fix the general dpkg bug. (And, IIUC, is going
    to take two _more_ release cycles to fix the problems with usrmerge as implemented! Hmm...)

    The --add-alias solution that has been suggested in this thread seems
    like it would fix the general problem iff policy was changed to require sysadmins to use it if they replaced a directory with a symlink.

    I do not understand why the dpkg maintainer has rejected this solution;
    it would still be a fix for the general bug after the usrmerge
    transition has completed. And it would be at least one order of
    magnitude more performant than scanning the filesystem for directory
    symlinks.

    ...Marvin

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Marvin Renich on Sat Apr 29 22:20:01 2023
    XPost: linux.debian.maint.dpkg

    Hi Marvin,

    On Sat, Apr 29, 2023 at 02:08:37PM -0400, Marvin Renich wrote:
    My understanding from following this thread (and others) is that dpkg
    has a bug that can easily be triggered by a sysadmin replacing a
    directory with a symlink (and some other necessary conditions that don't happen very often), which is explicitly allowed by policy. This bug is

    I fear that this is more nuanced than it initially looks. While we kinda support symlinking parts of the directory hierarchy, the implicit
    assumption has always been that this never introduces aliasing. In other
    words, the target of such a symlink needs to be a location that is not
    used by any package.

    The problem here arises from introducing aliasing symlinks - which has
    never been supported. In that sense, we do not have consensus on whether
    this is a bug in dpkg or merely a missing feature.

    the one that is causing the problem with the approach that was chosen by
    the people implementing usrmerge, even though they were aware of this
    problem and a different approach that would have taken two release
    cycles and would not have triggered this bug was considered and
    rejected.

    In all fairness, my understanding is that the different approach would
    have had different semantics. Not all binaries would have been available
    via both / and /usr and that would have resulted in continuous
    incompatibility with other Linux distributions.

    If this is correct, then Luca's approach may fix the problem for
    usrmerge, but does not fix the general dpkg bug. (And, IIUC, is going
    to take two _more_ release cycles to fix the problems with usrmerge as implemented! Hmm...)

    That general dpkg bug is only observable when aliasing happens. Once no
    package ships anything inside non-canonical paths, no relevant aliasing
    is happening anymore, so we will not experience any symptoms of that
    bug. As such, we could call it unsupported again once Luca's approach
    has completed. So yeah, I think the beauty of that approach would be
    getting out of this mess without patching dpkg. I've not yet fully
    convinced myself that this is indeed viable (though I'm trying to).

    The --add-alias solution that has been suggested in this thread seems
    like it would fix the general problem iff policy was changed to require sysadmins to use it if they replaced a directory with a symlink.

    I don't think we want to support aliasing as a general mechanism
    available to administrators.

    I do not understand why the dpkg maintainer has rejected this solution;
    it would still be a fix for the general bug after the usrmerge
    transition has completed. And it would be at least one order of
    magnitude more performant than scanning the filesystem for directory symlinks.

    The --add-alias mechanism certainly adds significant complexity to the
    dpkg code base. Once introduced, it would become API and cannot be
    removed anymore, so it introduces a continuous maintenance cost. And if
    you disagree with the bug being a bug (and think of it as rejecting to implement a new feature), that rejection vaguely makes sense. We may
    disagree with that reasoning, but it is far from baseless.

    So the problem kinda is that aliasing is happening and causes dpkg's
    undefined behaviour wrt aliasing to cause problems. We basically have
    two ways to fix this:
    A. Ensure that no aliasing is happening anymore. (e.g. by
    canonicalizing all paths)
    B. Make dpkg cope with such aliasing.

    And while some seem to see these solutions as complementary, I think we
    should build consensus around either option as combining them gets us
    the downsides of both without adding benefit.

    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Raphael Hertzog@21:1/5 to Simon Richter on Tue May 2 12:40:01 2023
    XPost: linux.debian.maint.dpkg

    Hello,

    On Wed, 26 Apr 2023, Simon Richter wrote:
    This and /bin/sh is the kind of files I'd consider important. And then
    upon thinking further it became more and more difficult for me to make sense of the objection. On a merged system, we can just move that file
    to its canonical location without having any trouble even with an unmodified dpkg. So from my pov, the question about important files can
    be disregarded. I hope Simon Richter agrees.

    Yes, the relevant code at

    https://github.com/guillemj/dpkg/blob/main/src/main/unpack.c#L749

    already handles moving a file inside the same package, and that has
    existed for some time, that's why I use two packages for the PoC.

    Hum... why aren't we improving this part of the code?

    We don't want to stat all the files in all packages but we could do better:
    if we are about to remove an old file that is available through a
    symlinked directory, we could check the new name of the file and see if
    it's available in some package... and if yes just forget the file without removing it.

    This file removal is the reason of the moratorium and incuring some extra
    cost in some specific cases (installation through directory symlinks which
    is not the default case, and would not affect us after the migration is complete) seems certainly fair.

    The cost of analyzing directory components is a cost that we will have on
    all dpkg invocations but it doesn't seem unreasonable to me. We could also restrict it to the top-level directories to make it negligible as this
    is the only transition that we care about here.

    Cheers,
    --
    ⢀⣴⠾⠻⢶⣦⠀ Raphaël Hertzog <hertzog@debian.org>
    ⣾⠁⢠⠒⠀⣿⡁
    ⢿⡄⠘⠷⠚⠋ The Debian Handbook: https://debian-handbook.info/get/
    ⠈⠳⣄⠀⠀⠀⠀ Debian Long Term Support: https://deb.li/LTS

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Raphael Hertzog on Tue May 2 15:00:01 2023
    XPost: linux.debian.maint.dpkg

    Hi Raphal,

    On Tue, May 02, 2023 at 12:30:21PM +0200, Raphael Hertzog wrote:
    We don't want to stat all the files in all packages but we could do better: if we are about to remove an old file that is available through a
    symlinked directory, we could check the new name of the file and see if
    it's available in some package... and if yes just forget the file without removing it.

    Indeed, this is a neat idea. You are effectively implying that we only
    ever move files from non-canonical locations to canonical locations and
    never the other way round. I think this is a reasonable assumption and
    this assumption is the one that makes your variant simpler.

    I think there is a caveat (whose severity I am unsure about): In order
    to rely on this (and on DEP 17), we will likely have versioned
    Pre-Depends on dpkg. Can we reasonably rule out the case where and old
    dpkg is running, unpacking a fixed dpkg, configuring the fixed dpkg and
    then unpacking an affected package still running the unfixed dpkg
    process?

    This file removal is the reason of the moratorium and incuring some extra cost in some specific cases (installation through directory symlinks which
    is not the default case, and would not affect us after the migration is complete) seems certainly fair.

    I think the file loss problem is one sufficient reason to have the
    moratorium. We didn't need other reasons once we knew this one. Now that
    we look into dropping the moratorium, we need to ensure that there are
    no reasons anymore and we learned that diversions are affected in a
    non-trivial way. So even if we were to fix just the file loss problem,
    the diversion problems would still be sufficient reason to keep the
    moratorium unless they were also fixed by the approach. Here you need
    both directions a) diverting a non-canonical location would have to
    divert a canonical file and b) diverting a canonical location would have
    to divert a non-canonical file. This is breaking the initial assumption.

    In any case, this train of thought is definitely widening the solution
    space. Thank you very much.

    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Luca Boccassi on Tue May 2 15:00:01 2023
    XPost: linux.debian.maint.dpkg

    Hi Luca,

    On Fri, Apr 21, 2023 at 03:29:33PM +0100, Luca Boccassi wrote:
    After Bookworm ships I plan to propose a policy change to the CTTE and
    policy maintainers to forbid shipping files in the legacy directories altogether, followed by a debhelper change to adjust any stragglers automatically at build time and a mass rebuild, plus MBF for the small
    % that does not use dh and a piuparts test to stop migration for
    anything that is uploaded and doesn't comply. That should bring the
    matter to an end, without needing to modify dpkg.

    I think we now learned that this is quite oversimplified, but possibly
    fixable. At this time we know about the following problem areas:
    * file loss during upgrades
    + The main reason for having the moratorium
    + Possible workaround is using Conflicts
    * diversion mismatches
    + Possibly fixable by duplicating affected diversions
    * alternatives
    + Only become a problem if we try migrating them to canonical paths
    * triggers
    + Possible fix is duplicating trigger interest

    This is problems we know about now, but it likely is not an exhaustive
    list. This list was mostly guided by Guillem's intuition of what could
    break at https://wiki.debian.org/Teams/Dpkg/MergedUsr and I have to say
    that his intuition was quite precise thus far. Notably missing in the investigation are statoverrides. However, we should also look for a more generic approach that tries capturing unexpected breakage.

    I noticed that the number of packages shipping non-canonical files is relatively small. It's less than 2000 binary packages in unstable and
    their total size is about 2GB. So I looked into binary-patching them and
    attach the resulting scripts.
    * repackdeb.sh is a helper script for repacking an individual binary
    package and canonicalizing the contained paths.
    * autorepack.sh creates and apt repository of repacked .debs and calls
    repackdeb.sh repeatedly in that process. Should complete in half an
    hour.
    * createchroot.sh consumes the apt repository to create a chroot using
    mmdebstrap. In there, all paths should be canonical.
    * Depends: curl, devscripts, dpkg-dev, fakeroot, mmdebstrap, moreutils
    * You are expected to place these scripts in an empty directory and run
    them from there. Please read them before running them. You'll likely
    have to edit at least createchroot.sh to make it useful.

    I'm not sure how to devise test cases from this yet.

    * I tried createchroot.sh with --include=zutils, because that's one of
    the packages where I expect breakage due to mismatching diversions.
    Sure enough, I got the expected unpack error from dpkg!

    * I tried createchroot.sh with --include=gnome to see it in action with
    a few more packages and that appeared successful. So in this scenario
    there were no unforeseen and readily visible problems.

    If you end up performing tests using these or similar scripts, please
    report your results. If you can think of relevant scenarios, please
    tell.

    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Helmut Grohne on Tue May 2 15:10:02 2023
    XPost: linux.debian.maint.dpkg

    On Tue, May 02, 2023 at 02:09:32PM +0200, Helmut Grohne wrote:
    I noticed that the number of packages shipping non-canonical files is relatively small. It's less than 2000 binary packages in unstable and
    their total size is about 2GB. So I looked into binary-patching them and attach the resulting scripts.

    Sorry for missing the attachments.

    Helmut

    #!/bin/shset -euxPACKAGE=$1CHDIST_DIR=$(realpath ./chdist)WORKDIR=$(mktemp -d)MERGED_DIRS="bin sbin lib lib32 lib64 libo32 libx32"cleanup() { rm -Rf "$WORKDIR"}trap cleanup EXIT HUP INT TERMenv -C "$WORKDIR" chdist -d "$CHDIST_DIR" apt-get
    orig download "$PACKAGE"debfile=$(echo "$WORKDIR/${PACKAGE}_"*.deb)dpkg-deb -x "$debfile" "$WORKDIR/unpack"dpkg-deb -e "$debfile" "$WORKDIR/unpack/DEBIAN"rm -f "$debfile"for d in $MERGED_DIRS; do test -d "$WORKDIR/unpack/$d" || continue mkdir -p "$
    WORKDIR/unpack/usr" cp --link --archive "$WORKDIR/unpack/$d" "$WORKDIR/unpack/usr/" rm -Rf "$WORKDIR/unpack/$d"donedpkg-deb -b "$WORKDIR/unpack" "$WORKDIR"debfile=$(echo "$WORKDIR/${PACKAGE}_"*.deb)mv "$debfile" repacked/
    #!/bin/shset -euxSUITE=unstableMIRROR=http://deb.debian.org/debianCOMPONENTS="main contrib non-free non-free-firmware"ARCH=$(dpkg --print-architecture)MERGED_DIRS="bin sbin lib lib32 lib64 libo32 libx32"rm -Rf chdist repackedmkdir repacked#
    shellcheck disable=SC2086 # intentional word splittingchdist -d ./chdist create orig "$MIRROR" "$SUITE" $COMPONENTSchdist -d ./chdist apt-get orig updateSED_PATTERN="s,^\\($(echo "$MERGED_DIRS" | sed 's/ /\\|/g')"'\).*/\(.*\),\2,p'for arch in "$
    ARCH" all; do for component in $COMPONENTS; do curl -s "$MIRROR/dists/$SUITE/$component/Contents-$arch.gz" | zcat | sed -n "$SED_PATTERN" | sort -u donedone | xargs parallel fakeroot ./repackdeb.sh --env -C repacked dpkg-scanpackages . /
    dev/null | gzip -9 > repacked/Packages.gz #!/bin/shTARGET=/dev/nullSUITE=unstableMIRROR=http://deb.debian.org/debian# try passing:# --customize-hook="bash < /dev/tty >/dev/tty 2>&1"mmdebstrap --verbose --variant=apt --hook-dir=/usr/share/mmdebstrap/hooks/maybe-merged-usr "$SUITE" "$
    TARGET" "deb [trusted=yes] copy://$(realpath ./repacked) ./" "deb $MIRROR $SUITE main contrib non-free non-free-firmware" "$@"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Helmut Grohne on Tue May 2 16:00:01 2023
    XPost: linux.debian.maint.dpkg

    On Tue, May 02, 2023 at 02:09:32PM +0200, Helmut Grohne wrote:
    This is problems we know about now, but it likely is not an exhaustive
    list. This list was mostly guided by Guillem's intuition of what could
    break at https://wiki.debian.org/Teams/Dpkg/MergedUsr and I have to say
    that his intuition was quite precise thus far. Notably missing in the investigation are statoverrides. However, we should also look for a more generic approach that tries capturing unexpected breakage.

    I mentioned statoverrides as missing. I think we can split statoverrides
    into the two classes "package changes" and "admin changes". Quite
    obviously, moving files, will break admin changes. I see little ways
    around this, we can partially mitigate this by detecting common
    statoverrides and migrating them automatically, but in the end, we'll
    probably have to explain issues with admin-initiated statoverrides in
    the release notes.

    For package changes, the good thing is that statoverrides usually change
    stats of files owned by the package initiating them. Thus a package
    moving files can also move statoverrides (though this again means that automatic moves e.g. by debhelper must be opt-in in order to avoid
    breaking stuff). For getting an idea of the scope, we can use https://binarycontrol.debian.net/?q=dpkg-statoverride.*+%2F%28bin%7Csbin%7Clib%7Clib32%7Clib64%7Clibo32%7Clibx32%29&path=%2Funstable%2F

    * fuse and fuse3 adapt to an admin initiated statoverride of
    /bin/fusermount.
    * nfs-common cleans an obsolete dpkg-statoverride of /sbin/mount.nfs
    * systemd-cron adds a statoverride for /lib/systemd-cron/crontab_setgid
    and needs to migrate it with its files.
    * yp-tools adds a statoverride for /sbin/unix_chkpwd and needs to
    migrate it with its files.

    I also tried installing all packages that contain dpkg-statoverride in
    any of their maintainer scripts and capturing the resulting statoverride
    file. That doesn't yield anything unexpected thus far, but it also
    hasn't completed yet. I'll reply to this message with findings if
    there are any beyond the ones above.

    So statoverides seem quite similar to the diversions induced by dash:
    Mostly harmless if handled correctly while moving the files, but we
    cannot just move the files in an opt-out fashion. Beyond that we need to augment release notes to ask admins to carefully update their local statoverrides (and local diversions).

    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sam Hartman@21:1/5 to All on Tue May 2 17:40:01 2023
    XPost: linux.debian.maint.dpkg

    "Helmut" == Helmut Grohne <helmut@subdivi.de> writes:

    Helmut> Luca Boccassi kindly pointed me at config-package-dev
    Helmut> though. This is a tool for generating local packages and it
    Helmut> also employs dpkg-divert. There is a significant risk of
    Helmut> breaking this use case. If we were to divert dpkg-divert and
    Helmut> automatically duplicate diversions, this use case were
    Helmut> automatically covered.

    Most of the uses of config-package-dev are typically within /etc.
    Also, people who use config-package-dev tend to be managing
    infrastructure and have ways to handle upgrades of their infrastructure.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Raphael Hertzog@21:1/5 to Helmut Grohne on Wed May 3 10:40:01 2023
    XPost: linux.debian.maint.dpkg

    Hello,

    On Tue, 02 May 2023, Helmut Grohne wrote:
    I think there is a caveat (whose severity I am unsure about): In order
    to rely on this (and on DEP 17), we will likely have versioned
    Pre-Depends on dpkg. Can we reasonably rule out the case where and old
    dpkg is running, unpacking a fixed dpkg, configuring the fixed dpkg and
    then unpacking an affected package still running the unfixed dpkg
    process?

    I don't know APT well enough to answer that question but from my point of
    view it's perfectly acceptable to document in the release notes that you
    need to upgrade dpkg first.

    I think the file loss problem is one sufficient reason to have the moratorium. We didn't need other reasons once we knew this one. Now that
    we look into dropping the moratorium, we need to ensure that there are
    no reasons anymore and we learned that diversions are affected in a non-trivial way. So even if we were to fix just the file loss problem,
    the diversion problems would still be sufficient reason to keep the moratorium unless they were also fixed by the approach. Here you need
    both directions a) diverting a non-canonical location would have to
    divert a canonical file and b) diverting a canonical location would have
    to divert a non-canonical file. This is breaking the initial assumption.

    Are you sure that we need anything for diversions except some documented
    policy on how to deal with it?

    AFAIK the following sequence performs no filesystem changes and should
    be sufficient to move a diversion to its new location (I only consider the
    case of an upgrade, not of a new installation that should just work
    "normally" on the new location):

    dpkg-divert --package $package --remove /bin/foo --no-rename
    dpkg-divert --package $package --add /usr/bin/foo --divert /usr/bin/foo.diverted --no-rename

    The case of update-alternatives is likely more tricky. You already looked
    into it. That's a place where it will be harder to get things right
    without some changes.

    In any case, this train of thought is definitely widening the solution
    space. Thank you very much.

    You are welcome.

    Cheers,
    --
    ⢀⣴⠾⠻⢶⣦⠀ Raphaël Hertzog <hertzog@debian.org>
    ⣾⠁⢠⠒⠀⣿⡁
    ⢿⡄⠘⠷⠚⠋ The Debian Handbook: https://debian-handbook.info/get/
    ⠈⠳⣄⠀⠀⠀⠀ Debian Long Term Support: https://deb.li/LTS

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Raphael Hertzog on Wed May 3 12:30:02 2023
    XPost: linux.debian.maint.dpkg

    Hi Raphal,

    On Wed, May 03, 2023 at 10:31:14AM +0200, Raphael Hertzog wrote:
    I don't know APT well enough to answer that question but from my point of view it's perfectly acceptable to document in the release notes that you
    need to upgrade dpkg first.

    Yes, this issue seems vaguely solvable one way or another. It also
    affects other approaches modifying dpkg in the very same way.

    Are you sure that we need anything for diversions except some documented policy on how to deal with it?

    Yes! There is a hard ordering constraint involved here. Failure to do so results in unpack errors and or file loss in much the same way.

    AFAIK the following sequence performs no filesystem changes and should
    be sufficient to move a diversion to its new location (I only consider the case of an upgrade, not of a new installation that should just work "normally" on the new location):

    dpkg-divert --package $package --remove /bin/foo --no-rename
    dpkg-divert --package $package --add /usr/bin/foo --divert /usr/bin/foo.diverted --no-rename

    This is insufficient. Either we modify dpkg to consider aliasing when
    managing diversions (i.e. Simon Richter's branch or DEP17) or there is a
    more complex ordering requirement involved:

    * We must not remove the aliased diversion (/bin/foo) before the
    diverted package has moved its files to the canonical location
    (/bin/foo -> /usr/bin/foo).
    * We must add the canonical diversion (/usr/bin/foo) before the
    diverted package update that moves its files to canonical locations
    can be unpacked.

    Say we currently have

    Package: diverter
    Version: 1
    Files: /bin/foo
    preinst: diverts /bin/foo

    Package: diverted
    Version: 1
    Files: /bin/foo

    We must first update the diverter.

    Package: diverter
    Version: 2
    Files: /usr/bin/foo
    preinst: diverts both /bin/foo and /usr/bin/foo

    Since we divert both locations, diverter can now deal with an old
    diverted and a canonicalized diverted.

    Package: diverted
    Version: 2
    Conflicts: diverter (<< 2~)
    Files: /usr/bin/foo

    At the time of unpacking the updated diverted, we must ensure that no
    diverter versioned 1 is unpacked. Breaks does not help here as it allows concurrent unpacks. Neither does Replaces since dpkg thinks that
    /bin/foo is different from /usr/bin/foo and thus no replacing happens.

    Package: diverter
    Version: 3
    Conflicts: diverted (<< 2~)
    Files: /usr/bin/foo
    preinst: diverts /usr/bin/foo

    When unpacking the updated diverter, we must ensure that no diverted
    version 1 is unpacked. Again, Breaks and Replaces does not suffice.
    Therefore an upgrade from stable to nextstable containing both diverter
    and diverted must temporarily remove either package, which is known to
    annoy apt.

    What still applies here is that we can have usr-is-merged divert /usr/bin/dpkg-divert and have it automatically duplicate any possibly
    aliased diversion and then the diverter may Pre-Depends: usr-is-merged
    =...) to have its diversions duplicated. Of course, doing so will make usr-is-merged very hard to remove, but we have experience here from multiarch-support.

    Hope this clarifies.

    The case of update-alternatives is likely more tricky. You already looked into it. That's a place where it will be harder to get things right
    without some changes.

    As detailed in
    https://lists.debian.org/debian-devel/2023/04/msg00169.html I believe
    that update-alternatives really are not tricky at all as long as we do
    not attempt to migrate them to canonical paths in any way. For instance, elvis-tiny needs to continue to name the editor alternative
    /bin/elvis-tiny even when it actually moves that file to /usr/bin. The
    reason that this does not hurt is that we never attempted to move
    alternatives (unlike regular files in packages).

    If we really want to migrate alternatives to canonical paths, we do get
    into the tricky area of preserving the user configuration and we also
    break custom scripts, ansible's community.general.alternatives, uses of puppet's alternatives modules and probably a lot more.

    And of course, we can always draw the diversion card and have
    usr-is-merged divert /usr/bin/update-alternatives to have it
    canonicalize paths as required to be able to migrate alternatives in a
    sane way (from a consumer point of view).

    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Kalnischkies@21:1/5 to Raphael Hertzog on Wed May 3 15:10:01 2023
    XPost: linux.debian.maint.dpkg

    On Wed, May 03, 2023 at 10:31:14AM +0200, Raphael Hertzog wrote:
    On Tue, 02 May 2023, Helmut Grohne wrote:
    I think there is a caveat (whose severity I am unsure about): In order
    to rely on this (and on DEP 17), we will likely have versioned
    Pre-Depends on dpkg. Can we reasonably rule out the case where and old
    dpkg is running, unpacking a fixed dpkg, configuring the fixed dpkg and then unpacking an affected package still running the unfixed dpkg
    process?

    APT instructs dpkg to --unpack and to --configure in different calls,
    you can't mix and match those in the same call and apt never does the (combining) --install (not that it would really matter here).
    Also, dpkg is essential and as such has to work unpacked aka unpacking
    a fixed dpkg means that this fixed dpkg will (later) configure itself.

    Now, given dpkg is essential, it also means it gets the essential
    treatment from APT (by default) which means it will try to unpack it as
    soon as possible while trying to keep the time it remains unconfigured
    at a minimum. Give it a try, you usually see essential packages being interacted with first and in their own calls if you look close enough.
    That isn't an accident, the idea is that some random 'optional' package
    failing to install in some way should not leave you in a situation where essentials are in a state of limbo.

    If you increase the complexity of (pre-)requirements through APT will
    end up being forced to hand multiple packages in one go. Just pull up
    the last time you upgraded libc6: You will see a bunch of -dev packages
    and MultiArch siblings being unpacked alongside libc6 and libc-bin. You
    will only see those two being configured right after through. The
    dependencies will it is… so we might have to be a bit careful about the dependencies dpkg carries if such a route is taken.


    That said, there is always the 'stretch' horror story of APT installing
    all of KDE before touching dpkg because of the install-info transition… Although that was avoided before the release by removing from dpkg the
    Breaks leading us into this dark alley… (just to be sure: APT wasn't
    wrong, the dependencies weren't – but the idea to manually upgrade dpkg
    first to avoid some pitfalls was suggested which turned out to be wrong).

    Also, I wonder if we run into Pre-Depends loops and similar nasties
    given that the essential set is somewhat likely to pre-depend on
    things which use(d) to be in /lib which would in turn Pre-Depend on
    dpkg.

    (I haven't tried and memory is sketchy about those finer more
    complicated matters, but dpkg certainly can produce working orders
    for loops by inspecting which maintainer scripts exist or not, so
    upgrades involving those might or might not work. All bets are off
    which version of dpkg would be dealing with those through)


    I don't know APT well enough to answer that question but from my point of view it's perfectly acceptable to document in the release notes that you
    need to upgrade dpkg first.

    Those never work in practice through. Nobody logs in on their buildd
    chroots and upgrades them "properly", we all just hope for the best.

    Even on systems we care more about people are regularity caught red
    handed by bothering support with questions whose answers are spelled
    out in detail in the release notes. Case in point: "Changed security
    archive layout" last time or "Non-free firmware moved to its own
    component in the archive" this time around…

    And those are easy to diagnose and fix. 'You "might" have some "random"
    files not present on disk. So your system might not even boot or spawns interdimensional portals. You better reinstall…' is not the type of
    thing you wanna here from support.


    Best regards

    David Kalnischkies

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEE5sn+Q4uCja/tn0GrMRvlz3HQeIMFAmRSWuQACgkQMRvlz3HQ eIO8+Q//aRkKln03JAhQ4sD8iB7QuSkz3W+9jew4L/V34WLthjVbA6yLW9+IjRHF 8VaOsU6NiMqC+Y4nS9JUHOQyvpAQeSCko5Fs2QKjUmRdD8+vniVE9bD5eE4mH7Wb 4LTmimDZnFYJlTO7/l9uwcd2DlevVseIsBDfqSdEM/5EKLJ3n2xnnscfss/dHkWh t4AegMzE0A42MyRD/MI8sRnlrgAUsaAkipprPVMlvW+QT5iLNVznggHOmfvxL8pg GbG3J1weSwMgqxSNppeH8sbEzWtbvFHTEyVQMGRNe1GgffDlN5IKfk03Rqe53bDK BBAyx3C7YYvT2qW9pMvEhGtIBZb7DITpuZDfLQbxnODONsxf1t+QZSBqWt6w3jq0 GGFjws79qJEOMv8Jwux3JO5QfIu1E6LZU+eUYbIzolr++Hpn9C+BbpEcURglMLgE I1BWH/PufXfbFcsWIqZAhwBDkgRiOSmwGwuRp91HaT9p5ubkRSYYg2CwtH+WbXAq uVLvRkuy111+9S+3o/WUCh3B7jiyGosY85t2P4W9hyYIPxENGRBryUasjWCM3kFO l0L9IQiKMvt6626zqb5obf93NZ/uluXkmuvTew8jETNr2fb1ssQCEAEW0xfB4vud +fhQ3MJ+8SFc2wYOVAQPoTYkSOVngJ3Kd0xnF0LmJW1/PPbdRbw=
    =WcEX
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon Richter@21:1/5 to Helmut Grohne on Wed May 3 20:40:01 2023
    XPost: linux.debian.maint.dpkg

    Hi,

    On 03.05.23 19:19, Helmut Grohne wrote:

    What still applies here is that we can have usr-is-merged divert /usr/bin/dpkg-divert and have it automatically duplicate any possibly
    aliased diversion and then the diverter may Pre-Depends: usr-is-merged (>=...) to have its diversions duplicated. Of course, doing so will make usr-is-merged very hard to remove, but we have experience here from multiarch-support.

    For aliasing support in dpkg, that means we need a safe policy of
    dealing with diversions that conflict through aliasing that isn't
    "reject with error", because the magic dpkg-divert would always generate conflicts.

    One thing we need to check is whether diversions to the same target
    cause file conflicts -- I think they should.

    So if you divert

    /bin/foo -> /usr/bin/foo.dontdelete
    /usr/bin/foo -> /usr/bin/foo.dontdelete

    then a package containing /bin/foo and a package containing /usr/bin/foo
    now have a file conflict in dpkg. Not sure if that is a problem, or
    exactly the behaviour we want. Probably the latter, which would allow us
    to define a policy "if aliased paths are diverted, the diversion needs
    to match", which in turn would allow the conflict checker during alias registration to verify that the aliased diversions are not in conflict.

    The diverted dpkg-divert would probably generate extra
    register/unregister calls as soon as dpkg-divert itself is aliasing
    aware, but all that does is generate warning messages about existing
    diversions being added again, or nonexistent diversions being deleted --
    these are harmless anyway, because maintainer scripts are supposed to be idempotent, and dpkg-divert supports that by not requiring scripts to
    check before they register/unregister.

    And of course, we can always draw the diversion card and have
    usr-is-merged divert /usr/bin/update-alternatives to have it
    canonicalize paths as required to be able to migrate alternatives in a
    sane way (from a consumer point of view).

    We get to draw this card exactly once, and any package that would need
    the same diversion would need to conflict with usr-is-merged, which
    would make it basically uninstallable.

    Simon

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Simon Richter on Thu May 4 19:20:02 2023
    XPost: linux.debian.maint.dpkg

    Hi Simon,

    On Thu, May 04, 2023 at 03:37:49AM +0900, Simon Richter wrote:
    For aliasing support in dpkg, that means we need a safe policy of dealing with diversions that conflict through aliasing that isn't "reject with error", because the magic dpkg-divert would always generate conflicts.

    I think we still have that misunderstanding I mentioned earlier, so let
    me try to resolve that again.

    From my point of view, the ultimate goal here should be moving all files
    to their canonical location and thereby make aliasing effects
    irrelevant. Do you confirm?

    As such, I do not see aliasing support in dpkg as complementing the
    forced file move approach with lots of workarounds such as diverting dpkg-divert. Rather, I see them as exclusive strategies. Each of these strategies has significant downsides. In combining the different
    strategies, we combine their downsides, but since their benefit is
    shared, we do not gain anything in return but increase the price to pay.
    Why should we do that?

    So when we discuss diverting dpkg-divert, I imply that we do not change
    the implementation of dpkg wrt. aliasing. So this branch of discussion
    that you raise here, seems irrelevant to me.

    On the flip side, if dpkg (and thus dpkg-divert) is to gain aliasing
    support, I see no reason (and benefit) to diverting dpkg-divert.

    Can you explain why you see combining these strategies as something
    worth exploring?

    then a package containing /bin/foo and a package containing /usr/bin/foo now have a file conflict in dpkg. Not sure if that is a problem, or exactly the

    This case already is prohibited by policy section 10.1. It can only
    happen as a temporary state during a file move (from / to /usr and from
    one package to another).

    behaviour we want. Probably the latter, which would allow us to define a policy "if aliased paths are diverted, the diversion needs to match", which in turn would allow the conflict checker during alias registration to verify that the aliased diversions are not in conflict.

    If we do not modify dpkg to improve aliasing support, then yes, such a
    scenario will require a Conflicts declaration or a different measure
    averting this problem.

    The diverted dpkg-divert would probably generate extra register/unregister calls as soon as dpkg-divert itself is aliasing aware, but all that does is generate warning messages about existing diversions being added again, or nonexistent diversions being deleted -- these are harmless anyway, because maintainer scripts are supposed to be idempotent, and dpkg-divert supports that by not requiring scripts to check before they register/unregister.

    Again, the premise seems unreasonable to me. Also note that such a
    diversion of dpkg-divert certainly is meant as a temporary measure
    facilitating the transition. I'd hope we could delete it in forky
    already and failing that thereafter.

    We get to draw this card exactly once, and any package that would need the same diversion would need to conflict with usr-is-merged, which would make
    it basically uninstallable.

    I don't think the case of packages wanting to divert update-alternatives
    is all that common. Please elaborate on the use case. Also note that
    this suggestion already is to be considered a plan B. My current
    understanding is that as long as we do not canonicalize alternatives at
    all, we don't run into problems with them. This kinda is ugly, but the
    number of affected packages is small.

    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Timo =?utf-8?Q?R=C3=B6hling?=@21:1/5 to All on Fri May 5 11:40:01 2023
    XPost: linux.debian.maint.dpkg

    Hi,

    * Simon Richter <sjr@debian.org> [2023-05-05 17:59]:
    - it is not an error to register a diversion for an alias of an
    existing diversion, provided the package and target matches, this is a
    no-op
    - it is not an error to unregister a diversion for an alias of a path
    that has been unregistered previously, that is a no-op as well
    How do you distinguish between aliased diversions and "real" ones?
    Because if you allow the registration of duplicate diversions, the
    following can happen:

    - Package A is installed, preinst creates a diversion
    - Package B is installed, preinst creates the same diversion
    - Package A is uninstalled, postrm removes the diversion

    Now package B has lost its diversion.


    Cheers
    Timo

    --
    ⢀⣴⠾⠻⢶⣦⠀ ╭────────────────────────────────────────────────────╮
    ⣾⠁⢠⠒⠀⣿⡁ │ Timo Röhling │
    ⢿⡄⠘⠷⠚⠋⠀ │ 9B03 EBB9 8300 DF97 C2B1 23BF CC8C 6BDD 1403 F4CA │
    ⠈⠳⣄⠀⠀⠀⠀ ╰────────────────────────────────────────────────────╯

    -----BEGIN PGP SIGNATURE-----

    iQGzBAEBCgAdFiEEJvtDgpxjkjCIVtam+C8H+466LVkFAmRUzgwACgkQ+C8H+466 LVnfWgwAovhmBny6sVWBq6grhDrfBOiETTUOiTkK4pSIDn60mZY9WwIwoQo8Oy2h wa2fGFb3+0htXQsF6uIpTF9ipurUvAGGA6XIRl46//nTXVtywEaYxVGJ0KXrGkdy 5/nxY2UfyC9rmhi83zIiAG/h/iMwUKV19/4QiLGdbW3KSGgTi2+bEiVoSHy+YkaK l8GM5RsNptNmWNKMtFho1cubpBIthceOJpJs7lNfm3owGIyqJDA/5BX9154Ktbhu YDxKz6ez6shgFbMGPjS4g8b6qvLLXMUCLzn6HimHKMVtFBk35Dx3AJLsCVrDMJHV 2YBx8/qJFc9HDWs7H6Ln5O3VVoNV+dmmfWzbJlF/AuG
  • From Simon Richter@21:1/5 to All on Fri May 5 14:00:01 2023
    XPost: linux.debian.maint.dpkg
    To: debian-dpkg@lists.debian.org

    This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------6JsnJ0liPA859sPt9X8eyOSR
    Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64

    SGksDQoNCk9uIDA1LjA1LjIzIDE4OjM2LCBUaW1vIFLDtmhsaW5nIHdyb3RlOg0KDQo+PiAt IGl0IGlzIG5vdCBhbiBlcnJvciB0byByZWdpc3RlciBhIGRpdmVyc2lvbiBmb3IgYW4gYWxp YXMgb2YgYW4gDQo+PiBleGlzdGluZyBkaXZlcnNpb24sIHByb3ZpZGVkIHRoZSBwYWNrYWdl IGFuZCB0YXJnZXQgbWF0Y2hlcywgdGhpcyBpcyBhIA0KPj4gbm8tb3ANCj4+IC0gaXQgaXMg bm90IGFuIGVycm9yIHRvIHVucmVnaXN0ZXIgYSBkaXZlcnNpb24gZm9yIGFuIGFsaWFzIG9m IGEgcGF0aCANCj4+IHRoYXQgaGFzIGJlZW4gdW5yZWdpc3RlcmVkIHByZXZpb3VzbHksIHRo YXQgaXMgYSBuby1vcCBhcyB3ZWxsDQoNCj4gSG93IGRvIHlvdSBkaXN0aW5ndWlzaCBiZXR3 ZWVuIGFsaWFzZWQgZGl2ZXJzaW9ucyBhbmQgInJlYWwiIG9uZXM/DQo+IEJlY2F1c2UgaWYg eW91IGFsbG93IHRoZSByZWdpc3RyYXRpb24gb2YgZHVwbGljYXRlIGRpdmVyc2lvbnMsIHRo ZQ0KPiBmb2xsb3dpbmcgY2FuIGhhcHBlbjoNCg0KPiAtIFBhY2thZ2UgQSBpcyBpbnN0YWxs ZWQsIHByZWluc3QgY3JlYXRlcyBhIGRpdmVyc2lvbg0KPiAtIFBhY2thZ2UgQiBpcyBpbnN0 YWxsZWQsIHByZWluc3QgY3JlYXRlcyB0aGUgc2FtZSBkaXZlcnNpb24NCj4gLSBQYWNrYWdl IEEgaXMgdW5pbnN0YWxsZWQsIHBvc3RybSByZW1vdmVzIHRoZSBkaXZlcnNpb24NCg0KVGhh dCdzIHdoeSB0aGUgcGFja2FnZSBhbmQgdGFyZ2V0IG5lZWQgdG8gbWF0Y2ggLS0gc28gYnkg ZXh0ZW5zaW9uIA0KcGFja2FnZSBCIG1heSBub3QgZGl2ZXJ0IGEgcGF0aCB0aGF0IHBhY2th Z2UgQSBhbHJlYWR5IGRpdmVydHMuDQoNCldpdGggZHBrZy1kaXZlcnQgYXMgaXQgaXMsIHRo aXMgd29ya3MgYmVjYXVzZSBubyBhbGlhc2luZyBzdXBwb3J0IA0KZXhpc3RzLiBBIGRpdmVy dGVkIGRwa2ctZGl2ZXJ0IHRoYXQgZ2VuZXJhdGVzIGFkZGl0aW9uYWwgZGl2ZXJzaW9ucyAN CndvdWxkIG5lZWQgdG8gY2F0Y2ggdGhpcyBjYXNlLCByZWplY3QgaXQgYW5kIHJlc3RvcmUg dGhlIHByZXZpb3VzIHN0YXRlLCANCnNhbWUgYXMgYW4gYWxpYXNpbmcgYXdhcmUgZHBrZy1k aXZlcnQuDQoNCiAgICBTaW1vbg0K

    --------------6JsnJ0liPA859sPt9X8eyOSR--

    -----BEGIN PGP SIGNATURE-----

    iQEzBAEBCgAdFiEEtjuqOJSXmNjSiX3Tfr04e7CZCBEFAmRU7l0ACgkQfr04e7CZ CBEOygf/ePXtDDUSe1O2MQp7zWSvNTxJtRBIq2pogyBdMrjbspswGQqDJVV1479X j/YqId5Vbsav6fJqus7cYJJIr7ORk3J0VDeh9Lm4vcidJIKBKT4vTUI5uzZYFSsY Vxar7whik8n+x+V/2/9zRbiBS+lgQea52vb4zI5Q1Duz7CHhAsgn39EN/h3BL2uE 1X3Z8NJjy0vomEX5XP61G63R5jY9SQBzsAjgScuAKkR0dkTwFCE+OAoTi3BVnLOd 5n5aZ/Rq97rOLmEKtveieS3xQpenz/VlQEUQn2GXLqKq4QrAn2tTQceQM9Ad/ehz Y/ATeO2F82GywxbMM7SLNIvnlg9sRQ==
    =dQbk
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andreas Metzler@21:1/5 to sjr@debian.org on Fri May 5 18:40:01 2023
    XPost: linux.debian.maint.dpkg

    On 2023-05-05 Simon Richter <sjr@debian.org> wrote:
    [...]
    My proposal would be to put the onus on the client registering the
    diversion:
    [...]
    - packages are encouraged to register both diversions

    Hello,

    That seems to be a rather ugly user interface, ("There is dpkg-divert on Debian, but because the usrmerge you need to invoke it twce to be
    sure"). Will we need to have a meta-transition years from now trying to
    get get rid of the double diversions?

    cu Andreas

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luca Boccassi@21:1/5 to Andreas Metzler on Sat May 6 00:40:01 2023
    XPost: linux.debian.maint.dpkg

    On Fri, 5 May 2023 at 17:38, Andreas Metzler <ametzler@bebt.de> wrote:

    On 2023-05-05 Simon Richter <sjr@debian.org> wrote:
    [...]
    My proposal would be to put the onus on the client registering the diversion:
    [...]
    - packages are encouraged to register both diversions

    Hello,

    That seems to be a rather ugly user interface, ("There is dpkg-divert on Debian, but because the usrmerge you need to invoke it twce to be
    sure"). Will we need to have a meta-transition years from now trying to
    get get rid of the double diversions?

    It is not the prettiest thing but it is a very clever solution.
    Perhaps it could be mitigated with an addendum that makes it optional,
    and to be used only when strictly needed, after all moving files
    within the same package is fine, it's only the combination of moving
    location _and_ package that causes problems. In other words:

    - every package is forcefully canonicalized as soon as trixie is open
    for business
    - the moratorium on moving files from bin/ sbin/ lib/ _and_ to other
    packages at the same time is maintained from bookworm till trixie, and
    will lifted after trixie ships, and applies implicitly to all the
    ~2000 binary pkgs that are affected by the above
    - the moratorium can be bypassed by a maintainer if and only if the
    appropriate conflicts/replaces/diverts as discussed in this thread are
    put in place and left there for as long as needed (TBD whether this
    means for trixie's cycle or for trixie+1)

    In practice, I suspect that out of ~2000 packages shipping bin/ sbin/
    lib*/, only a small fraction would end up needing to further move
    files out to other packages, so the divert dance requirement can be
    restricted only to those. This way impact is minimized, required
    testing is smaller, and we get in the final state on day one of trixie
    dev cycle.
    Moving files between packages already requires busywork anyway, so a
    bit more won't hurt that much, especially if we figure out a way to
    provide the functionality with a dh addon or such to do the heavy
    lifting.

    Kind regards,
    Luca Boccassi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon Richter@21:1/5 to All on Sat May 6 07:30:01 2023
    XPost: linux.debian.maint.dpkg
    To: debian-devel@lists.debian.org

    This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------Lp0qoBrnxOMu6ussZmCS87Fu
    Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64

    SGksDQoNCk9uIDA2LjA1LjIzIDA3OjExLCBMdWNhIEJvY2Nhc3NpIHdyb3RlOg0KDQo+IC0g ZXZlcnkgcGFja2FnZSBpcyBmb3JjZWZ1bGx5IGNhbm9uaWNhbGl6ZWQgYXMgc29vbiBhcyB0 cml4aWUgaXMgb3Blbg0KPiBmb3IgYnVzaW5lc3MNCg0KWW91IHdpbGwgYWxzbyBuZWVkIHRv IHNoaXAgYXQgbGVhc3QNCg0KICAtIC9saWIgLT4gdXNyL2xpYiAob24gMzIgYml0KQ0KICAt IC9saWI2NCAtPiB1c3IvbGliNjQgKG9uIDY0IGJpdCkNCg0KYXMgYSBzeW1saW5rIGVpdGhl ciBpbiB0aGUgbGliYy1iaW4gcGFja2FnZSBvciBhbnkgb3RoZXIgRXNzZW50aWFsIA0KcGFj a2FnZSwgdG8gZnVsZmlsbCB0aGUgcmVxdWlyZW1lbnQgdGhhdCB1bnBhY2tlZCBFc3NlbnRp YWwgcGFja2FnZXMgYXJlIA0Kb3BlcmF0aW9uYWwuDQoNCiAgICBTaW1vbg0K

    --------------Lp0qoBrnxOMu6ussZmCS87Fu--

    -----BEGIN PGP SIGNATURE-----

    iQEzBAEBCgAdFiEEtjuqOJSXmNjSiX3Tfr04e7CZCBEFAmRV48UACgkQfr04e7CZ CBGYKwgAkht2aaUNbqU4E5bLqJyY9/v1MKX5U7ZOUsgvJn+5hoUbvT3kItAyx0kE GdTyR27tYfx4hFHx/oilgzkfjOV4eoVaQ44t1z53pxyKZAq3oGWXJQEJwAdXKdsi nSU8ERszaaWvUgqIrZ7SfB1CHzMMDj7z1ff+EI2Dg6J4OWgYyU/si9geWtIKZ4C8 8MaOLJOQnRrR856GSGsy5AYjIILh6f0j0fjVLf76IiVOOibZURJ0/J2kkcg4yPnK 6cJjy7cD4EnFsfyo9XGn8/ctCs1qXEEuYlK6DlMOchfJh5yNC/KHikeKIwY/xifX Jy+Z2mcCQt6wHGRT0PNghlrfgHODww==
    =95hY
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon McVittie@21:1/5 to Luca Boccassi on Sat May 6 12:10:01 2023
    On Fri, 05 May 2023 at 23:11:54 +0100, Luca Boccassi wrote:
    In practice, I suspect that out of ~2000 packages shipping bin/ sbin/
    lib*/, only a small fraction would end up needing to further move
    files out to other packages

    I think the most common case for this is likely to be systemd system
    units, which are currently in /lib/systemd and are sometimes moved between binary packages. Splitting out dbus-system-bus-common during the bookworm release cycle is a recent example, but it also seems reasonably common
    to move systemd units around as part of having a distinction between
    "the ready-made system service" and "the binary you can run by hand"
    (see apache2 vs. apache2-bin).

    udev rules are in a similar situation: consumed by an important system
    service, but shipped by any random package that wants to adjust its
    behaviour.

    Two things about systemd units make them a relatively difficult case
    for distro-wide changes like this:

    For /bin, /sbin and to a lesser extent /lib/TUPLE, we can often assume
    that only "core" packages (whose maintainers should be paying attention to subtleties like this) are affected by any change, because the historical definition of those directories was "just enough to boot the system or
    do disaster recovery", minimizing what should be there; but the number
    of packages that touch /lib/systemd is rather large, and a lot of them
    are leaf or near-leaf packages.

    Also, they're managed (and sometimes installed) by debhelper, which
    needs to be able to do the right thing relatively automatically. For
    example, if maintainers need to be able to take some special action at
    the point at which their /lib/systemd units move to /usr/lib/systemd,
    then I think debhelper installing into /usr/lib/systemd would have to
    be gated by a compat level change.

    smcv

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luca Boccassi@21:1/5 to Simon McVittie on Sat May 6 14:40:01 2023
    On Sat, 6 May 2023 at 11:00, Simon McVittie <smcv@debian.org> wrote:

    On Fri, 05 May 2023 at 23:11:54 +0100, Luca Boccassi wrote:
    In practice, I suspect that out of ~2000 packages shipping bin/ sbin/ lib*/, only a small fraction would end up needing to further move
    files out to other packages

    I think the most common case for this is likely to be systemd system
    units, which are currently in /lib/systemd and are sometimes moved between binary packages. Splitting out dbus-system-bus-common during the bookworm release cycle is a recent example, but it also seems reasonably common
    to move systemd units around as part of having a distinction between
    "the ready-made system service" and "the binary you can run by hand"
    (see apache2 vs. apache2-bin).

    udev rules are in a similar situation: consumed by an important system service, but shipped by any random package that wants to adjust its behaviour.

    Two things about systemd units make them a relatively difficult case
    for distro-wide changes like this:

    For /bin, /sbin and to a lesser extent /lib/TUPLE, we can often assume
    that only "core" packages (whose maintainers should be paying attention to subtleties like this) are affected by any change, because the historical definition of those directories was "just enough to boot the system or
    do disaster recovery", minimizing what should be there; but the number
    of packages that touch /lib/systemd is rather large, and a lot of them
    are leaf or near-leaf packages.

    Also, they're managed (and sometimes installed) by debhelper, which
    needs to be able to do the right thing relatively automatically. For
    example, if maintainers need to be able to take some special action at
    the point at which their /lib/systemd units move to /usr/lib/systemd,
    then I think debhelper installing into /usr/lib/systemd would have to
    be gated by a compat level change.

    Yes, I suspect you are right that it would be the bulk of the leaf
    packages. But still shouldn't invalidate what I mentioned? As long as
    they are kept in the same package, there shouldn't be a need for
    diversions. And if they need to be moved in this cycle, the diversion
    dance will be needed. Do you see any problems with this approach?

    Kind regards,
    Luca Boccassi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luca Boccassi@21:1/5 to Simon Richter on Sat May 6 14:30:01 2023
    XPost: linux.debian.maint.dpkg

    On Sat, 6 May 2023 at 06:21, Simon Richter <sjr@debian.org> wrote:

    Hi,

    On 06.05.23 07:11, Luca Boccassi wrote:

    - every package is forcefully canonicalized as soon as trixie is open
    for business

    You will also need to ship at least

    - /lib -> usr/lib (on 32 bit)
    - /lib64 -> usr/lib64 (on 64 bit)

    as a symlink either in the libc-bin package or any other Essential
    package, to fulfill the requirement that unpacked Essential packages are operational.

    Sure, that doesn't sound problematic? We'll need the same for bin/ and
    sbin/ for at least a cycle as you already pointed out. Sounds like a
    job for base-files.

    In the far future I'd like for these details to be owned by image builders/launchers/setup processes rather than a package, but this can
    be discussed separately and independently, no need to be tied to this
    effort.

    Kind regards,
    Luca Boccassi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon Richter@21:1/5 to Luca Boccassi on Sat May 6 17:20:02 2023
    XPost: linux.debian.maint.dpkg
    To: debian-devel@lists.debian.org
    To: debian-dpkg@lists.debian.org

    This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------efiJK7W8opNK49afOCKpJ9sR
    Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64

    SGksDQoNCk9uIDA2LjA1LjIzIDIxOjI4LCBMdWNhIEJvY2Nhc3NpIHdyb3RlOg0KDQpbc2hp cHBpbmcgdXNybWVyZ2Ugc3ltbGlua3MgaW4gcGFja2FnZXNdDQoNCj4gSW4gdGhlIGZhciBm dXR1cmUgSSdkIGxpa2UgZm9yIHRoZXNlIGRldGFpbHMgdG8gYmUgb3duZWQgYnkgaW1hZ2UN Cj4gYnVpbGRlcnMvbGF1bmNoZXJzL3NldHVwIHByb2Nlc3NlcyByYXRoZXIgdGhhbiBhIHBh Y2thZ2UsIGJ1dCB0aGlzIGNhbg0KPiBiZSBkaXNjdXNzZWQgc2VwYXJhdGVseSBhbmQgaW5k ZXBlbmRlbnRseSwgbm8gbmVlZCB0byBiZSB0aWVkIHRvIHRoaXMNCj4gZWZmb3J0Lg0KDQpJ ZGVhbGx5IEknZCBsaWtlIHRvIGhhdmUgdGhpcyBpbmZvcm1hdGlvbiBpbiBhIHNpbmdsZSBw YWNrYWdlIHJhdGhlciANCnRoYW4gZGlzdHJpYnV0ZWQgb3ZlciB0ZW4gZGlmZmVyZW50IHRv b2xzLCBlc3BlY2lhbGx5IGFzIHRoaXMgaXMgYWxzbyANCnJlbGVhc2UgYW5kIHBsYXRmb3Jt IGRlcGVuZGVudC4NCg0KSWYgcG9zc2libGUsIEknZCBsaWtlIHRvIGdvIGJhY2sgdG8gdGhl IGdvbGQgc3RhbmRhcmQgb2YNCiAgLSBkb3dubG9hZCBFc3NlbnRpYWw6IHllcyBwYWNrYWdl cyBhbmQgdGhlaXIgZGVwZW5kZW5jaWVzDQogIC0gdW5wYWNrIHRoZW0gdXNpbmcgZHBrZyAt LWZzeXMtdGFyZmlsZSB8IHRhciAteA0KICAtIGluc3RhbGwgb3ZlciB0aGlzIGRpcmVjdG9y eSB3aXRoIGRwa2cgLS1yb290PS4uLiAtaSAqLmRlYg0KDQp0byBnZXQgc29tZXRoaW5nIHRo YXQgd29ya3MgYXMgYSBjb250YWluZXIuIFJpZ2h0IG5vdywgdGhhdCBvbmx5IHdvcmtzIA0K aWYgSSByZW1vdmUgImluaXQiIGZyb20gdGhlIHBhY2thZ2UgbGlzdCwgd2hpY2ggaXMgZmFp ciBzaW5jZSBhIA0KY29udGFpbmVyIGRvZXNuJ3QgbmVlZCBhbiBpbml0IHN5c3RlbSBhbnl3 YXkuDQoNClRoZSBsZXNzIGFuIGltYWdlIGJ1aWxkZXIgbmVlZHMgdG8gZGV2aWF0ZSBmcm9t IHRoaXMgYXBwcm9hY2gsIHRoZSANCmJldHRlciBmb3Igb3VyIHVzZXJzLg0KDQogICAgIFNp bW9uDQo=

    --------------efiJK7W8opNK49afOCKpJ9sR--

    -----BEGIN PGP SIGNATURE-----

    iQEzBAEBCgAdFiEEtjuqOJSXmNjSiX3Tfr04e7CZCBEFAmRWbgsACgkQfr04e7CZ CBF8XAgAhwrNkQZsSpiaAmBGJKi1r465TSPg+STk1J3dBVGfGZZp0qXFU6O6MIvd hsZxXJsIhCHPCJGI3u4AW2LfSpOESjUvvxT2c39rSZWUDaQSk3P8VcY9mwbf1AVF gk9qpl9M25ow7E/fW0VUhEqYkHUUvsEq/ZfVNHQiE2fP3PQglZRtaBGsH0zKng/H FqW86EFXww2yIgFPyZThr1IMB064UdjFvMkB7nh/vQVO9vNq9/DlvL8y/Kmz79ux CIdVJ5EtBXHQ7v1baA4pm5xCOTvydOg+55v8GFHZVJ8LzVnmyM2BHBgdms+IulzQ cM0encyl1OfRHpPtE4U0iSf1rlOkIg==
    =hD+t
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luca Boccassi@21:1/5 to Simon Richter on Sat May 6 18:10:01 2023
    XPost: linux.debian.maint.dpkg

    On Sat, 6 May 2023 at 16:11, Simon Richter <sjr@debian.org> wrote:

    Hi,

    On 06.05.23 21:28, Luca Boccassi wrote:

    [shipping usrmerge symlinks in packages]

    In the far future I'd like for these details to be owned by image builders/launchers/setup processes rather than a package, but this can
    be discussed separately and independently, no need to be tied to this effort.

    Ideally I'd like to have this information in a single package rather
    than distributed over ten different tools, especially as this is also
    release and platform dependent.

    If possible, I'd like to go back to the gold standard of
    - download Essential: yes packages and their dependencies
    - unpack them using dpkg --fsys-tarfile | tar -x
    - install over this directory with dpkg --root=... -i *.deb

    to get something that works as a container. Right now, that only works
    if I remove "init" from the package list, which is fair since a
    container doesn't need an init system anyway.

    The less an image builder needs to deviate from this approach, the
    better for our users.

    To have a working system you need several more steps that are
    performed by the instantiator/image builder, such as providing working
    and populated proc/sys/dev, writable tmp/var, possibly etc. And it
    needs to be instantiated with user/password/ssh certs/locale/timezone.
    And if it needs to be bootable on baremetal/vm, it needs an ESP. And
    then if you have an ESP and want to run in a VM with SB, you'll need self-enrolling certs on first use or ensuring the 3rd party CA is
    provisioned. And then...

    You get the point. Going from a bunch of packages to a running system necessarily has many steps in between, some that are already done and
    taken for granted, for example when you say "works as a container" I'm
    pretty sure the "container" engine is taking care of at the very least proc/dev/sys for you, and it's just expected to work. bin -> usr/bin,
    sbin -> usr/sbin and lib -> usr/lib should get the same treatment: if
    they are not there, the invoked engine should prepare them. systemd
    and nspawn have been able to do this for a while now.

    Not having those hard coded means that the use case of / on a tmpfs
    with the rest instantiated on the fly, assembled with the vendor's
    /usr and /etc trees, becomes possible, which is neat. And said trees
    can pass the checksum/full integrity muster.

    Kind regards,
    Luca Boccassi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Luca Boccassi on Sat May 6 21:00:02 2023
    XPost: linux.debian.maint.dpkg

    Hi Luca,

    On Sat, May 06, 2023 at 04:52:30PM +0100, Luca Boccassi wrote:
    To have a working system you need several more steps that are
    performed by the instantiator/image builder, such as providing working
    and populated proc/sys/dev, writable tmp/var, possibly etc. And it
    needs to be instantiated with user/password/ssh certs/locale/timezone.
    And if it needs to be bootable on baremetal/vm, it needs an ESP. And
    then if you have an ESP and want to run in a VM with SB, you'll need self-enrolling certs on first use or ensuring the 3rd party CA is provisioned. And then...

    You paint it this way, but it really used to just work until we got the /usr-merge. Indeed, debvm creates virtual machine images effectively by bootstrapping a filesystem from packages and turning the resulting tree
    into a file system image.

    * /proc, /sys, /dev are mounted by systemd. All you need to do here is
    create the directories and base-files does so.
    * /tmp is shipped by base-files.
    * user and password creation is not handled yet, but can be handled by
    something similar to systemd-firstboot.
    * Not sure what you mean with certs, locale and timezone. You can just
    install ca-certificates, locales and tzdata as part of the bootstrap.
    * The bootloader part for baremetal is kinda out of scope for
    bootstrap, which is why debvm side-steps this. You can also skip it
    for containers and build chroots. So it is one out of multiple use
    cases that needs extra work here.

    In a good chunk of situations, you can get just by without messing
    around. Well that is until we broke it via usr-is-merged. I concur with
    Simon Richter, that restoring this property is a primary concern.

    You get the point. Going from a bunch of packages to a running system necessarily has many steps in between, some that are already done and
    taken for granted, for example when you say "works as a container" I'm
    pretty sure the "container" engine is taking care of at the very least proc/dev/sys for you, and it's just expected to work. bin -> usr/bin,
    sbin -> usr/sbin and lib -> usr/lib should get the same treatment: if
    they are not there, the invoked engine should prepare them. systemd
    and nspawn have been able to do this for a while now.

    No, this misses the point. You can configure essential in a very limited environment. However, you cannot do so without the lib or lib64 symlink (depending on the architecture) and the bin symlink. This is so
    critical, that it cannot be deferred to some external entity. It must be
    part of the bootstrap protocol. There are some suggested ways to fix
    this (such as adding separate bootstrap scripts next to maintainer
    scripts), but nothing implemented.

    Not having those hard coded means that the use case of / on a tmpfs
    with the rest instantiated on the fly, assembled with the vendor's
    /usr and /etc trees, becomes possible, which is neat. And said trees
    can pass the checksum/full integrity muster.

    It's neat that you can solve your use case by breaking other people's
    use cases. This is not constructive interaction however. This kind of
    behaviour is precisely what caused so much conflict around the
    /usr-merge. What if I gave a shit for your use case? Denying the
    /usr-merge and just continuing unmerged as long as possible (as merging
    would break my use case) would be my strategy of choice. You can make a difference here by starting to recognize other people's use cases and
    proposing solutions in that merged world. And no, it's not "add duct
    tape to every bootstrap tool".

    So I really want to see a solution for the bootstrap protocol before
    moving the dynamic linker and /bin/sh to its canonical location. The
    current bootstrap protocol is kept on life-support by installing the
    usrmerge package by default. Dropping usrmerge from the
    init-system-helpers dependency as first alternative or moving the
    dynamic linker would break it. If I had a solution in mind, I'd
    definitely post it right here, but unfortunately I have not.

    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luca Boccassi@21:1/5 to Helmut Grohne on Sat May 6 21:50:02 2023
    XPost: linux.debian.maint.dpkg

    On Sat, 6 May 2023 at 19:51, Helmut Grohne <helmut@subdivi.de> wrote:

    Hi Luca,

    On Sat, May 06, 2023 at 04:52:30PM +0100, Luca Boccassi wrote:
    To have a working system you need several more steps that are
    performed by the instantiator/image builder, such as providing working
    and populated proc/sys/dev, writable tmp/var, possibly etc. And it
    needs to be instantiated with user/password/ssh certs/locale/timezone.
    And if it needs to be bootable on baremetal/vm, it needs an ESP. And
    then if you have an ESP and want to run in a VM with SB, you'll need self-enrolling certs on first use or ensuring the 3rd party CA is provisioned. And then...

    You paint it this way, but it really used to just work until we got the /usr-merge. Indeed, debvm creates virtual machine images effectively by bootstrapping a filesystem from packages and turning the resulting tree
    into a file system image.

    * /proc, /sys, /dev are mounted by systemd. All you need to do here is
    create the directories and base-files does so.
    * /tmp is shipped by base-files.
    * user and password creation is not handled yet, but can be handled by
    something similar to systemd-firstboot.
    * Not sure what you mean with certs, locale and timezone. You can just
    install ca-certificates, locales and tzdata as part of the bootstrap.
    * The bootloader part for baremetal is kinda out of scope for
    bootstrap, which is why debvm side-steps this. You can also skip it
    for containers and build chroots. So it is one out of multiple use
    cases that needs extra work here.

    In a good chunk of situations, you can get just by without messing
    around. Well that is until we broke it via usr-is-merged. I concur with
    Simon Richter, that restoring this property is a primary concern.

    You get the point. Going from a bunch of packages to a running system necessarily has many steps in between, some that are already done and
    taken for granted, for example when you say "works as a container" I'm pretty sure the "container" engine is taking care of at the very least proc/dev/sys for you, and it's just expected to work. bin -> usr/bin,
    sbin -> usr/sbin and lib -> usr/lib should get the same treatment: if
    they are not there, the invoked engine should prepare them. systemd
    and nspawn have been able to do this for a while now.

    No, this misses the point. You can configure essential in a very limited environment. However, you cannot do so without the lib or lib64 symlink (depending on the architecture) and the bin symlink. This is so
    critical, that it cannot be deferred to some external entity. It must be
    part of the bootstrap protocol. There are some suggested ways to fix
    this (such as adding separate bootstrap scripts next to maintainer
    scripts), but nothing implemented.

    Not having those hard coded means that the use case of / on a tmpfs
    with the rest instantiated on the fly, assembled with the vendor's
    /usr and /etc trees, becomes possible, which is neat. And said trees
    can pass the checksum/full integrity muster.

    It's neat that you can solve your use case by breaking other people's
    use cases. This is not constructive interaction however. This kind of behaviour is precisely what caused so much conflict around the
    /usr-merge. What if I gave a shit for your use case? Denying the
    /usr-merge and just continuing unmerged as long as possible (as merging
    would break my use case) would be my strategy of choice. You can make a difference here by starting to recognize other people's use cases and proposing solutions in that merged world. And no, it's not "add duct
    tape to every bootstrap tool".

    So I really want to see a solution for the bootstrap protocol before
    moving the dynamic linker and /bin/sh to its canonical location. The
    current bootstrap protocol is kept on life-support by installing the
    usrmerge package by default. Dropping usrmerge from the
    init-system-helpers dependency as first alternative or moving the
    dynamic linker would break it. If I had a solution in mind, I'd
    definitely post it right here, but unfortunately I have not.

    Helmut

    There is absolutely no need to be so aggressive. I care about both use
    cases, but evidently you have formed a different view in your mind, so
    nothing productive is going to come out of this subthread right now,
    so I'll stop replying. It's off-topic anyway.

    Kind regards,
    Luca Boccassi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)