Package: release.debian.org Severity: normal Tags: bullseye User: release.debian....@packages.debian.org Usertags: pu X-Debbugs-Cc: usrme...@packages.debian.org Control: affects -1 + src:usrmerge
[ Reason ] Improve the usrmerge experience in bookworm. A few more ancient packages were found that need to be removed first for usrmerge to succeed, add versioned Breaks against them. Depending on the time a system was bootstrapped or converted, there may be biarch directories/links not owned by any package (e.g. /usr/libx32 and /libx32 -> /usr/libx32) Since these are now handled by the respective packages from src:glibc, bootstrapping and conversion no longer create them and we can clean them up if they are empty and not owned by a package. Clarify errors in case something goes wrong during usrmerge conversion. [ Impact ] Unclear errors if something fails. Failing usrmerge conversion if certain ancient packages are installed. Leftover unowned files that may disappear on certain upgrade paths and confuse CI tools. Inconsistent handling of /etc/shells and shells.state. [ Tests ] Local piuparts tests of bookworm (w/ updated package) and various distupgrade tests from bullseye (or earlier) to bookworm (w/ updated package). [ Risks ] Low. [ Checklist ] [*] *all* changes are documented in the d/changelog [*] I reviewed all changes and I approve them [*] attach debdiff against the package in (old)stable [*] the issue is verified as fixed in unstable [ Changes ] +usrmerge (37~deb12u1) bookworm; urgency=medium + + * Rebuild for bookworm. + + -- Andreas Beckmann <a...@debian.org> Mon, 27 Nov 2023 11:35:49 +0100 + +usrmerge (37) unstable; urgency=medium + + [ Johannes Schauer Marin Rodrigues ] + * Use $DPKG_ROOT in usr-is-merged.postinst. (Closes: #1050755) + + -- Marco d'Itri <m...@linux.it> Tue, 29 Aug 2023 02:14:10 +0200 + +usrmerge (36) unstable; urgency=medium + + * Added code by Andreas Beckmann to clean up the biarch libraries + directories when they are not needed. (Closes: #1038853) + * Changed postinst to not run convert-etc-shells again on already + converted systems and to run update-shells to make sure that the + new shells.state file introduced in bookworm is up to date. + (Closes: #1033167) + * Improved the instructions to deal with a mounted /lib/modules/, + which can also happen on some Xen-based systems. (Closes: 1034346) + * Greatly improved the error messages when commands execution fails + (see #1037362). + * Added a versioned conflict with libc-bin, only relevant for the + conversion script. (Closes: #1037362) + * Added a versioned conflict with dhcpcd. (Closes: #1038832) + * Added a versioned conflict with libparted1.8-10. (Closes: #1038832) + * Added a versioned conflict with lustre-utils. (Closes: #1038832) + + -- Marco d'Itri <m...@linux.it> Sun, 27 Aug 2023 13:56:49 +0200 convert-usrmerge | 34 +++++++++++++++++++--------------- debian/README.Debian | 6 ++---- debian/changelog | 33 +++++++++++++++++++++++++++++++++ debian/control | 9 ++++++++- debian/usr-is-merged.postinst | 28 ++++++++++++++++++++++++++++ debian/usrmerge.postinst | 28 ++++++++++++++++++++++++++-- 6 files changed, 116 insertions(+), 22 deletions(-) [ Other info ] This is a rebuild of a package that was previously in sid and testing. (The current version (38) in sid made usrmerge mandatory in all cases and is not applicable to bookworm (which supports the usrmerge opt-out.) Andreas
diff --git a/convert-usrmerge b/convert-usrmerge index e9398f5..00200f3 100755 --- a/convert-usrmerge +++ b/convert-usrmerge @@ -28,6 +28,8 @@ my %Ignore_In_Root = map { $_ => 1 } qw( /lib/udev/hwdb.bin ); +$ENV{LC_ALL} = 'C'; + check_free_space(); check_overlayfs(); @@ -217,9 +219,11 @@ sub convert_file { # To prevent a failure later, the regular files of the libraries used by # cp and mv must be converted before of the symlinks that point to them. sub early_conversion_files { + no autodie qw(close); + open(my $fh, '-|', 'ldd /bin/cp'); my @ldd = <$fh>; - close $fh; + close $fh or fatal("Failed to execute 'ldd /bin/cp'"); # the libraries my @list = grep { $_ } map { /^\s+\S+ => (\/\S+) / and $1 } @ldd; @@ -340,9 +344,9 @@ END ############################################################################## sub check_free_space { - local $ENV{LC_ALL} = 'C'; - my $fh; + no autodie qw(close); + my $fh; open($fh, '-|', 'stat --dereference --file-system --format="%i" /'); my $root_id = <$fh>; die "stat / failed" if not defined $root_id; @@ -361,14 +365,14 @@ sub check_free_space { my $free = $free_blocks * ($bs / 1024); my @dirs = grep { -e $_ } directories_to_merge(); - open($fh, '-|', - "du --summarize --no-dereference --total --block-size=1K @dirs"); + my $cmd = "du --summarize --no-dereference --total --block-size=1K @dirs"; + open($fh, '-|', $cmd); my $needed; while (<$fh>) { ($needed) = /^(\d+)\s+total$/; } - close $fh; - die "df @dirs failed" if not defined $needed; + close $fh or fatal("Failed to execute $cmd"); + die "$cmd failed" if not defined $needed; say "Free space in /usr: $free KB." if $Debug; say "The origin directories (@dirs) require $needed KB." if $Debug; @@ -380,12 +384,12 @@ sub check_free_space { # are movable - we might be running in a container, thus running under overlayfs # but still able to do the conversion because the chroot is not overlayed. sub check_overlayfs { - $ENV{LC_ALL} = 'C'; - my $fh; + no autodie qw(close); + my $fh; open($fh, '-|', "stat --file-system --format=%T /"); my $fs_type = <$fh>; - close $fh; + close $fh or fatal("Failed to execute stat --file-system --format=%T /"); die "stat / failed" if not defined $fs_type; chomp $fs_type; return if $fs_type ne "overlayfs"; @@ -438,12 +442,12 @@ sub check_uml { FATAL ERROR: /lib/modules/ is a mount point. -Probably this system is using User Mode Linux. +Probably this system is using User Mode Linux or some variant of Xen. -To continue the conversion please: -- replace '/lib/modules/' with '/usr/lib/modules/' in /etc/fstab -- reboot -- try again +To continue the conversion please unmount /lib/modules/ (try the command +'umount -l /lib/modules/') and then try again. +Do not forget to reboot after the conversion is complete to have it +mounted again. END exit(1); diff --git a/debian/README.Debian b/debian/README.Debian index c39e615..9bd7d13 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -11,9 +11,6 @@ directories in / and /usr, until they will be fixed. * Will usrmerge also merge /usr/bin/ and /usr/sbin/? No. -* Is it mandatory to install this package? -No. - * Does this require systemd? No. @@ -61,7 +58,8 @@ directories and the associated symlinks can be safely deleted. Removal of this package ~~~~~~~~~~~~~~~~~~~~~~~ -The package can be removed once the system has been converted. +The usrmerge package can be removed once the system has been converted, +and it will be replaced by the empty usr-is-merged package. Skipping the conversion (UNSUPPORTED) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/debian/changelog b/debian/changelog index c9baaf7..08dd591 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,36 @@ +usrmerge (37~deb12u1) bookworm; urgency=medium + + * Rebuild for bookworm. + + -- Andreas Beckmann <a...@debian.org> Mon, 27 Nov 2023 11:35:49 +0100 + +usrmerge (37) unstable; urgency=medium + + [ Johannes Schauer Marin Rodrigues ] + * Use $DPKG_ROOT in usr-is-merged.postinst. (Closes: #1050755) + + -- Marco d'Itri <m...@linux.it> Tue, 29 Aug 2023 02:14:10 +0200 + +usrmerge (36) unstable; urgency=medium + + * Added code by Andreas Beckmann to clean up the biarch libraries + directories when they are not needed. (Closes: #1038853) + * Changed postinst to not run convert-etc-shells again on already + converted systems and to run update-shells to make sure that the + new shells.state file introduced in bookworm is up to date. + (Closes: #1033167) + * Improved the instructions to deal with a mounted /lib/modules/, + which can also happen on some Xen-based systems. (Closes: 1034346) + * Greatly improved the error messages when commands execution fails + (see #1037362). + * Added a versioned conflict with libc-bin, only relevant for the + conversion script. (Closes: #1037362) + * Added a versioned conflict with dhcpcd. (Closes: #1038832) + * Added a versioned conflict with libparted1.8-10. (Closes: #1038832) + * Added a versioned conflict with lustre-utils. (Closes: #1038832) + + -- Marco d'Itri <m...@linux.it> Sun, 27 Aug 2023 13:56:49 +0200 + usrmerge (35) unstable; urgency=medium * Partially revert and further change the fix for #1024596, because it diff --git a/debian/control b/debian/control index 26be1c0..e790077 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: usrmerge Section: admin Priority: optional Maintainer: Marco d'Itri <m...@linux.it> -Standards-Version: 4.6.1.0 +Standards-Version: 4.6.2.0 Rules-Requires-Root: no Build-Depends: debhelper-compat (= 13) Vcs-Git: https://salsa.debian.org/md/usrmerge.git @@ -18,6 +18,7 @@ Breaks: cruft-ng (<< 0.4.4~), initramfs-tools (<< 0.121~), Conflicts: + libc-bin (<< 2.36-9~), safe-rm (<< 0.12-6~), ksh (<< 93u+20120801-3.1~), acl (<< 2.2.52-3~), @@ -27,6 +28,7 @@ Conflicts: cryptsetup (<< 2:1.7.0-1~), davfs2 (<< 1.5.2-1.2~), debianutils (<< 4.5~), + dhcpcd (<< 1:5~), ebtables (<< 2.0.10.4+snapshot20181205-1~), elvis-tiny (<< 1.4-24~), kbd (<< 2.0.4-4~), @@ -38,8 +40,10 @@ Conflicts: libc0.3 (<< 2.35-4), libdm0-dev, libjson-c-dev (<< 0.12.1-1.1~), + libparted1.8-10 (<< 1.8.8.git.2008.03.24-11.2~), libpng12-0 (<< 1.2.54-6~), libusb-0.1-4 (<< 2:0.1.12-28~), + lustre-utils (<< 1.8.5+dfsg-3.2~), mksh (<< 52b-1~), molly-guard (<< 0.7.1+exp1~), musl-dev (<< 1.1.9-1.1~), @@ -79,6 +83,7 @@ Conflicts: cryptsetup (<< 2:1.7.0-1~), davfs2 (<< 1.5.2-1.2~), debianutils (<< 4.5~), + dhcpcd (<< 1:5~), ebtables (<< 2.0.10.4+snapshot20181205-1~), elvis-tiny (<< 1.4-24~), kbd (<< 2.0.4-4~), @@ -90,8 +95,10 @@ Conflicts: libc0.3 (<< 2.35-4), libdm0-dev, libjson-c-dev (<< 0.12.1-1.1~), + libparted1.8-10 (<< 1.8.8.git.2008.03.24-11.2~), libpng12-0 (<< 1.2.54-6~), libusb-0.1-4 (<< 2:0.1.12-28~), + lustre-utils (<< 1.8.5+dfsg-3.2~), mksh (<< 52b-1~), molly-guard (<< 0.7.1+exp1~), musl-dev (<< 1.1.9-1.1~), diff --git a/debian/usr-is-merged.postinst b/debian/usr-is-merged.postinst new file mode 100644 index 0000000..333f04b --- /dev/null +++ b/debian/usr-is-merged.postinst @@ -0,0 +1,28 @@ +#!/bin/sh +set -e + +cleanup_biarch_dirs() { + dpkg --compare-versions "$2" lt "36~" || return 0 + + # bootstrapping or earlier conversions may have created empty biarch + # directories and links. glibc 2.35-4 or later will create them if needed, + # so clean up the unused (and unowned) ones + local arch_directories="/lib64 /lib32 /libo32 /libx32" + for dir in $arch_directories; do + [ -e "$DPKG_ROOT$dir" ] || continue + if ! dpkg-query -S $dir >/dev/null 2>&1; then + rm -v "$DPKG_ROOT$dir" + if [ -e "$DPKG_ROOT/usr$dir" ] && ! dpkg-query -S /usr$dir >/dev/null 2>&1 ; then + rmdir --ignore-fail-on-non-empty -v "$DPKG_ROOT/usr$dir" + fi + fi + done +} + +case "$1" in + configure) + cleanup_biarch_dirs + ;; +esac + +#DEBHELPER# diff --git a/debian/usrmerge.postinst b/debian/usrmerge.postinst index 257f0e5..795414c 100644 --- a/debian/usrmerge.postinst +++ b/debian/usrmerge.postinst @@ -1,4 +1,5 @@ -#!/bin/sh -e +#!/bin/sh +set -e is_fs() { local fs_type @@ -47,6 +48,29 @@ END fi /usr/lib/usrmerge/convert-usrmerge || return $? + + if which update-shells > /dev/null; then + update-shells + fi + /usr/lib/usrmerge/convert-etc-shells || return $? +} + +cleanup_biarch_dirs() { + dpkg --compare-versions "$2" lt "36~" || return 0 + + # bootstrapping or earlier conversions may have created empty biarch + # directories and links. glibc 2.35-4 or later will create them if needed, + # so clean up the unused (and unowned) ones + local arch_directories="/lib64 /lib32 /libo32 /libx32" + for dir in $arch_directories; do + [ -e "$dir" ] || continue + if ! dpkg-query -S $dir >/dev/null 2>&1; then + rm -v $dir + if [ -e /usr$dir ] && ! dpkg-query -S /usr$dir >/dev/null 2>&1 ; then + rmdir --ignore-fail-on-non-empty -v /usr$dir + fi + fi + done } case "$1" in @@ -59,7 +83,7 @@ case "$1" in echo "W: /etc/unsupported-skip-usrmerge-conversion exists." >&2 else maybe_convert "$@" || { echo "E: usrmerge failed." >&2; exit 1; } - /usr/lib/usrmerge/convert-etc-shells + cleanup_biarch_dirs fi ;; esac