这个 /usr/bin/dpkg 返回错误 || ubuntu-16.04, 64bit

这个 /usr/bin/dpkg 返回错误 || ubuntu-16.04, 64bit

我正在尝试安装 htop,但由于未满足依赖关系而失败。尝试过sudo apt-get -f install,但也没有解决问题。

尝试过sudo apt clean& sudo apt updatesudo apt upgrade,但没有成功。也尝试过删除 dpkg,也没有成功。

之前它显示了,Could not get lock /var/lib/dpkg/lock所以我将其删除了,现在它在安装中显示以下错误。

Sub-process /usr/bin/dpkg returned an error code (1)

ik@ik-ThinkPad-T440p:~$ sudo apt install htop
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 linux-image-extra-4.4.0-64-generic : Depends: linux-image-4.4.0-64-generic but it is not going to be installed
 linux-image-generic : Depends: linux-image-4.4.0-64-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
ik@ik-ThinkPad-T440p:~$ 
ik@ik-ThinkPad-T440p:~$ sudo apt-get -f install 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  geoip-database-extra javascript-common libc-ares2 libjs-openlayers libnl-route-3-200 libqgsttools-p1 libqt5multimedia5-plugins libqt5multimediawidgets5 libsmi2ldbl libwireshark-data libwireshark6
  libwiretap5 libwsutil6 linux-headers-4.4.0-21 linux-headers-4.4.0-21-generic linux-headers-4.4.0-59 linux-headers-4.4.0-59-generic linux-image-4.4.0-21-generic linux-image-4.4.0-59-generic
  linux-image-extra-4.4.0-21-generic linux-image-extra-4.4.0-59-generic wireshark-common
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  linux-image-4.4.0-64-generic
Suggested packages:
  fdutils linux-doc-4.4.0 | linux-source-4.4.0 linux-tools
The following NEW packages will be installed:
  linux-image-4.4.0-64-generic
0 upgraded, 1 newly installed, 0 to remove and 89 not upgraded.
6 not fully installed or removed.
Need to get 21.8 MB of archives.
After this operation, 66.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrors.nayatel.com/ubuntu xenial-updates/main amd64 linux-image-4.4.0-64-generic amd64 4.4.0-64.85 [21.8 MB]
Fetched 21.8 MB in 1min 5s (335 kB/s)                                                                                                                                                                      
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
(Reading database ... 326141 files and directories currently installed.)
Preparing to unpack .../linux-image-4.4.0-64-generic_4.4.0-64.85_amd64.deb ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-64-generic_4.4.0-64.85_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-64-generic /boot/vmlinuz-4.4.0-64-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-64-generic /boot/vmlinuz-4.4.0-64-generic
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-4.4.0-64-generic_4.4.0-64.85_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

这些是命令的输出,请帮我解决这个问题。 p:~$ df -H 文件系统 大小 已用 可用 使用率% 挂载于 udev 4.1G 0 4.1G 0% /dev tmpfs 805M 19M 787M 3% /run /dev/sda7 293G 14G 264G 5% / tmpfs 4.1G 201M 3.9G 5% /dev/shm tmpfs 5.3M 4.1k 5.3M 1% /run/lock tmpfs 4.1G 0 4.1G 0% /sys/fs/cgroup /dev/loop0 62M 62M 0 100% /snap/notes/4 /dev/loop3 79M 79M 0 100% /snap/core/1337 /dev/loop2 80M 80M 0 100% /snap/core/1264 /dev/loop1 80M 80M 0 100% /snap/core/1240 tmpfs 805M 62k 805M 1% /run/user/1000

答案1

自己解决了这个问题。

删除了所有现有的包,如下所示:注意:在执行此操作之前,请关闭所有选项卡和其他工作表,因为我们不知道哪个过程阻碍了解决方案。

第一:sudo apt autoremove

然后,sudo apt-get clean 然后,sudo apt-get -f install 然后,sudo apt-get update 然后,sudo apt-get upgrade

这样您就修复完成了。

相关内容