[Pkg-zfsonlinux-devel] Bug#1092598: Bug#1092598: libzfs6linux ineffectively replaces libzfs4linux (DEP17 P1)

Helmut Grohne helmut at subdivi.de
Fri Jan 10 10:54:28 GMT 2025


Hi Shengqi Chen,

thank you for the ultra fast reply.

On Thu, Jan 09, 2025 at 03:25:55PM +0000, Chen Shengqi wrote:
> Hi,
> 
> > * Is libzfs6linux meant to be included in trixie?
> 
> Yes.
> 
> > * If yes, do you see a risk of rendering a system unbootable if
> >    libzfs_core.so.3 would go missing?
> 
> Yes. libzfs_core is used by many important userspace tools (zfs, zpool, zed, etc.).
> Without them users may not be able to mount zfs datasets in initrd stage.
> For users who have critical data (e.g. the whole rootfs or /etc, /usr),
> their system is likely to be unbootable.

Given these answers, I recommend the most annoying mitigation. The
options are:

 * Upgrade "Replaces: libzfs4linux" to "Conflicts: libzfs4linux".
 * Issue temporary protective diversions from the time
   libzfs6linux.preinst is run to the time libzfs6linux.postinst is run.
 * Issue permanent protective diversions from the time
   libzfs6linux.preinst is run to the time trixie is released.

The first two methods mitigate most practical file loss scenarios, but
both of them leave holes behind when people use dpkg directly for
installing .debs. The last of these covers such use, but is annoying in
two ways:
 * Users will have these diversions on their systems after libzfs6linux
   has been installed.
 * In the forky cycle, the maintainer scripts need to be changed to
   actively remove the diversions in libzfs6linux.postinst. Roughly
   speaking:
     mv debian/libzfs6linux.postrm debian/libzfs6linux.postinst
     sed -i -e "s/= remove/= configure/" debian/libzfs6linux.postinst
     rm debian/libzfs6linux.preinst
 * In the forky+1 cycle, the postinst can be dropped. Roughly speaking:
     rm debian/libzfs6linux.postinst

As such, this poses a noticable maintenance cost down the road, but in
the interest of not rendering people's machines unbootable, I recommend
going this path. Please find a patch attached.

Please do an upload closing this bug to experimental and then wait three
days before moving the package to unstable. Doing so gives the Debian
Usr Merge Analysis Tool (dumat) time to analyze your upload and complain
if it is not.  Let me know if you have any questions.

Helmut
-------------- next part --------------
diff --minimal -Nru zfs-linux-2.3.0~rc5/debian/changelog zfs-linux-2.3.0~rc5/debian/changelog
--- zfs-linux-2.3.0~rc5/debian/changelog	2025-01-07 16:04:20.000000000 +0100
+++ zfs-linux-2.3.0~rc5/debian/changelog	2025-01-10 09:03:13.000000000 +0100
@@ -1,3 +1,11 @@
+zfs-linux (2.3.0~rc5-1~exp1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Add protective diversions for concurrent package rename and aliasing
+    change of libzfs_core.so.* (DEP17 P1 M8, Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de>  Fri, 10 Jan 2025 09:03:13 +0100
+
 zfs-linux (2.3.0~rc5-1~exp1) experimental; urgency=medium
 
   [ Alexandre Detiste ]
diff --minimal -Nru zfs-linux-2.3.0~rc5/debian/libzfs6linux.postrm zfs-linux-2.3.0~rc5/debian/libzfs6linux.postrm
--- zfs-linux-2.3.0~rc5/debian/libzfs6linux.postrm	1970-01-01 01:00:00.000000000 +0100
+++ zfs-linux-2.3.0~rc5/debian/libzfs6linux.postrm	2025-01-10 09:03:13.000000000 +0100
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -e
+
+if test "$1" = remove; then
+	# DEP17 P1 M8. Clean up after libzfs6linux.preinst. This code should be
+	# removed once the diversions are deleted via postinst.
+	for lib in zfs_core.so.3 zfs_core.so.3.0.0; do
+		dpkg-divert --package libzfs6linux --no-rename --divert "/lib/#DEB_HOST_MULTIARCH#/lib$lib.usr-is-merged" --remove "/lib/#DEB_HOST_MULTIARCH#/lib$lib"
+	done
+fi
+
+#DEBHELPER#
+
+exit 0
diff --minimal -Nru zfs-linux-2.3.0~rc5/debian/libzfs6linux.preinst zfs-linux-2.3.0~rc5/debian/libzfs6linux.preinst
--- zfs-linux-2.3.0~rc5/debian/libzfs6linux.preinst	1970-01-01 01:00:00.000000000 +0100
+++ zfs-linux-2.3.0~rc5/debian/libzfs6linux.preinst	2025-01-10 09:03:13.000000000 +0100
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+if test "$1" = install -o "$1" = upgrade; then
+	# DEP17 P1 M8: Divert aliased files to avoid their removal deleting the
+	# moved ones. These diversions should be removed via postinst once
+	# trixie is released.
+	for lib in zfs_core.so.3 zfs_core.so.3.0.0; do
+		dpkg-divert --package libzfs6linux --no-rename --divert "/lib/#DEB_HOST_MULTIARCH#/lib$lib.usr-is-merged" --add "/lib/#DEB_HOST_MULTIARCH#/lib$lib"
+	done
+fi
+
+#DEBHELPER#
+
+exit 0


More information about the Pkg-zfsonlinux-devel mailing list