ubuntu 系统/boot 内存不够无法更新(apt-get update)

输入命令:sudo apt-get install 

报错:

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.15.0-72-generic with 1.
dpkg: 处理软件包 initramfs-tools (--configure)时出错:
子进程 已安装 post-installation 脚本 返回错误状态 1
在处理时有错误发生:
linux-firmware
initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

原因:/boot内存不够,

输入命令查看linux内存:df -h

看到只有28M可用。

到/boot目录下可以看到以下几个文件:这些与系统内核有关

 

输入命令:dpkg --get-selections|grep linux

以上为查看内核情况,表示有两个版本被安装,4.15.0-45和4.15.0-72

查看使用的是哪个版本的系统,输入命令:uname -a

 可以将与4.15.0-45有关的删除,即4.15.0-72以前的版本删除

解决:

采用sudo apt-get purge删除

输入命令:sudo apt-get purge linux-modules-4.15.0-45-generic

sudo apt-get purge linux-image-4.15.0-45-generic

sudo apt-get purge linux-headers-4.15.0-45

  再查看一下:dpkg --get-selections|grep linux

 内存:df -h

 

 

 

原文地址:https://www.cnblogs.com/Lee-yl/p/12108255.html