O sistema de pacotes está quebrado no Ubuntu 22.04

O sistema de pacotes está quebrado no Ubuntu 22.04

Recebo um erro na atualização de software no Ubuntu 22.04. Como posso corrigir o erro: "tentando substituir o ARQUIVO compartilhado que é diferente de outras instâncias do pacote NAME". Exemplo abaixo:

trying to overwrite shared '/usr/lib/llvm-14/lib/libunwind.so.1.0',
which is different from other instances of package libunwind-14:i386
...

Saída completa do terminal na parte inferior desta questão

Errors were encountered while processing:
 /var/cache/apt/archives/libunwind-14_1%3a14.0.0-1ubuntu1_i386.deb
 /var/cache/apt/archives/libc++abi1-14_1%3a14.0.0-1ubuntu1_i386.deb
 /var/cache/apt/archives/libc++1-14_1%3a14.0.0-1ubuntu1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Tela 1

insira a descrição da imagem aqui

Tela 2

insira a descrição da imagem aqui

Tela 3

insira a descrição da imagem aqui

Saída completa:

lis@lenovo:~$ sudo apt-get install -f
[sudo] password for lis: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  libc++1-14:i386 libc++abi1-14:i386 libunwind-14:i386
Suggested packages:
  clang:i386
The following NEW packages will be installed:
  libc++1-14:i386 libc++abi1-14:i386 libunwind-14:i386
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
5 not fully installed or removed.
Need to get 0 B/391 kB of archives.
After this operation, 1 475 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 215160 files and directories currently installed.)
Preparing to unpack .../libunwind-14_1%3a14.0.0-1ubuntu1_i386.deb ...
Unpacking libunwind-14:i386 (1:14.0.0-1ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/libunwind-14_1%3a14.0.0-1ubuntu1_i386.deb (--unpack):
 trying to overwrite shared '/usr/lib/llvm-14/lib/libunwind.so.1.0', which is different from other instances of package libunwind-14:i386
Preparing to unpack .../libc++abi1-14_1%3a14.0.0-1ubuntu1_i386.deb ...
Unpacking libc++abi1-14:i386 (1:14.0.0-1ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/libc++abi1-14_1%3a14.0.0-1ubuntu1_i386.deb (--unpack):
 trying to overwrite shared '/usr/lib/llvm-14/lib/libc++abi.so.1.0', which is different from other instances of package libc++abi1-14:i386
Preparing to unpack .../libc++1-14_1%3a14.0.0-1ubuntu1_i386.deb ...
Unpacking libc++1-14:i386 (1:14.0.0-1ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/libc++1-14_1%3a14.0.0-1ubuntu1_i386.deb (--unpack):
 trying to overwrite shared '/usr/lib/llvm-14/lib/libc++.so.1.0', which is different from other instances of package libc++1-14:i386
Errors were encountered while processing:
 /var/cache/apt/archives/libunwind-14_1%3a14.0.0-1ubuntu1_i386.deb
 /var/cache/apt/archives/libc++abi1-14_1%3a14.0.0-1ubuntu1_i386.deb
 /var/cache/apt/archives/libc++1-14_1%3a14.0.0-1ubuntu1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Responder1

Você deve remover as versões em cache e tentar novamente porque elas são conflitantes.

Primeiro, remova as versões em cache:

sudo rm /var/cache/apt/archives/*.deb
sudo rm -R /var/cache/apt/archives/partial

Próximo, tente novamente:

sudo apt update
sudo apt -f install
sudo apt dist-upgrade

Por favor poste quaisquer erros futuros.


EDITAR (veja a solução abaixo):

Cada pacote ofensivo é da versão i386. As versões amd64 e i386 de cada pacote contêm um arquivo com o mesmo nome no mesmo local, mas o hashsum do arquivo é diferente. Para estes pacotes específicos, as versões amd64 e i386 não podem coexistir.

A solução é remover a versão i386, a menos que seja absolutamente necessário ter a versão i386 instalada.

Basta ter cuidado ecertifique-se de inspecionar a lista de pacotes a serem removidos antes de aceitar Ydepois de correr:

sudo apt remove libc++1-14:i386 libc++abi1-14:i386 libunwind-14:i386

Neste caso específico, o OP informou que a remoção libc++1-14:i386por si só resolveu o problema.

informação relacionada