linux 16.06更新内核,解决Ubuntu 16.04更新系统内核出错后的问题

大伟哥的工作电脑使用Ubuntu 16.04系统,已经很久没有更新了,今天正好有空,就运行了sudo apt update, sudo apt upgrade让它在后台自已更新去了。

因为要更新的软件比较多,需要花费挺长时间,大伟哥也没怎么在意,只是在运行结束后看了一下报错,上面显示因为boot分区空间不够,升级linux内核的时候出错了:

在处理时有错误发生:

linux-image-extra-4.4.0-97-generic

linux-image-generic

linux-generic

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

之前也发生了同样的问题,系统提示可以运行sudo apt-get autoremove清除不需要的依赖的,而多次升级后/boot分区里已经有了多个之前版本的Linux内核,因此大伟哥决定先运行一下这个命令,看能不能自动给/boot分区清理出一部分空间来,这样也省得我再查文档手动清除旧的内核文件了。实验证明这个命令真的有效果,/boot分区清理出了100多M的空间,应该也够安装新的内核了。

再次执行sudo apt update/sudo apt upgrade, 系统并没有接着安装上次没有完成安装的内核,而是报错如下:

davidbro@Workstation:~$ sudo apt upgrade

正在读取软件包列表... 完成

正在分析软件包的依赖关系树

正在读取状态信息... 完成

正在计算更新... 完成

有一些软件包无法被安装。如果您用的是 unstable 发行版,这也许是

因为系统无法达到您要求的状态造成的。该版本中可能会有一些您需要的软件

包尚未被创建或是它们已被从新到(Incoming)目录移出。

下列信息可能会对解决问题有所帮助:

下列软件包有未满足的依赖关系:

linux-image-extra-4.4.0-96-generic : 依赖: linux-image-4.4.0-96-generic 但是它将不会被安装

E: 破损的软件包

试一下sudo apt install命令看看不能能安装:

david@KingChef-Workstation:~$ sudo apt-get install

正在读取软件包列表... 完成

正在分析软件包的依赖关系树

正在读取状态信息... 完成

下列软件包将被【卸载】:

linux-image-extra-4.4.0-96-generic

升级了 0 个软件包,新安装了 0 个软件包,要卸载 1 个软件包,有 0 个软件包未被升级。

有 5 个软件包没有被完全安装或卸载。

解压缩后将会空出 153 MB 的空间。

您希望继续执行吗? [Y/n] Y

(正在读取数据库 ... 系统当前共安装有 356556 个文件和目录。)

正在卸载 linux-image-extra-4.4.0-96-generic (4.4.0-96.119) ...

depmod: FATAL: could not load /boot/System.map-4.4.0-96-generic: No such file or directory

run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic

run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic

Error! Your kernel headers for kernel 4.4.0-96-generic cannot be found.

Please install the linux-headers-4.4.0-96-generic package,

or use the --kernelsourcedir option to tell DKMS where it's located

Error! Your kernel headers for kernel 4.4.0-96-generic cannot be found.

Please install the linux-headers-4.4.0-96-generic package,

or use the --kernelsourcedir option to tell DKMS where it's located

run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic

update-initramfs: Generating /boot/initrd.img-4.4.0-96-generic

WARNING: missing /lib/modules/4.4.0-96-generic

Ensure all necessary drivers are built into the linux image!

depmod: ERROR: could not open directory /lib/modules/4.4.0-96-generic: No such file or directory

depmod: FATAL: could not search modules: No such file or directory

depmod: WARNING: could not open /var/tmp/mkinitramfs_pkdOqR/lib/modules/4.4.0-96-generic/modules.order: No such file or directory

depmod: WARNING: could not open /var/tmp/mkinitramfs_pkdOqR/lib/modules/4.4.0-96-generic/modules.builtin: No such file or directory

run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic

run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic

run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic

run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic

Generating grub configuration file ...

Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.

Found linux image: /boot/vmlinuz-4.4.0-130-generic

Found initrd image: /boot/initrd.img-4.4.0-130-generic

Found linux image: /boot/vmlinuz-4.4.0-98-generic

Found initrd image: /boot/initrd.img-4.4.0-98-generic

Found linux image: /boot/vmlinuz-3.5.0-54-generic

Found initrd image: /boot/initrd.img-3.5.0-54-generic

Found linux image: /boot/vmlinuz-3.5.0-23-generic

Found initrd image: /boot/initrd.img-3.5.0-23-generic

done

正在设置 initramfs-tools (0.122ubuntu8.11) ...

update-initramfs: deferring update (trigger activated)

正在设置 linux-image-extra-4.4.0-130-generic (4.4.0-130.156) ...

run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-130-generic /boot/vmlinuz-4.4.0-130-generic

run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-130-generic /boot/vmlinuz-4.4.0-130-generic

ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/i915-4.6.3-4.4.0-dkms.0.crash'

Error! Bad return status for module build on kernel: 4.4.0-130-generic (x86_64)

Consult /var/lib/dkms/i915-4.6.3-4.4.0/1/build/make.log for more information.

run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-130-generic /boot/vmlinuz-4.4.0-130-generic

update-initramfs: Generating /boot/initrd.img-4.4.0-130-generic

run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-130-generic /boot/vmlinuz-4.4.0-130-generic

run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-130-generic /boot/vmlinuz-4.4.0-130-generic

run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-130-generic /boot/vmlinuz-4.4.0-130-generic

run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-130-generic /boot/vmlinuz-4.4.0-130-generic

Generating grub configuration file ...

Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.

Found linux image: /boot/vmlinuz-4.4.0-130-generic

Found initrd image: /boot/initrd.img-4.4.0-130-generic

Found linux image: /boot/vmlinuz-4.4.0-98-generic

Found initrd image: /boot/initrd.img-4.4.0-98-generic

Found linux image: /boot/vmlinuz-3.5.0-54-generic

Found initrd image: /boot/initrd.img-3.5.0-54-generic

Found linux image: /boot/vmlinuz-3.5.0-23-generic

Found initrd image: /boot/initrd.img-3.5.0-23-generic

done

正在设置 linux-image-generic (4.4.0.130.136) ...

正在设置 linux-generic (4.4.0.130.136) ...

正在处理用于 initramfs-tools (0.122ubuntu8.11) 的触发器 ...

update-initramfs: Generating /boot/initrd.img-4.4.0-130-generic

这样最新的内核版本4.4.0.130.136就安装好了。其实我觉得这样用autoremove腾出分区空间还是有点风险的,有可能会误删掉其他有用的软件。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值