Tengo un servidor antiguo que ejecuta Ubuntu 18.04.6 LTS y sospecho que alguien intentó instalar o actualizar los paquetes incorrectos de Ubuntu 20.04, lo que resultó en un apt roto y el llamado "Frankensystem".
Me gustaría solucionar este problema sin tener que reinstalar todo el sistema, especialmente porque el servidor está ubicado en una ubicación remota. ¿Es posible reparar los paquetes rotos uno por uno y, de ser así, cómo puedo hacerlo?
Estos son los errores que encuentro:
Al correr sudo apt update
:
$ sudo apt update
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Get:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Fetched 222 kB in 2s (118 kB/s)
Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFound.db.creator import DbCreator
File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in <module>
import apt_pkg
ImportError: libapt-pkg.so.6.0: cannot open shared object file: No such file or directory
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code
al correr sudo apt --fix-broken install
:
$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Correcting dependencies... failed.
The following packages have unmet dependencies:
dirmngr : Depends: init-system-helpers (>= 1.52) but 1.51 is installed
gir1.2-gtk-3.0 : Depends: gir1.2-gdkpixbuf-2.0 (>= 2.40.0) but 2.36.11-2 is installed
Depends: gir1.2-pango-1.0 (>= 1.41.0) but 1.40.14-1ubuntu0.1 is installed
Depends: libgtk-3-0 (>= 3.24.7) but 3.22.30-1ubuntu4 is installed
gnupg : Depends: gpgv (>= 2.2.19-3ubuntu2.2) but 2.2.4-1ubuntu1.6 is installed
gnupg-utils : Depends: libreadline8 (>= 6.0) but it is not installed
gpg : Depends: libreadline8 (>= 6.0) but it is not installed
gpg-agent : Depends: init-system-helpers (>= 1.52) but 1.51 is installed
gpgconf : Depends: libreadline8 (>= 6.0) but it is not installed
gpgsm : Depends: libreadline8 (>= 6.0) but it is not installed
hplip : Depends: hplip-data (= 3.20.3+dfsg0-2) but 3.17.10+
cuando revisé /usr/lib/x86_64-linux-gnu
encontré libapt-pkg.so.5.0
que existe y pero nolibapt-pkg.so.6.0
Además, /usr/lib/python3/dist-packages
encontré apt_pkg.cpython-38-x86_64-linux-gnu.so
lo cual es extraño, porque la versión de Python3 es 3.6.9.
Respecto a las copias de seguridad, encontré estos archivos.
/var/backups$ ls -l
total 7276
-rw-r--r-- 1 root root 153600 Apr 10 00:08 alternatives.tar.0
-rw-r--r-- 1 root root 9783 Jun 24 2022 alternatives.tar.1.gz
-rw-r--r-- 1 root root 9808 Nov 27 2021 alternatives.tar.2.gz
-rw-r--r-- 1 root root 9421 Mar 27 2021 alternatives.tar.3.gz
-rw-r--r-- 1 root root 6161 Mar 18 2021 alternatives.tar.4.gz
-rw-r--r-- 1 root root 6090 Jan 25 2021 alternatives.tar.5.gz
-rw-r--r-- 1 root root 6061 Nov 28 2020 alternatives.tar.6.gz
-rw-r--r-- 1 root root 154853 Apr 9 23:02 apt.extended_states.0
-rw-r--r-- 1 root root 12962 Apr 9 21:44 apt.extended_states.1.gz
-rw-r--r-- 1 root root 12828 Jul 26 2022 apt.extended_states.2.gz
-rw-r--r-- 1 root root 12821 Jul 4 2022 apt.extended_states.3.gz
-rw-r--r-- 1 root root 12806 Jun 23 2022 apt.extended_states.4.gz
-rw-r--r-- 1 root root 13304 Jun 17 2022 apt.extended_states.5.gz
-rw-r--r-- 1 root root 13269 Nov 26 2021 apt.extended_states.6.gz
-rw-r--r-- 1 root root 4649 Jun 23 2022 dpkg.diversions.0
-rw-r--r-- 1 root root 657 Jun 23 2022 dpkg.diversions.1.gz
-rw-r--r-- 1 root root 657 Jun 23 2022 dpkg.diversions.2.gz
-rw-r--r-- 1 root root 657 Jun 23 2022 dpkg.diversions.3.gz
-rw-r--r-- 1 root root 657 Jun 23 2022 dpkg.diversions.4.gz
-rw-r--r-- 1 root root 657 Jun 23 2022 dpkg.diversions.5.gz
-rw-r--r-- 1 root root 657 Jun 23 2022 dpkg.diversions.6.gz
-rw-r--r-- 1 root root 348 Mar 18 2021 dpkg.statoverride.0
-rw-r--r-- 1 root root 213 Mar 18 2021 dpkg.statoverride.1.gz
-rw-r--r-- 1 root root 213 Mar 18 2021 dpkg.statoverride.2.gz
-rw-r--r-- 1 root root 213 Mar 18 2021 dpkg.statoverride.3.gz
-rw-r--r-- 1 root root 213 Mar 18 2021 dpkg.statoverride.4.gz
-rw-r--r-- 1 root root 213 Mar 18 2021 dpkg.statoverride.5.gz
-rw-r--r-- 1 root root 213 Mar 18 2021 dpkg.statoverride.6.gz
-rw-r--r-- 1 root root 2529012 Jul 3 16:58 dpkg.status.0
-rw-r--r-- 1 root root 708160 Apr 10 00:09 dpkg.status.1.gz
-rw-r--r-- 1 root root 708160 Apr 10 00:09 dpkg.status.2.gz
-rw-r--r-- 1 root root 708160 Apr 10 00:09 dpkg.status.3.gz
-rw-r--r-- 1 root root 708160 Apr 10 00:09 dpkg.status.4.gz
-rw-r--r-- 1 root root 708160 Apr 10 00:09 dpkg.status.5.gz
-rw-r--r-- 1 root root 708160 Apr 10 00:09 dpkg.status.6.gz
-rw------- 1 root root 1336 Apr 9 22:33 group.bak
-rw------- 1 root shadow 1107 Apr 9 22:33 gshadow.bak
-rw------- 1 root root 3518 Apr 9 22:33 passwd.bak
-rw-r--r-- 1 root smmsp 64178 Mar 18 2021 sendmail.cf.bak
-rw-r--r-- 1 root smmsp 4058 Mar 18 2021 sendmail.mc.bak
-rw------- 1 root shadow 2479 Apr 9 22:33 shadow.bak
-rw-r--r-- 1 root smmsp 44618 Mar 18 2021 submit.cf.bak
-rw-r--r-- 1 root smmsp 2375 Mar 18 2021 submit.mc.bak
¿O puedo usar cualquiera de estos archivos para restaurar el sistema a un estado funcional?