我的应用程序有一个 deb 包。有时当我使用命令安装或删除某些软件(例如 synaptic 或 openssh-server)时
sudo apt-get install (or remove) synaptic
它使用参数“configure 1.1.123.0”为我的程序执行 postinst 脚本,其中 1.1.123.0 是我安装的应用程序的版本。
为什么会出现这种情况?我的程序与 synaptic、openssh-server 和其他软件无关。我该如何调试导致这种情况的原因?
以下是终端的输出:
user@ubuntu:~/tmp$ sudo apt-get remove synaptic
[sudo] password for user:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package synaptic is not installed, so not removed
The following packages were automatically installed and are no longer required: # This list does not contain myapp
libdpkg-perl fakeroot gir1.2-ubuntuoneui-3.0 libalgorithm-merge-perl g++-4.6 cmake-data dh-apparmor libalgorithm-diff-xs-perl g++ libstdc++6-4.6-dev
linux-headers-3.5.0-23-generic linux-headers-3.5.0-23 libubuntuoneui-3.0-1 thunderbird-globalmenu html2text libqt3-mt libalgorithm-diff-perl libxmlrpc-core-c3
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up myapp:i386 (1.1.777.0) ...
/var/lib/dpkg/info/myapp.postinst configure 1.1.777.0 # This is debug string from my postinst script
update-rc.d: warning: /etc/init.d/myapp missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
System start/stop links for /etc/init.d/myapp already exist.
myapp already installed # <-- message and error from my postinst script
dpkg: error processing myapp:i386 (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
myapp:i386
E: Sub-process /usr/bin/dpkg returned an error code (1)
输出sudo dpkg --configure -a
user@ubuntu:~$ sudo dpkg --configure -a
Setting up myapp:i386 (1.1.777.0) ...
=/var/lib/dpkg/info/myapp.postinst=configure 1.1.777.0=
update-rc.d: warning: /etc/init.d/myapp missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
System start/stop links for /etc/init.d/myapp already exist.
starting...
myapp already running.
rc from agent = 1
dpkg: error processing myapp:i386 (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
myapp:i386
答案1
请发布输出
sudo dpkg --configure -a
如果你收到如下错误Errors were encountered while processing: myapp:i386
然后使用以下方法删除我的应用程序:
sudo apt-get purge myapp
并且还对re-install
所有损坏的下载使用以下内容。
sudo apt-get install -f
损坏软件包的问题仍然存在,解决方案是手动编辑 dpkg 状态文件。
sudo gedit /var/lib/dpkg/status
(你可以用vim
代替gedit
)
找到损坏的包,删除有关它的整个信息块并保存文件。