Não consigo atualizar de 22.04 para 24.04.1 porque do-release-upgrade para e a reivindicação usr não é mesclada.
Mas se eu executar o usrmerge como root, ele exibe uma mensagem informando que o usr foi mesclado com sucesso.
Mas há um erro mesmo assim. Talvez ele pare com exit 1, pensei, mas parece que não é o caso. echo $? retorna 0.
Criei um script wrapper que chama usrmerge e sai com 0. Mas do-release-upgrade ainda falha, alegando que usr não foi mesclado e que eu deveria instalar o pacote usrmerge para resolver o problema.
$ 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) ===
Eu escrevi um script wrapper, mas ele retorna 0, como o script original, apesar do original gerar esse aviso no Smartmatch na linha 172.
$ sudo cat /usr/lib/usrmerge/convert-usrmerge
#!/bin/bash
/usr/lib/usrmerge/convert-usrmerge_bin 2> /dev/null
exit 0
Executando o wrapper
$ sudo LANG=C /usr/lib/usrmerge/convert-usrmerge
The system has been successfully converted.
Executando o script usrmerge diretamente
$ 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";
Aqui está uma saída strace https://pastebin.ubuntu.com/p/c3wghnxPJ7/
Editei convert-usrmerge para evitar o aviso, o que funciona
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;
Mas infelizmente isso não resolveu o problema do do-release-upgrade, que alega que o usr não foi mesclado e reclama sobre isso e não inicia o processo de atualização.
Então o Smartmatch não parece ser o culpado.
Não sei como depurar um Perlscript, mas mesmo assim posto minha tentativa:
$ 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
Pelo que posso ver, o usr já foi mesclado
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
Espero que alguém saiba uma solução alternativa.
Só consigo atualizar manualmente meu sources.list e fazer a atualização sem do-release-upgrade, porque usrmerge diz que usr foi convertido com sucesso e do-release-upgrade diz o oposto, e não consigo descobrir o porquê.
AIT
floogy