apt-get upgrade
表示应该删除某个包:
gradinafrica@host:~$ sudo apt-get upgrade
[sudo] password for gradinafrica:
Reading package lists... Done
Building dependency tree... Done
Calculating upgrade... Done
The following packages will be REMOVED:
linux-image-extra-3.13.0-61-generic
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 152 MB disk space will be freed.
Do you want to continue? [Y/n] n
Abort.
此包从未被删除,我认为也不需要删除。我怎样才能apt-get
停止尝试删除它?
编辑:
输出sudo apt-get -y upgrade
:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be REMOVED:
linux-image-extra-3.13.0-61-generic
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 152 MB disk space will be freed.
(Reading database ... 35514 files and directories currently installed.)
Removing linux-image-extra-3.13.0-61-generic (3.13.0-61.100) ...
depmod: FATAL: could not load /boot/System.map-3.13.0-61-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-61-generic /boot/vmlinuz-3.13.0-61-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-61-generic /boot/vmlinuz-3.13.0-61-generic
update-initramfs: Generating /boot/initrd.img-3.13.0-61-generic
grep: /boot/config-3.13.0-61-generic: No such file or directory
WARNING: missing /lib/modules/3.13.0-61-generic
Device driver support needs thus be built-in linux image!
depmod: ERROR: could not open directory /lib/modules/3.13.0-61-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
E: /usr/share/initramfs-tools/hooks/fixrtc failed with return 1.
update-initramfs: failed for /boot/initrd.img-3.13.0-61-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-3.13.0-61-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-extra-3.13.0-61-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
编辑2:
下载了 linux-image-3.13.0-61-generic 的 64 位软件包并尝试使用以下命令进行安装sudo dpkg -i linux-image-3.13.0-61-generic_3.13.0-61.100_amd64.deb
:
(Reading database ... 40337 files and directories currently installed.)
Preparing to unpack linux-image-3.13.0-61-generic_3.13.0-61.100_amd64.deb ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
Done.
Unpacking linux-image-3.13.0-61-generic (3.13.0-61.100) over (3.13.0-61.100) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-61-generic /boot/vmlinuz-3.13.0-61-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-61-generic /boot/vmlinuz-3.13.0-61-generic
Setting up linux-image-3.13.0-61-generic (3.13.0-61.100) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
The link /initrd.img is a dangling linkto /boot/initrd.img-3.13.0-61-generic
vmlinuz(/boot/vmlinuz-3.13.0-61-generic
) points to /boot/vmlinuz-3.13.0-61-generic
(/boot/vmlinuz-3.13.0-61-generic) -- doing nothing at /var/lib/dpkg/info/linux-image-3.13.0-61-generic.postinst line 491.
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-61-generic /boot/vmlinuz-3.13.0-61-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-61-generic /boot/vmlinuz-3.13.0-61-generic
update-initramfs: Generating /boot/initrd.img-3.13.0-61-generic
E: /usr/share/initramfs-tools/hooks/fixrtc failed with return 1.
update-initramfs: failed for /boot/initrd.img-3.13.0-61-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-3.13.0-61-generic.postinst line 1025.
dpkg: error processing package linux-image-3.13.0-61-generic (--install):
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
linux-image-3.13.0-61-generic
答案1
我能够通过删除状态/var/lib/dpkg/status
为半安装的条目来解决这个问题。
答案2
运行以下命令并发布任何错误:
编辑
sudo apt-get clean
sudo rm /var/cache/apt/archives/partial/*
sudo dpkg --clear-selections
sudo apt-get install --reinstall linux-image-extra-3.13.0-61-generic linux-image-3.13.0-61-generic
编辑#2
好的,对于错误(E: /usr/share/initramfs-tools/hooks/fixrtc
),首先尝试将此文件设置为可执行文件,然后重试安装:
sudo chmod -x /usr/share/initramfs-tools/hooks/fixrtc
sudo apt-get clean
sudo apt-get update
sudo apt-get install --reinstall linux-image-extra-3.13.0-61-generic linux-image-3.13.0-61-generic