意外删除了当前内核

意外删除了当前内核

我很愚蠢,在尝试释放 /boot 上的空间时,我认为我意外删除了我当前的内核。

事情经过:

>>uname -i
linux-image-extra-4.4.0-24-generic

现在 uname -i 仅提供:

x86_64

我已经尝试在启动时释放更多空间: sudo apt-get autoclean sudo apt-get clean sudo apt-get autoremove

仍有 0 个可用空间。

ls -l \boot 给出:

-rw-r--r-- 1 root root  1271765 Dec 18  2015 abi-3.19.0-42-generic
-rw-r--r-- 1 root root  1312645 Mar 11 00:11 abi-4.2.0-34-generic
-rw-r--r-- 1 root root  1313029 Mar 16 00:45 abi-4.2.0-35-generic
-rw-r--r-- 1 root root  1239577 Apr 18 23:21 abi-4.4.0-21-generic
-rw-r--r-- 1 root root  1239612 May 13 00:55 abi-4.4.0-22-generic
-rw-r--r-- 1 root root  1239732 Jun  8 22:39 abi-4.4.0-24-generic
-rw-r--r-- 1 root root  1240018 Jun 24 13:03 abi-4.4.0-28-generic
-rw-r--r-- 1 root root   177800 Dec 18  2015 config-3.19.0-42-generic
-rw-r--r-- 1 root root   184888 Mar 11 00:11 config-4.2.0-34-generic
-rw-r--r-- 1 root root   184888 Mar 16 00:45 config-4.2.0-35-generic
-rw-r--r-- 1 root root   189412 Apr 18 23:21 config-4.4.0-21-generic
-rw-r--r-- 1 root root   189520 May 13 00:55 config-4.4.0-22-generic
-rw-r--r-- 1 root root   189521 Jun  8 22:39 config-4.4.0-24-generic
-rw-r--r-- 1 root root   189533 Jun 24 13:03 config-4.4.0-28-generic
drwxr-xr-x 5 root root     1024 Jun 16 13:35 grub
-rw-r--r-- 1 root root 12326390 Feb 28 20:40 initrd.img-3.19.0-42-generic
-rw-r--r-- 1 root root 12634086 May  3 18:44 initrd.img-4.2.0-34-generic
-rw-r--r-- 1 root root 12645647 May 23 23:23 initrd.img-4.2.0-35-generic
-rw-r--r-- 1 root root 37145299 May  3 18:38 initrd.img-4.4.0-21-generic
-rw-r--r-- 1 root root 37147186 May 29 12:11 initrd.img-4.4.0-22-generic
-rw-r--r-- 1 root root 37147471 Jun 16 13:35 initrd.img-4.4.0-24-generic
drwx------ 2 root root    12288 Sep 21  2015 lost+found
-rw-r--r-- 1 root root   182704 Jan 28 12:44 memtest86+.bin
-rw-r--r-- 1 root root   184380 Jan 28 12:44 memtest86+.elf
-rw-r--r-- 1 root root   184840 Jan 28 12:44 memtest86+_multiboot.bin
-rw------- 1 root root  3622861 Dec 18  2015 System.map-3.19.0-42-generic
-rw------- 1 root root  3744589 Mar 11 00:11 System.map-4.2.0-34-generic
-rw------- 1 root root  3745312 Mar 16 00:45 System.map-4.2.0-35-generic
-rw------- 1 root root  3853719 Apr 18 23:21 System.map-4.4.0-21-generic
-rw------- 1 root root  3855781 May 13 00:55 System.map-4.4.0-22-generic
-rw------- 1 root root  3855383 Jun  8 22:39 System.map-4.4.0-24-generic
-rw------- 1 root root  3859655 Jun 24 13:03 System.map-4.4.0-28-generic
-rw------- 1 root root  6625664 Dec 18  2015 vmlinuz-3.19.0-42-generic
-rw------- 1 root root  6808528 Mar 11 00:11 vmlinuz-4.2.0-34-generic
-rw------- 1 root root  6829104 Mar 16 00:45 vmlinuz-4.2.0-35-generic
-rw------- 1 root root  7013968 Apr 18 23:21 vmlinuz-4.4.0-21-generic
-rw------- 1 root root  7015440 May 13 00:55 vmlinuz-4.4.0-22-generic
-rw------- 1 root root  7020176 Jun  8 22:39 vmlinuz-4.4.0-24-generic
-rw------- 1 root root  7026864 Jun 24 13:03 vmlinuz-4.4.0-28-generic

我尝试这样做:

sudo apt-get upgrade

但它总是卡在无记忆状态。同样:

sudo apt-get install --reinstall linux-image-4.4.0-24-generic 

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED
  linux-image-extra-4.4.0-21-generic linux-image-extra-4.4.0-22-generic
0 to upgrade, 0 to newly install, 1 reinstalled, 2 to remove and 135 not to upgrade.
8 not fully installed or removed.
Need to get 0 B/18.7 MB of archives.
After this operation, 324 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 507715 files and directories currently installed.)
Removing linux-image-extra-4.4.0-21-generic (4.4.0-21.37) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-21-generic /boot/vmlinuz-4.4.0-21-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-21-generic /boot/vmlinuz-4.4.0-21-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-21-generic /boot/vmlinuz-4.4.0-21-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-21-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-21-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-21-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-22-generic (4.4.0-22.40) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-22-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-22-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-22-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-4.4.0-21-generic
 linux-image-extra-4.4.0-22-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

我不太明白为什么我的 /boot 还是满​​了。那里已经没有 Linux 头文件了。它们缓存在某个地方了吗?

任何帮助都将不胜感激。我这里没有 CD 驱动器或其他东西,所以希望我能相当简单地解决这个问题...

否则,可能需要重新安装。显然,我目前正在备份我的硬盘……

答案1

我手动删除了一些具有旧版本号的配置文件和 initrd 文件。

然后我跑了:

sudo apt-get -f install linux-header... NEW VERSION

有效!

那么可以确定的是:

sudo apt-get upgrade

答案2

尝试从可启动的 USB 棒或恢复 CD 启动,然后尝试查找问题或修复磁盘。如果您碰巧使用的是可启动的 USB,那么我建议您查看“磁盘”和“Gparted”导致的问题。之后发布发生了什么以及任何输出错误,以便社区能够提供帮助。

相关内容