ubuntu 14.04 中升级内核的问题

ubuntu 14.04 中升级内核的问题

我在更新运行 Ubuntu 14.04 的内核(内核为 4.4.0-45-generic)时遇到了问题。当我运行apt-get update后跟 时apt-get upgrade,我的 /boot 驱动器空间不足。我查看 /boot 发现它已安装了 initrd.img-3.19.0-64-generic 到 initrd.img-3.19.0-73-generic,这似乎没有必要。

根据 /boot 中的其他文件和我现在运行的内核,我认为我应该使用 initrd.img-4.4.0-57-generic。因此,我不确定为什么upgrade要安装所有这些不必要的 initrd.img(它不会为较旧的内核安装任何其他文件)。

按照多处关于如何清理 /boot 的建议,我手动删除了较旧的 initrd.img 文件并重新运行apt-get upgrade。它再次下载并安装相同的 initrd 包,空间不足,并失败。我该如何修复apt upgrade?如何防止它安装旧内核?任何帮助都将不胜感激。如果有用,以下是 的完整输出apt-get upgrade

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  linux-generic-lts-vivid linux-generic-lts-xenial
  linux-headers-generic-lts-vivid linux-headers-generic-lts-xenial
  linux-image-generic-lts-vivid linux-image-generic-lts-xenial
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
10 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up initramfs-tools (0.103ubuntu4.6) ...
update-initramfs: deferring update (trigger activated)
Setting up linux-image-3.19.0-78-generic (3.19.0-78.86~14.04.1) ...
Internal Error: Could not find image (/boot/vmlinuz-3.19.0-78-generic)
dpkg: error processing package linux-image-3.19.0-78-generic (--configure):
subprocess installed post-installation script returned error exit status 2
Setting up linux-firmware (1.127.23) ...
update-initramfs: Generating /boot/initrd.img-4.4.0-45-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-42-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-38-generic
grep: /boot/config-4.4.0-38-generic: No such file or directory
update-initramfs: Generating /boot/initrd.img-3.19.0-73-generic
grep: /boot/config-3.19.0-73-generic: No such file or directory
update-initramfs: Generating /boot/initrd.img-3.19.0-71-generic
grep: /boot/config-3.19.0-71-generic: No such file or directory
update-initramfs: Generating /boot/initrd.img-3.19.0-69-generic
grep: /boot/config-3.19.0-69-generic: No such file or directory
update-initramfs: Generating /boot/initrd.img-3.19.0-66-generic
grep: /boot/config-3.19.0-66-generic: No such file or directory
update-initramfs: Generating /boot/initrd.img-3.19.0-65-generic
grep: /boot/config-3.19.0-65-generic: No such file or directory
update-initramfs: Generating /boot/initrd.img-3.19.0-64-generic
grep: /boot/config-3.19.0-64-generic: No such file or directory
update-initramfs: Generating /boot/initrd.img-3.19.0-61-generic
grep: /boot/config-3.19.0-61-generic: No such file or directory

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-3.19.0-61-generic with 1.
dpkg: error processing package linux-firmware (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of linux-image-extra-3.19.0-78-generic:
 linux-image-extra-3.19.0-78-generic depends on linux-image-3.19.0-78-generic; however:
  Package linux-image-3.19.0-78-generic is not configured yet.

dpkg: error processing package linux-image-extra-3.19.0-78-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image-generic-lts-vivid:
 linux-image-generic-lts-vivid depends on linux-image-3.19.0-78-generic; however:
  Package linux-image-3.19.0-78-generic is not configured yet.
 linux-image-generic-lts-vivid depends on linux-image-extra-3.19.0-78-generic; however:
  Package linux-image-extra-3.19.0-78-generic is not configured yet.
 linux-image-generic-lts-vivid depends on linux-firmware; however:
  Package linux-firmware is not configured yet.

dpkg: error processing package linux-image-generic-lts-vivid (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problNo apport report written because the error message indicates its a followup error from a previous failure.
                   No apport report written because MaxReports is reached already
                                                                                 No apport report written because MaxReports is reached already
                                      ems prevent configuration of linux-generic-lts-vivid:
 linux-generic-lts-vivid depends on linux-image-generic-lts-vivid (= 3.19.0.78.60); however:
  Package linux-image-generic-lts-vivid is not configured yet.

dpkg: error processing package linux-generic-lts-vivid (--configure):
 dependency problems - leaving unconfigured
Setting up linux-image-4.4.0-57-generic (4.4.0-57.78~14.04.1) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
The link /initrd.img is a dangling linkto /boot/initrd.img-4.4.0-57-generic
vmlinuz(/boot/vmlinuz-4.4.0-57-generic
) points to /boot/vmlinuz-4.4.0-57-generic
 (/boot/vmlinuz-4.4.0-57-generic) -- doing nothing at     /var/lib/dpkg/info/linux-image-4.4.0-57-generic.postinst line 491.
Examining /etc/kernel/postinst.d.
    run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-57-generic /boot/vmlinuz-4.4.0-57-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-57-generic /boot/vmlinuz-4.4.0-57-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-57-generic /boot/vmlinuz-4.4.0-57-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-57-generic

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.4.0-57-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-4.4.0-57-generic.postinst line 1052.
dpkg: error processing package linux-image-4.4.0-57-generic (--configure):
 subprocess installed post-installation script returned error exit status 2
No apport report written because MaxReports is reached already
                                                          dpkg: dependency problems prevent configuration of linux-image-extra-4.4.0-57-generic:
 linux-image-extra-4.4.0-57-generic depends on linux-image-4.4.0-57-generic; however:
  Package linux-image-4.4.0-57-generic is not configured yet.

dpkg: error processing package linux-image-extra-4.4.0-57-generic (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                          No apport report written because MaxReports is reached already
               dpkg: dependency problems prevent configuration of linux-image-generic-lts-xenial:
 linux-image-generic-lts-xenial depends on linux-image-4.4.0-57-generic; however:
  Package linux-image-4.4.0-57-generic is not configured yet.
 linux-image-generic-lts-xenial depends on linux-image-extra-4.4.0-57-generic; however:
  Package linux-image-extra-4.4.0-57-generic is not configured yet.
 linux-image-generic-lts-xenial depends on linux-firmware; however:
  Package linux-firmware is not configured yet.

dpkg: error processing package linux-image-generic-lts-xenial (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic-lts-xenial:
 linux-generic-lts-xenial depends on linux-image-generic-lts-xenial (= 4.4.0.57.44); however:
  Package linux-image-generic-lts-xenial is not configured yet.

dpkg: error processing package linux-generic-lts-xenial (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                          Processing triggers for initramfs-tools (0.103ubuntu4.6) ...
update-initramfs: Generating /boot/initrd.img-4.4.0-45-generic

 gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.4.0-45-generic with 1.
dpkg: error processing package initramfs-tools (--configure):
 subprocess installed post-installation script returned error exit status 1
No apport report written because MaxReports is reached already
                                                          Errors were encountered while processing:
 linux-image-3.19.0-78-generic
 linux-firmware
 linux-image-extra-3.19.0-78-generic
 linux-image-generic-lts-vivid
 linux-generic-lts-vivid
 linux-image-4.4.0-57-generic
 linux-image-extra-4.4.0-57-generic
 linux-image-generic-lts-xenial
 linux-generic-lts-xenial
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

EDIT1:我尝试按照说明删除旧内核这里

失败并显示错误消息:

Errors were encountered while processing:
 linux-image-extra-3.19.0-64-generic
 linux-image-extra-3.19.0-65-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:

然后我发现非常相似的问题这可能与我所经历的相同或相似。手动删除所有linux-image-3.19.*内容/var/lib/dpkg/info/是一种选择吗?我想象不是,但我不知道还能做什么。

答案1

尝试这个:

打开终端,

Ctrl++AltT

运行:

sudo -i
dpkg --configure -a
apt-get update
apt-get -f install
OLDCONF=$(dpkg -l|grep “^rc”|awk ‘{print $2}’)
CURKERNEL=$(uname -r|sed ‘s/-*[a-z]//g’|sed ‘s/-386//g’)
LINUXPKG=”linux-(image|headers|ubuntu-modules|restricted-modules)”
METALINUXPKG=”linux-(image|headers|restricted-modules)-(generic|i386|server|common|rt|xen)”
OLDKERNELS=$(dpkg -l|awk ‘{print $2}’|grep -E $LINUXPKG |grep -vE $METALINUXPKG|grep -v $CURKERNEL)
apt-get clean
apt-get purge $OLDCONF
apt-get purge $OLDKERNELS
apt-get autoremove
apt-get dist-upgrade
apt-get clean

答案2

我通过使用 synaptic 删除旧内核解决了这个问题,如下所述这里。删除过程失败了几次,因为initrd.img-x.xx.x-xx-generic.old-dkms每个被删除的内核都创建了一个文件,这导致我的/boot分区空间不足。我手动删除了这些文件以释放空间,然后重新开始删除。现在所有更新和升级似乎都运行正常。

相关内容