由于多个 linux-images 导致 apt-get install 出现问题?

由于多个 linux-images 导致 apt-get install 出现问题?

因此我尝试安装 python-numpy,但是出现了这个错误:

masonscott@amory:~/Workspace/research/nsf-cogneuro-feb11$ sudo apt-get install python-numpy
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-numpy is already the newest version.
The following packages were automatically installed and are no longer required:
  linux-headers-generic-lts-wily thermald
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  linux-image-4.2.0-27-generic linux-image-4.2.0-34-generic
  linux-image-extra-4.2.0-27-generic linux-image-extra-4.2.0-34-generic
0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
4 not fully installed or removed.
After this operation, 423 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 202179 files and directories currently installed.)
Removing linux-image-extra-4.2.0-27-generic (4.2.0-27.32~14.04.1) ...
depmod: FATAL: could not load /boot/System.map-4.2.0-27-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.2.0-27-generic /boot/vmlinuz-4.2.0-27-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.2.0-27-generic /boot/vmlinuz-4.2.0-27-generic
Error! Your kernel headers for kernel 4.2.0-27-generic cannot be found.
Please install the linux-headers-4.2.0-27-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.2.0-27-generic /boot/vmlinuz-4.2.0-27-generic
update-initramfs: Generating /boot/initrd.img-4.2.0-27-generic
grep: /boot/config-4.2.0-27-generic: No such file or directory
WARNING: missing /lib/modules/4.2.0-27-generic
Device driver support needs thus be built-in linux image!
depmod: ERROR: could not open directory /lib/modules/4.2.0-27-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_W3v9Np/lib/modules/4.2.0-27-generic/modules.order: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_W3v9Np/lib/modules/4.2.0-27-generic/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.2.0-27-generic /boot/vmlinuz-4.2.0-27-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.2.0-27-generic /boot/vmlinuz-4.2.0-27-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.2.0-27-generic /boot/vmlinuz-4.2.0-27-generic
/usr/sbin/grub-mkconfig: 2: /etc/default/grub: Debian: not found
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-extra-4.2.0-27-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-4.2.0-27-generic (4.2.0-27.32~14.04.1) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.2.0-27-generic /boot/vmlinuz-4.2.0-27-generic
update-initramfs: Deleting /boot/initrd.img-4.2.0-27-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.2.0-27-generic /boot/vmlinuz-4.2.0-27-generic
/usr/sbin/grub-mkconfig: 2: /etc/default/grub: Debian: not found
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.2.0-27-generic.postrm line 328.
dpkg: error processing package linux-image-4.2.0-27-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.2.0-34-generic (4.2.0-34.39~14.04.1) ...
depmod: FATAL: could not load /boot/System.map-4.2.0-34-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.2.0-34-generic /boot/vmlinuz-4.2.0-34-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.2.0-34-generic /boot/vmlinuz-4.2.0-34-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.2.0-34-generic /boot/vmlinuz-4.2.0-34-generic
update-initramfs: Generating /boot/initrd.img-4.2.0-34-generic
grep: /boot/config-4.2.0-34-generic: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_dC3KKx/lib/modules/4.2.0-34-generic/modules.order: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_dC3KKx/lib/modules/4.2.0-34-generic/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.2.0-34-generic /boot/vmlinuz-4.2.0-34-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.2.0-34-generic /boot/vmlinuz-4.2.0-34-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.2.0-34-generic /boot/vmlinuz-4.2.0-34-generic
/usr/sbin/grub-mkconfig: 2: /etc/default/grub: Debian: not found
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-extra-4.2.0-34-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-4.2.0-34-generic (4.2.0-34.39~14.04.1) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.2.0-34-generic /boot/vmlinuz-4.2.0-34-generic
update-initramfs: Deleting /boot/initrd.img-4.2.0-34-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.2.0-34-generic /boot/vmlinuz-4.2.0-34-generic
/usr/sbin/grub-mkconfig: 2: /etc/default/grub: Debian: not found
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.2.0-34-generic.postrm line 328.
dpkg: error processing package linux-image-4.2.0-34-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 linux-image-extra-4.2.0-27-generic
 linux-image-4.2.0-27-generic
 linux-image-extra-4.2.0-34-generic
 linux-image-4.2.0-34-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
masonscott@amory:~/Workspace/research/nsf-cogneuro-feb11$ 

因此,出于某种原因,我似乎安装了 27 和 34 张图片

以及输出

uname -r

4.2.0-30-generic

错误消息中缺少的所有内容,如 /boot/System.map-4.2.0-... 已正确安装在 4.2.0-30 中,所以我不知道该怎么做

尝试使用以下方法删除旧磁盘映像后

sudo dpkg --purge ...

我收到此错误:

masonscott@amory:~$ sudo dpkg --purge linux-image-4.2.0-27-generic
(Reading database ... 202179 files and directories currently installed.)
Removing linux-image-4.2.0-27-generic (4.2.0-27.32~14.04.1) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.2.0-27-generic /boot/vmlinuz-4.2.0-27-generic
update-initramfs: Deleting /boot/initrd.img-4.2.0-27-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.2.0-27-generic /boot/vmlinuz-4.2.0-27-generic
/usr/sbin/grub-mkconfig: 2: /etc/default/grub: Debian: not found
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.2.0-27-generic.postrm line 328.
dpkg: error processing package linux-image-4.2.0-27-generic (--purge):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-4.2.0-27-generic

这可能存在什么问题?

答案1

是的,看起来你有太多图像“已达到 MaxReports”

您需要删除一些内核。

警告:删除内核包可能很危险,甚至可能导致系统无法启动。

首先检查你使用的内核:

uname -r

不要删除这个内核!

列出所有安装的内核:

dpkg -l | tail -n +6 | grep -E 'linux-image-[0-9]+' | grep -Fv $(uname -r)

现在删除正确的旧内核(如果可能的话保留备份)

sudo dpkg --purge linux-image-4.2.0-15-generic

镜像与旧内核匹配的位置

然后更新并升级

sudo apt-get update && sudo apt-get upgrade 

接下来检查您是否拥有当前内核

sudo apt-get install dist-upgrade 

替代方法:

另一种选择是 Synaptic

sudo apt-get install synaptic

安装并运行程序后,搜索:

linux-image

右键单击内核并选择完全删除,最后单击应用按钮删除该内核。

重复搜索,但这次针对 linux-header - 您可以删除先前选择的内核映像的相关标头。

但是 Synaptic 不会尝试验证您要删除的内容……您可能会无意中删除最新的内核 - 甚至通过此工具删除所有内核,导致 Ubuntu 无法启动!

相关内容