initramfs-tools出错的解决方案

Ubuntu从12.04升级到12.10的过程中报错,提示无法安装“initramfs-tools”,继续安装成功后使用sudo apt-get update和sudo apt-get upgrade更新时也会报错,错误见下方。网上搜索出解决方法:

转载:http://futureis404.info/archives/1512.html

解决了一个困扰多时的问题,ubuntu在使用apt-get install -f 命令时,总是提示:

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

用df -h命令可以看到boot空间已满

解决办法(删掉多余的内核)

查看内核命令:

dpkg –get-selections|grep linux

删除多余的内核:

sudo apt-get remove linux-image-<版本号>(就是上面带image的版本)

出现卸载不完全时,用以下命令:

sudo apt-get autoremove