AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / ubuntu / Perguntas / 1530232
Accepted
floogy
floogy
Asked: 2024-10-17 07:27:02 +0800 CST2024-10-17 07:27:02 +0800 CST 2024-10-17 07:27:02 +0800 CST

do-release-upgrade falha devido a usrmerge e Smartmatch

  • 772

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

do-release-upgrade
  • 1 1 respostas
  • 42 Views

1 respostas

  • Voted
  1. Best Answer
    Marius Gedminas
    2024-10-18T21:42:53+08:002024-10-18T21:42:53+08:00

    Seu ls -la /programa mostra que /libé um link simbólico absoluto:

        lrwxrwxrwx   1 root    root           8 Mai  6 15:35  lib -> /usr/lib
    

    Dei uma olhada no código na ferramenta de atualização específica para 24.04 ( http://archive.ubuntu.com/ubuntu/dists/noble-updates/main/dist-upgrader-all/current/noble.tar.gz , cujo URL você pode encontrar em https://changelogs.ubuntu.com/meta-release-lts ), e ele espera que um sistema /usr mesclado tenha /lib como um link simbólico relativo para usr/lib:

        def _test_and_fail_on_unmerged_usr(self):
            """
            LP: #2058648
            """
            fail = False
    
            logging.debug('Checking that system is /usr-merged')
    
            for d in ('/bin', '/sbin', '/lib'):
                try:
                    if os.readlink(d) != f'usr{d}':
                        # The file is a symlink, but it's pointing to the wrong
                        # place?
                        fail = True
                        break
    

    Você poderá realizar a atualização se substituir o link simbólico /lib por um relativo:

    sudo ln -sfn usr/lib /lib
    

    Além disso, eu relataria um bug porque acho que a ferramenta de atualização deveria aceitar links simbólicos absolutos aqui.

    • 0

relate perguntas

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Existe um comando para listar todos os usuários? Também para adicionar, excluir, modificar usuários, no terminal?

    • 9 respostas
  • Marko Smith

    Como excluir um diretório não vazio no Terminal?

    • 4 respostas
  • Marko Smith

    Como descompactar um arquivo zip do Terminal?

    • 9 respostas
  • Marko Smith

    Como instalo um arquivo .deb por meio da linha de comando?

    • 11 respostas
  • Marko Smith

    Como instalo um arquivo .tar.gz (ou .tar.bz2)?

    • 14 respostas
  • Marko Smith

    Como listar todos os pacotes instalados

    • 24 respostas
  • Martin Hope
    Flimm Como posso usar o docker sem sudo? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    led-Zepp Como faço para salvar a saída do terminal em um arquivo? 2014-02-15 11:49:07 +0800 CST
  • Martin Hope
    ubuntu-nerd Como descompactar um arquivo zip do Terminal? 2011-12-11 20:37:54 +0800 CST
  • Martin Hope
    TheXed Como instalo um arquivo .deb por meio da linha de comando? 2011-05-07 09:40:28 +0800 CST
  • Martin Hope
    Ivan Como listar todos os pacotes instalados 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    David Barry Como determino o tamanho total de um diretório (pasta) na linha de comando? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher "Os seguintes pacotes foram retidos:" Por que e como resolvo isso? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford Como os PPAs podem ser removidos? 2010-07-30 01:09:42 +0800 CST

Hot tag

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve