我最近从我的系统中安装了 apcupsd 包,然后决定删除它。当我尝试删除它时,它失败了。以下是一些信息:
> uname -a Linux 3.5.0-26-generic #42~precise1-Ubuntu SMP Mon
> Mar 11 22:17:58 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
>
> sudo apt-get -f install apcupsd Reading package lists... Done Building
> dependency tree Reading state information... Done apcupsd is
> already the newest version. 0 upgraded, 0 newly installed, 0 to remove
> and 7 not upgraded. 1 not fully installed or removed. Need to get 0
> B/281 kB of archives. After this operation, 0 B of additional disk
> space will be used. Do you want to continue [Y/n]?
>
> (Reading database ... 454090 files and directories currently
> installed.) Preparing to replace apcupsd 3.14.10-1 (using
> .../apcupsd_3.14.10-1_amd64.deb) ... Unpacking replacement apcupsd ...
> invoke-rc.d: unknown initscript, /etc/init.d/apcupsd not found. cat:
> /var/lib/acpi-support/system-manufacturer: No such file or directory
> cat: /var/lib/acpi-support/system-product-name: No such file or
> directory cat: /var/lib/acpi-support/system-version: No such file or
> directory cat: /var/lib/acpi-support/bios-version: No such file or
> directory dpkg: warning: subprocess old post-removal script returned
> error exit status 1 dpkg - trying script from the new package instead
> ... invoke-rc.d: unknown initscript, /etc/init.d/apcupsd not found.
> cat: /var/lib/acpi-support/system-manufacturer: No such file or
> directory cat: /var/lib/acpi-support/system-product-name: No such file
> or directory cat: /var/lib/acpi-support/system-version: No such file
> or directory cat: /var/lib/acpi-support/bios-version: No such file or
> directory dpkg: error processing
> /var/cache/apt/archives/apcupsd_3.14.10-1_amd64.deb (--unpack):
> subprocess new post-removal script returned error exit status 1
> invoke-rc.d: unknown initscript, /etc/init.d/apcupsd not found. cat:
> /var/lib/acpi-support/system-manufacturer: No such file or directory
> cat: /var/lib/acpi-support/system-product-name: No such file or
> directory cat: /var/lib/acpi-support/system-version: No such file or
> directory cat: /var/lib/acpi-support/bios-version: No such file or
> directory dpkg: error while cleaning up: subprocess new post-removal
> script returned error exit status 1 Processing triggers for ureadahead
> ... Processing triggers for man-db ... Errors were encountered while
> processing: /var/cache/apt/archives/apcupsd_3.14.10-1_amd64.deb E:
> Sub-process /usr/bin/dpkg returned an error code (1)
>
> sudo apt-get remove apcupsd Reading package lists... Done Building
> dependency tree Reading state information... Done The following
> packages will be REMOVED: apcupsd 0 upgraded, 0 newly installed, 1
> to remove and 7 not upgraded. 1 not fully installed or removed. After
> this operation, 749 kB disk space will be freed. Do you want to
> continue [Y/n]? dpkg: error processing apcupsd (--remove): Package
> is in a very bad inconsistent state - you should reinstall it before
> attempting a removal. Errors were encountered while processing:
> apcupsd E: Sub-process /usr/bin/dpkg returned an error code (1)
有人可以帮忙吗?
谢谢你雅尼斯
我已经尝试了所有方法,但出于某种原因,它还是无法卸载!
sudo apt-get --reinstall install apcupsd
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 7 not upgraded.
17 not fully installed or removed.
Need to get 0 B/281 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 454211 files and directories currently installed.)
Preparing to replace apcupsd 3.14.10-1 (using .../apcupsd_3.14.10-1_amd64.deb) ...
Unpacking replacement apcupsd ...
invoke-rc.d: unknown initscript, /etc/init.d/apcupsd not found.
cat: /var/lib/acpi-support/system-manufacturer: No such file or directory
cat: /var/lib/acpi-support/system-product-name: No such file or directory
cat: /var/lib/acpi-support/system-version: No such file or directory
cat: /var/lib/acpi-support/bios-version: No such file or directory
dpkg: warning: subprocess old post-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
invoke-rc.d: unknown initscript, /etc/init.d/apcupsd not found.
cat: /var/lib/acpi-support/system-manufacturer: No such file or directory
cat: /var/lib/acpi-support/system-product-name: No such file or directory
cat: /var/lib/acpi-support/system-version: No such file or directory
cat: /var/lib/acpi-support/bios-version: No such file or directory
dpkg: error processing /var/cache/apt/archives/apcupsd_3.14.10-1_amd64.deb (--unpack):
subprocess new post-removal script returned error exit status 1
invoke-rc.d: unknown initscript, /etc/init.d/apcupsd not found.
cat: /var/lib/acpi-support/system-manufacturer: No such file or directory
cat: /var/lib/acpi-support/system-product-name: No such file or directory
cat: /var/lib/acpi-support/system-version: No such file or directory
cat: /var/lib/acpi-support/bios-version: No such file or directory
dpkg: error while cleaning up:
subprocess new post-removal script returned error exit status 1
Processing triggers for ureadahead ...
Processing triggers for man-db ...
Errors were encountered while processing:
/var/cache/apt/archives/apcupsd_3.14.10-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
sudo apt-get remove apcupsd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
apcupsd
0 upgraded, 0 newly installed, 1 to remove and 7 not upgraded.
17 not fully installed or removed.
After this operation, 749 kB disk space will be freed.
Do you want to continue [Y/n]?
dpkg: error processing apcupsd (--remove):
Package is in a very bad inconsistent state - you should
reinstall it before attempting a removal.
Errors were encountered while processing:
apcupsd
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
我可以读一点,最好的解决方案是重新安装该包,因为它在最后说 apt-get,然后卸载它:
sudo apt-get --reinstall install apcupsd
sudo apt-get remove apcupsd
这应该可以解决你的问题。
答案2
好吧,最后我设法通过以下方式修复了它:
- 从 /var/lib/dpkg/status 文件手动删除 apcupsd 条目。
- 手动删除 apcupsd 程序文件夹。
希望它能对某人有所帮助。
干杯!