I cannot upgrade from 22.04 to 24.04.1 because do-release-upgrade stops and claiming usr isn't merged.
But if I run usrmerge as root, it comes up with a message, that it successfully merged usr.
But there is an error nevertheless. Maybe it quits with exit 1 I thought, but that seems not to be the case. echo $? returns 0.
I created a wrapper script that calls usrmerge and exits with 0. But do-release-upgrade still fails, claiming usr isn't merged and I should install the package usrmerge to solve the issue.
$ sudo LANG=C do-release-upgrade
Checking for a new Ubuntu release
= Welcome to Ubuntu 24.04 LTS 'Noble Numbat' =
[...]
Reading state information... Done
Cannot upgrade system with unmerged /usr
Please install the usrmerge package to fix this, and then try the
upgrade again.
Restoring original system state
Aborting
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
=== Command detached from window (Thu Oct 17 23:28:58 2024) ===
=== Command terminated with exit status 1 (Thu Oct 17 23:29:08 2024) ===
I wrote a wrapper script but it return 0, like the original script, despite the original throws out that warning on Smartmatch at line 172.
$ sudo cat /usr/lib/usrmerge/convert-usrmerge
#!/bin/bash
/usr/lib/usrmerge/convert-usrmerge_bin 2> /dev/null
exit 0
Running the wrapper
$ sudo LANG=C /usr/lib/usrmerge/convert-usrmerge
The system has been successfully converted.
Running the usrmerge script directly
$ sudo LANG=C /usr/lib/usrmerge/convert-usrmerge_bin
Smartmatch is experimental at /usr/lib/usrmerge/convert-usrmerge_bin line 172.
The system has been successfully converted.
$ echo $?
0
$ LANG=C apt policy usrmerge
usrmerge:
Installed: 25ubuntu2
Candidate: 25ubuntu2
Version table:
*** 25ubuntu2 500
500 http://de.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
500 http://de.archive.ubuntu.com/ubuntu jammy/main i386 Packages
100 /var/lib/dpkg/status
$ sudo LANG=C sha1sum /usr/lib/usrmerge/convert-usrmerge_bin
ddc18b09fdc448c2d8aa2c94669501500482388e /usr/lib/usrmerge/convert-usrmerge_bin
$ sudo LANG=C cat -n /usr/lib/usrmerge/convert-usrmerge_bin | egrep '^[[:space:]]*172'
172 if (-e "/usr$n" && $n ~~ @generated_files) {
$ sudo LANG=C cat -n /usr/lib/usrmerge/convert-usrmerge_bin | egrep -C10 '^[[:space:]]*172'
162 fatal("Both $n and /usr$n exist");
163 }
164
165 # generated files
166 # if it was already re-generated in the new place, clear the legacy location
167 # Origin of generated files:
168 # /lib/udev/hwdb.bin -> 'systemd-hwdb --usr update'
169 my @generated_files = qw(
170 /lib/udev/hwdb.bin
171 );
172 if (-e "/usr$n" && $n ~~ @generated_files) {
173 rm('-f', "$n");
174 return;
175 }
176
177 fatal("$n is a directory and /usr$n is not")
178 if -d $n and -e "/usr$n";
179 fatal("/usr$n is a directory and $n is not")
180 if -d "/usr$n";
181 fatal("Both $n and /usr$n exist")
182 if -e "/usr$n";
Here is a strace output https://pastebin.ubuntu.com/p/c3wghnxPJ7/
I edited convert-usrmerge to avoid the warning, which works
use lib "/usr/lib/usrmerge/lib";
use warnings;
# https://www.reddit.com/r/perl/comments/60b3tr/ how_to_suppress_experimental_warning_for/
# to solve https://askubuntu.com/questions/1530232/do-release-upgrade-fails-due-to-usrmerge-and-smartmatch
no if $] >= 5.018, warnings => "experimental::smartmatch";
use feature "switch";
use strict;
use autodie;
But unfortunately it didn't solve that do-release-upgrade claims usr isn't merged and complain about it and doesn't start the upgrade process.
So Smartmatch doesn't seem to be the culprit.
I don't know how to debug a perlscript, but I post my attempt anyway:
$ sudo LANG=C perl -d /usr/lib/usrmerge/convert-usrmerge
Loading DB routines from perl5db.pl version 1.60
Editor support available.
Enter h or 'h h' for help, or 'man perldebug' for more help.
main::(/usr/lib/usrmerge/convert-usrmerge:27):
27: my $Debug = 1;
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:28):
28: my $Program_RC = 0;
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:30):
30: check_free_space();
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:32):
32: go_faster();
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:35):
35: $SIG{__DIE__} = sub { fatal($_[0]); };
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:38):
38: foreach my $name (early_conversion_files()) {
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:38):
38: foreach my $name (early_conversion_files()) {
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:43):
43: my @dirs = directories_to_merge();
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:46):
46: foreach my $dir (@dirs) {
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:47):
47: mkdir("/usr$dir") if not -e "/usr$dir";
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:47):
47: mkdir("/usr$dir") if not -e "/usr$dir";
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:47):
47: mkdir("/usr$dir") if not -e "/usr$dir";
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:47):
47: mkdir("/usr$dir") if not -e "/usr$dir";
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:47):
47: mkdir("/usr$dir") if not -e "/usr$dir";
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:47):
47: mkdir("/usr$dir") if not -e "/usr$dir";
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:50):
50: my @later;
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:51):
51: my $rule = File::Find::Rule->mindepth(1)->maxdepth(1)->start(@dirs);
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:52):
52: while (defined (my $name = $rule->match)) {
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:58):
58: convert_file($_) foreach @later;
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:60):
60: verify_links_only($_) foreach @dirs;
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:62):
62: convert_directory($_) foreach @dirs;
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:64):
64: exit($Program_RC) if $Program_RC;
DB<1> n
main::(/usr/lib/usrmerge/convert-usrmerge:65):
65: print "The system has been successfully converted.\n";
DB<1> n
The system has been successfully converted.
main::(/usr/lib/usrmerge/convert-usrmerge:66):
66: exit;
DB<1> n
Debugged program terminated. Use q to quit or R to restart,
use o inhibit_exit to avoid stopping after program termination,
h q, h R or h o to get additional info.
DB<1> q
As far as i can see usr is already merged
lrwxrwxrwx 1 root root 7 Jun 24 2022 bin -> usr/bin
drwxr-xr-x 44 root root 4096 Okt 16 11:59 boot
drwxr-xr-x 2 root root 4096 Okt 2 2012 cdrom
drwxr-xr-x 3 root root 4096 Okt 31 2019 custom
drwxr-xr-x 22 root root 5720 Okt 17 23:14 dev
drwxr-xr-x 2 root root 4096 Aug 29 2021 dracut
drwxr-xr-x 244 root root 20480 Okt 17 23:13 etc
drwxr-xr-x 2 root root 4096 Dez 19 2019 export
drwxr-xr-x 6 root root 4096 Okt 30 2012 export_ofs
drwxr-xr-x 3 root root 4096 Okt 2 2012 home
drwxr-xr-x 2 root root 4096 Jan 19 2020 images
lrwxrwxrwx 1 root root 8 Mai 6 15:35 lib -> /usr/lib
lrwxrwxrwx 1 root root 9 Jun 24 2022 lib32 -> usr/lib32
lrwxrwxrwx 1 root root 9 Jun 24 2022 lib64 -> usr/lib64
lrwxrwxrwx 1 root root 36 Mär 30 2014 libnss3.so -> /usr/lib/x86_64-linux-gnu/libnss3.so
drwxr-xr-x 3 root root 4096 Mai 5 01:02 lib-rootfolder
lrwxrwxrwx 1 root root 10 Jun 24 2022 libx32 -> usr/libx32
drwx------ 2 root root 16384 Sep 30 2012 lost+found
drwxr-xr-x 4 root root 4096 Jul 2 2022 media
drwxr-xr-x 8 root root 4096 Feb 22 2022 mnt
drwxr-xr-x 3 root root 4096 Okt 31 2012 net
drwxr-xr-x 2 root root 4096 Jan 19 2020 NST
drwxr-xr-x 5 root root 4096 Jun 24 2022 opt
dr-xr-xr-x 413 root root 0 Okt 17 23:14 proc
drwx------ 17 root root 4096 Okt 18 14:34 root
drwxr-xr-x 51 root root 1560 Okt 18 00:00 run
lrwxrwxrwx 1 root root 8 Jun 24 2022 sbin -> usr/sbin
drwxr-xr-x 38 root root 4096 Aug 10 17:54 snap
drwxr-xr-x 2 root root 4096 Apr 25 2012 srv
dr-xr-xr-x 13 root root 0 Okt 17 23:14 sys
drwxrwxrwt 26 root root 12288 Okt 18 14:45 tmp
drwxr-xr-x 17 root root 4096 Jun 24 2022 usr
drwxr-xr-x 15 root root 4096 Jun 3 2018 var
drwxr-xr-x 2 root root 4096 Sep 2 2020 zfspool
$ ls -l /usr
insgesamt 324
drwxr-xr-x 2 root root 135168 Okt 17 23:13 bin
drwxr-xr-x 2 root root 4096 Okt 17 23:09 games
drwxr-xr-x 3 root root 4096 Jun 24 2022 i686-w64-mingw32
drwxr-xr-x 105 root root 20480 Okt 14 14:33 include
drwxr-xr-x 203 root root 57344 Okt 16 12:33 lib
drwxr-xr-x 3 root root 4096 Jun 26 15:18 lib32
drwxr-xr-x 3 root root 4096 Jun 26 15:18 lib64
drwxr-xr-x 32 root root 12288 Okt 14 14:34 libexec
drwxr-xr-x 2 root root 4096 Jun 24 2022 libx32
drwxr-xr-x 12 root root 4096 Mai 21 2022 local
drwxr-xr-x 3 root root 4096 Jul 31 2016 locale
drwxr-xr-x 2 root root 32768 Okt 16 11:59 sbin
drwxr-xr-x 555 root root 20480 Okt 17 23:09 share
drwxr-xr-x 19 root root 4096 Okt 16 11:50 src
drwxr-xr-x 3 root root 4096 Jun 24 2022 x86_64-w64-mingw32
I hope someone knows a workaround.
I only see to manually update my sources.list and do the upgrade without do-release-upgrade, because usrmerge says usr is successfully converted and do-release-upgrade says the opposite, and I can't figure out why.
TIA
floogy