我已经尝试按照此处的说明安装 droidcam 来解决另一个问题:Install DroidCam (Wireless Android Webcam) Client In Ubuntu Via PPA
安装失败并出现后脚本错误,完整日志在此处找到。
现在,我想清理它并完全删除它。所以,我跑了sudo apt-get purge droidcam
。但令我惊讶的是,我必须运行它 3 次才能完全清理它的安装。
$ 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.
我想知道的是:
- 为什么,我需要多次运行它?
- 怎么样
apt-get purge work
?我虽然apt-get purge
会一次删除所有已安装的文件。
我的第一个期望,可能是 droidcam 没有很好地包装。
在安装过程中出现问题后,这个和许多其他软件包都有问题要删除。我的解决方案是,如果脚本失败,请查看文件夹
/var/lib/dpkg/info/
。有四种类型的脚本package_name.preinst
– 预安装脚本package_name.postinst
– 安装后脚本package_name.prerm
– 预删除脚本package_name.postrm
– 删除后脚本查看脚本:通常很容易立即发现问题。通常它只是一个无法启动或停止的服务。或者像你的情况一样,一个卸载的模块。如果您只想删除包,请删除有问题的代码并再次开始删除。
在非常有问题的情况下,有时删除整个脚本到行的唯一方法
exit 0
,目前例如nginx
:(正如@kos所说,删除行
set -e
。但我从来没有测试过。并开始请愿更强大的脚本=)
一些例子
如何删除被 Brother MFC-8840 deb 驱动程序损坏的 dpkg?
AVG 错误(重新安装 ubuntu)
未能安装文档库