Ubuntu16.04在apt-get时遇到initramfs-tools错误

Ubuntu16.04在apt-get时遇到initramfs-tools错误,错误描述如下:

yanbin@laptop:~$ sudo apt-get install -f
[sudo] password for yanbin: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up initramfs-tools (0.122ubuntu8.13) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.122ubuntu8.13) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-39-generic
W: Possible missing firmware /lib/firmware/i915/kbl_guc_ver9_14.bin for module i915
W: Possible missing firmware /lib/firmware/i915/bxt_guc_ver8_7.bin for module i915

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.15.0-39-generic with 1.
dpkg: error processing package initramfs-tools (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

解决步骤:

  1. uname -r 查询当前的内核版本号

我的内核版本号为4.15.0-39-generic

  1. cd进入/boot目录下,输入命令dpkg --get-selections | grep linux
yanbin@laptop:/boot$ dpkg  --get-selections | grep linux
console-setup-linux             install
libselinux1:amd64               install
linux-base                  install
linux-firmware                  install
linux-generic-hwe-16.04             install
linux-headers-4.15.0-29             install
linux-headers-4.15.0-29-generic         install
linux-headers-4.15.0-39             install
linux-headers-4.15.0-39-generic         install
linux-headers-generic-hwe-16.04         install
linux-image-4.15.0-29-generic           install
linux-image-4.15.0-39-generic           install
linux-image-generic-hwe-16.04           install
linux-libc-dev:amd64                install
linux-modules-4.15.0-29-generic         install
linux-modules-4.15.0-39-generic         install
linux-modules-extra-4.15.0-29-generic       install
linux-modules-extra-4.15.0-39-generic       install
linux-sound-base                install
pptp-linux                  install
syslinux                    install
syslinux-common                 install
syslinux-legacy                 install
util-linux                  install
  1. 删除所有旧版本, sudo apt-get purge linux-modules-4.15.0-29-generic,比如我删除所有的29版本
  2. 删除之后,输入命令ls -l,结果如下
yanbin@laptop:/boot$ ls -l
total 67380
-rw-r--r-- 1 root root  1537997 10月 25 04:07 abi-4.15.0-39-generic
-rw-r--r-- 1 root root   217026 10月 25 04:07 config-4.15.0-39-generic
drwxr-xr-x 5 root root     1024 11月 21 20:52 grub
-rw-r--r-- 1 root root 54504002 11月 21 20:52 initrd.img-4.15.0-39-generic
drwx------ 2 root root    12288 11月 21  2018 lost+found
-rw-r--r-- 1 root root   182704 1月  28  2016 memtest86+.bin
-rw-r--r-- 1 root root   184380 1月  28  2016 memtest86+.elf
-rw-r--r-- 1 root root   184840 1月  28  2016 memtest86+_multiboot.bin
-rw-r--r-- 1 root root        0 10月 25 04:07 retpoline-4.15.0-39-generic
-rw------- 1 root root  4046310 10月 25 04:07 System.map-4.15.0-39-generic
-rw------- 1 root root  8121560 10月 25 18:43 vmlinuz-4.15.0-39-generic

你可能感兴趣的:(Ubuntu16.04在apt-get时遇到initramfs-tools错误)