3 votos

Eliminación del programa después de haber eliminado accidentalmente su carpeta de instalación

¿Cómo puedo eliminar o reinstalar un programa después de haber eliminado accidentalmente su carpeta de instalación?

Accidentalmente eliminé /opt/spotify/ carpeta y no puedo reinstalar spotify-client ni purgarlo.

 sudo apt-get purge spotify-client
 Reading package lists... Done
 Building dependency tree       
 Reading state information... Done
 The following packages will be REMOVED:
   spotify-client*
 0 upgraded, 0 newly installed, 1 to remove and 45 not upgraded.
 1 not fully installed or removed.
 After this operation, 143 MB disk space will be freed.
 Do you want to continue? [Y/n] 
 (Reading database ... 276312 files and directories currently installed.)
 Removing spotify-client (1:0.9.17.1.g9b85d43.7-1) ...
 /var/lib/dpkg/info/spotify-client.prerm: 9: cd: can't cd to /opt/spotify/spotify-client
 dpkg: error processing package spotify-client (--purge):
  subprocess installed pre-removal script returned error exit status 2
 /var/lib/dpkg/info/spotify-client.postinst: 5: cd: can't cd to /opt/spotify/spotify-client
 dpkg: error while cleaning up:
  subprocess installed post-installation script returned error exit status 2
 Errors were encountered while processing:
  spotify-client
 E: Sub-process /usr/bin/dpkg returned an error code (1)

y

sudo apt-get install --reinstall spotify-client
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 45 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
E: Internal Error, No file name for spotify-client:amd64

Por supuesto, ¡la carpeta no está en la basura! Gracias.

0 votos

Crear manualmente el directorio /opt/spotify/spotify-client y luego tratar de purgar. A ver qué pasa

1 votos

No funciona, el mismo problema (¡busca cosas dentro de la nueva carpeta vacía!)

0 votos

Lo que ocurre con sudo apt-get install spotify-client ?

0voto

Jan Puntos 4325

Se puede sortear la situación utilizando una combinación de apt y dpkg . Primero descargue el paquete deb del repositorio

apt-get download <packagename>

Luego instala el archivo .deb (está en la carpeta actual)

sudo dpkg -i <downloaded_package_file.deb>

Si esto no funciona, añada el --force-all cambiar a dpkg es decir

sudo dpkg -i --force-all <downloaded_package_file.deb>

Si sigue sin funcionar, añada también --no-triggers

sudo dpkg -i --force-all --no-triggers <downloaded_package_file.deb>

Como último recurso (no recomendado) , podría editar manualmente /var/lib/dpkg/status :

  • hacer una copia de seguridad del archivo
  • encontrar y eliminar el bloque relativo a spotify-client
  • mantener la línea vacía antes del siguiente bloque
  • guardar
  • apt-get -f install spotify-client

0 votos

No funcionó. [...] /var/lib/dpkg/info/spotify-client.prerm: 9: cd: can't cd to /opt/spotify/spotify-client dpkg: warning: subprocess old pre-removal script returned error exit status 2 [...] dpkg: error while cleaning up: subprocess installed post-installation script returned error exit status 2 Errors were encountered while processing: spotify-client_1%3a0.9.17.1.g9b85d43.7-1_amd64.deb

0 votos

He añadido mi respuesta.

0 votos

Así que probé con --force-all y --no-triggers pero nada sigue el mismo error. No estoy seguro de la no recomendada. Tal vez voy a esperar a que otros usuarios ideas! ;)

0voto

josten Puntos 1159

Lo que suelo hacer es obtener un listado de archivos del paquete y luego borrar todos esos archivos y volver a instalar:

  1. Quita: apt-get remove spotify-client
  2. Purgue los archivos por completo: apt-file list spotify-client | cut -d' ' -f 2 | xargs rm -rf
  3. Luego vuelve a instalarlo: apt-get install spotify-client

0 votos

El punto 1 no ha funcionado. dpkg: error processing package spotify-client (--remove): package is in a very bad inconsistent state; you should reinstall it before attempting a removal Errors were encountered while processing: spotify-client E: Sub-process /usr/bin/dpkg returned an error code (1) . Punto 2: sudo: apt-file: command not found .

EnMiMaquinaFunciona.com

EnMiMaquinaFunciona es una comunidad de administradores de sistemas en la que puedes resolver tus problemas y dudas.
Puedes consultar las preguntas de otros sysadmin, hacer tus propias preguntas o resolver las de los demás.

Powered by:

X