J'ai essayé d'installer droidcam pour résoudre une autre question en suivant les instructions ci-dessous: Installez le client DroidCam (Webcam sans fil Android) dans Ubuntu via PPA
L'installation échoue avec une erreur de post-script, journal complet trouvé ici .
Maintenant, je veux le nettoyer et le supprimer complètement. Donc, je lance Sudo apt-get purge droidcam
. Mais j'ai été surpris de devoir l'exécuter 3 fois pour nettoyer complètement son installation.
$ Sudo apt-get purge droidcam
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-3.19.0-15 linux-headers-3.19.0-15-generic linux-image-3.19.0-15-generic linux-image-extra-3.19.0-15-generic
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
droidcam*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 1,529 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 239094 files and directories currently installed.)
Removing droidcam (1.3-0ubuntu0) ...
rmmod: ERROR: Module v4l2loopback_dc is not currently loaded
dpkg: error processing package droidcam (--purge):
subprocess installed post-removal script returned error exit status 1
Processing triggers for gnome-menus (3.10.1-0ubuntu5) ...
Processing triggers for bamfdaemon (0.5.1+15.04.20150202-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for desktop-file-utils (0.22-1ubuntu3) ...
Processing triggers for mime-support (3.58ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.14-0ubuntu1) ...
Errors were encountered while processing:
droidcam
E: Sub-process /usr/bin/dpkg returned an error code (1)
$ Sudo apt-get purge droidcam
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-3.19.0-15 linux-headers-3.19.0-15-generic linux-image-3.19.0-15-generic linux-image-extra-3.19.0-15-generic
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
droidcam
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 1,529 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 239088 files and directories currently installed.)
Removing droidcam (1.3-0ubuntu0) ...
$ Sudo apt-get purge droidcam
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-3.19.0-15 linux-headers-3.19.0-15-generic linux-image-3.19.0-15-generic linux-image-extra-3.19.0-15-generic
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
droidcam*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 239087 files and directories currently installed.)
Removing droidcam (1.3-0ubuntu0) ...
Purging configuration files for droidcam (1.3-0ubuntu0) ...
dpkg: warning: while removing droidcam, directory '/opt' not empty so not removed
$ Sudo apt-get purge droidcam
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'droidcam' is not installed, so not removed
The following packages were automatically installed and are no longer required:
linux-headers-3.19.0-15 linux-headers-3.19.0-15-generic linux-image-3.19.0-15-generic linux-image-extra-3.19.0-15-generic
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Ce que je veux savoir:
apt-get purge work
? Bien que apt-get purge
supprime tous les fichiers installés en un seul passage.Ma première attente, peut-être que droidcam n’est pas bien emballé.
Ce paquet et beaucoup d’autres ont des problèmes à supprimer après un problème lors de l’installation. Ma solution, si un script échoue, examine le dossier /var/lib/dpkg/info/
. Il y a quatre types de scripts
package_name.preinst
- script de pré-installationpackage_name.postinst
- script post-installationpackage_name.prerm
- script de pré-suppressionpackage_name.postrm
- script post-suppressionRegardez dans les scripts: Il est généralement très facile de trouver le problème immédiatement. Souvent, il s’agit simplement d’un service qui ne peut pas être démarré ou arrêté. Ou comme dans votre cas, un module non chargé. Si vous souhaitez uniquement supprimer le package, supprimez le code incriminé et recommencez la suppression.
Dans les cas très problématiques Parfois, le seul moyen de supprimer le script complet jusqu'à la ligne exit 0
, actuellement, par exemple. nginx
: (
Et comme @ kos dit, supprimez la ligne set -e
. Mais je n'ai jamais testé.
Et lancez une pétition pour des scripts plus robustes =)
Quelques exemples
Comment puis-je supprimer un dpkg endommagé par le pilote Brother MFC-8840 deb?