[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: merged /usr vs. symlink farms



Hi,

On 22.08.21 16:52, Simon Richter wrote:

The most generic approach would be to have a symlink farming mode in dpkg, where it has a goal (as defined by a package) to create a symlink /lib -> usr/lib, but while another package declares /lib to be a directory, the directory has precedence and dpkg generates the minimal set of symlinks that create the same effect -- so if /usr/lib/foo exists and /lib/foo doesn't, it generates a symlink /lib/foo -> ../usr/lib/foo.

Hmm, this could work with a Pre-Depends from base-files/bookworm to dpkg/bookworm, and base-files/bookworm providing the /bin, /lib and /sbin symlinks to indicate to dpkg that this is desired.

base-files has sufficiently few rdepends that it can be updated rather late, but it is Essential: yes, so it is guaranteed to be available on new installations (which would also have a dpkg that understands it).

So a rule to resolve symlink-vs-directory conflicts would change from "ignore the symlink" to "build a symlink farm that tries to make the same paths available", and the symlink farm would be optimized as packages drop directories.

So e.g. if I have two kernel packages with

    /lib/modules/1.2.3

and

    /usr/lib/modules/1.2.4

then the desired symlink in base-files

    /lib -> usr/lib

would conflict with /lib in the kernel package, and dpkg resolves this to /lib/modules -> ../usr/lib/modules (still a conflict), then to /lib/modules/1.2.4 -> ../../usr/lib/modules/1.2.4, which can be created to make the modules in /usr/lib available from /lib as if /lib was symlinked.

When the package providing /lib/modules/1.2.3 is removed, the last package providing /lib/modules is gone, so we can replace this with a symlink /lib/modules -> ../usr/lib/modules.

The transition is finished when the last package that uses /lib as a directory is gone. That will be libc6, which still has to provide ld.so in the usual path even in bookworm.

For systems that are usrmerged, the symlink is already as dpkg expects, so it doesn't start symlink farming there. We can use the bookworm cycle to move files to /usr as long as we don't move them to other packages, so we'd be getting fairly close to getting the database and the filesystem consistent after the upgrade -- basically everything but libc6 would be finished in bookworm.

The second thing is that we cannot deprecate scanning old paths during the bookworm cycle -- so systemd needs to continue looking into /lib/systemd, so the transition will not be finished during the bookworm cycle anyway.

   Simon


Reply to: