Ubuntu 16.04 “Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(0,0)”

转自:https://thomasmodeneis.wordpress.com/2017/05/12/how-to-restore-ubuntu-16-04-kernel-panic-not-syncing-vfs-unable-to-mount-root-fs-on-unknown-block00/

How to restore Ubuntu 16.04 “Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(0,0)”

Today one of the guys on my development team ran into an old problem on Linux, the good and old Kernel panic …  This time it was after updating Ubuntu 16.04 internals.

After doing the reboot, there it was, the old good linux scaring n00bies away:

Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

Screenshot_20170512_144757

This is an old problem and usually, depending on the tooling you have around it, it can be quite time-consuming to figure a way out if you are not experienced on Linux.

The problem originated because he installed updates on Ubuntu, one after another during many months of usage, until a day … nothing special, he updated once again and boom!!! The updates caused the /boot partition to be left with no space, and this caused the grub to be blocked when trying to mount the root fs. The solution is simple: just to remove the old kernel images and run a quick cleanup.

I believe if a piece of software or program is not clear enough for an average person to understand and solve, than its broken and it should be properly fixed or at least documented until it can be fixed permanently.

 

[SOLVED] kernel panic-not syncing:

Start your Ubuntu with shift pressed until you see the recover screen, choose recovery mode:

boot-to-ubuntu-recovery-mode.png.pagespeed.ce.CUNCHGQyPh (1)

Cleaning up Boot partition on Ubuntu 16.04

When on Rescue Mode, select the option clean followed by dpkg, grub and fsck.

boot-to-ubuntu-recovery-mode.png.pagespeed.ce.CUNCHGQyPh

This will make sure that the space on your boot partition is free, will repair any broken packages, check all file systems and that they are correct and update your grub bootloader.

After this, you are very likely to get a stable Ubuntu 16.04 back.

 

 

The command line way to clean up /boot partition:

 

It can be that you open your computer, and it will boot normally, but Ubuntu will complain that the boot partition is almost full, in this case you can execute the auto-remove:

 

$ sudo apt-get autoremove --purge
[sudo] password for ninja: 
Reading package lists... Done
Building dependency tree 
Reading state information... Done
The following packages will be REMOVED:
 linux-headers-4.4.0-79 linux-headers-4.4.0-79-generic linux-headers-4.4.0-81
 linux-headers-4.4.0-81-generic linux-headers-4.8.0-49
 linux-headers-4.8.0-49-generic linux-headers-4.8.0-51
 linux-headers-4.8.0-51-generic linux-headers-4.8.0-52
 linux-headers-4.8.0-52-generic linux-headers-4.8.0-54
 linux-headers-4.8.0-54-generic linux-image-4.4.0-79-generic
 linux-image-4.4.0-81-generic linux-image-4.8.0-49-generic
 linux-image-4.8.0-51-generic linux-image-4.8.0-52-generic
 linux-image-4.8.0-54-generic linux-image-extra-4.4.0-79-generic
 linux-image-extra-4.4.0-81-generic linux-image-extra-4.8.0-49-generic
 linux-image-extra-4.8.0-51-generic linux-image-extra-4.8.0-52-generic
 linux-image-extra-4.8.0-54-generic
0 upgraded, 0 newly installed, 24 to remove and 93 not upgraded.
9 not fully installed or removed.
After this operation, 1854 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 497711 files and directories currently installed.)
Removing linux-headers-4.4.0-79-generic (4.4.0-79.100) ...
Removing linux-headers-4.4.0-79 (4.4.0-79.100) ...
Removing linux-headers-4.4.0-81-generic (4.4.0-81.104) ...
Removing linux-headers-4.4.0-81 (4.4.0-81.104) ...
Removing linux-headers-4.8.0-49-generic (4.8.0-49.52~16.04.1) ...
Removing linux-headers-4.8.0-49 (4.8.0-49.52~16.04.1) ...
Removing linux-headers-4.8.0-51-generic (4.8.0-51.54~16.04.1) ...
Removing linux-headers-4.8.0-51 (4.8.0-51.54~16.04.1) ...
Removing linux-headers-4.8.0-52-generic (4.8.0-52.55~16.04.1) ...
Removing linux-headers-4.8.0-52 (4.8.0-52.55~16.04.1) ...
Removing linux-headers-4.8.0-54-generic (4.8.0-54.57~16.04.1) ...
Removing linux-headers-4.8.0-54 (4.8.0-54.57~16.04.1) ...
Removing linux-image-extra-4.4.0-79-generic (4.4.0-79.100) ...
(...)
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.8.0-58-generic
Found initrd image: /boot/initrd.img-4.8.0-58-generic
Found linux image: /boot/vmlinuz-4.8.0-56-generic
Found initrd image: /boot/initrd.img-4.8.0-56-generic
Found linux image: /boot/vmlinuz-4.4.0-83-generic
Found initrd image: /boot/initrd.img-4.4.0-83-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
done
Setting up linux-image-generic-hwe-16.04 (4.8.0.58.29) ...
Setting up linux-generic-hwe-16.04 (4.8.0.58.29) ...
Setting up linux-image-extra-virtual (4.4.0.83.89) ...
ninja@ninja:~$ sudo apt-get autoremove --purge
Reading package lists... Done
Building dependency tree 
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 93 not upgraded.

 

Then finally you can update GRUB kernel list:

$ sudo update-grub
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.8.0-58-generic
Found initrd image: /boot/initrd.img-4.8.0-58-generic
Found linux image: /boot/vmlinuz-4.8.0-56-generic
Found initrd image: /boot/initrd.img-4.8.0-56-generic
Found linux image: /boot/vmlinuz-4.4.0-83-generic
Found initrd image: /boot/initrd.img-4.4.0-83-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
done

 

 

Check the partition sizes with ncdu:

If you dont have it, then install with:

$ sudo apt-get install ncdu

Alternatively you can:

check the partition sizes with lsblk:

$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop1 7:1 0 88,1M 1 loop /snap/conjure-up/518
loop4 7:4 0 79,5M 1 loop /snap/core/2312
loop2 7:2 0 88,1M 1 loop /snap/conjure-up/527
loop0 7:0 0 79,5M 0 loop /snap/core/1689
nvme0n1 259:0 0 477G 0 disk 
├─nvme0n1p5 259:3 0 476,5G 0 part 
│ └─nvme0n1p5_crypt 253:0 0 476,5G 0 crypt 
│ ├─ubuntu--vg-root 253:1 0 460,9G 0 lvm /
│ └─ubuntu--vg-swap_1 253:2 0 15,6G 0 lvm 
│ └─cryptswap1 253:3 0 15,6G 0 crypt [SWAP]
├─nvme0n1p1 259:1 0 487M 0 part /boot
└─nvme0n1p2 259:2 0 1K 0 part 
loop5 7:5 0 78,4M 0 loop /snap/core/1577
loop3 7:3 0 88,2M 1 loop /snap/conjure-up/510

 

Or you can also:

Check the partition sizes with baobab:

$ sudo baobab

 

Now just restart the Ubuntu and it should be as good as before! ?

 

Ubuntu-is-a-operating-system1

Happy Open Source coding to everyone.

Advertisements

  • 12
    点赞
  • 38
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
Kernel panic - not syncing: Attempted to kill init!是一种严重的内核错误,表示内核无法继续正常运行并试图终止init进程。修复这个问题的步骤如下: 1. 首先,尝试重启系统。如果问题仍然存在,进入控制台查看错误信息。\[1\] 2. 如果重启后仍然出现相同的错误,可以尝试进入单用户模式进行排查。在控制台重启后,按下任意键,然后按下"e"键。使用上下箭头选择第二个选项,再次按下"e"键。在末尾添加"1",然后按下Enter键,最后按下"b"键进入单用户模式。然而,如果单用户模式也无法进入并且错误仍然存在,需要尝试其他方法。\[2\] 3. 下一步是进入救援模式。挂载镜像并从光盘启动系统。按下上下箭头选择救援模式启动。进入救援模式后,使用chroot命令切换到根目录环境下,执行以下命令:chroot /mnt/sysimage。\[3\] 以上是修复Kernel panic - not syncing: Attempted to kill init!故障的一般步骤。然而,具体的修复方法可能因系统环境和具体情况而异。建议在进行修复之前,先备份重要数据,并参考相关文档或咨询专业人士以获取更准确的指导。 #### 引用[.reference_title] - *1* *2* *3* [Kernel panic – not syncing: Attempted to kill init!故障修复](https://blog.csdn.net/weixin_43770382/article/details/107686813)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值