# Kernel panic after booting with grub2

## mark2

I've been absent for a long time and have gotten rusty. My system messed up after some update. I have updated to kernel version 3.16.5 and can"t get it to boot my OS. I get to a grub2 cli and am having trouble making it boot so I can get in. I was having trouble with my keyboard and mouse before this latest fiasco. Actually it was with all my USB ports. So I reconfigured my kernel and now I have this problem. I set it up using genkernel and initramfs. I am also running systemd and xcfe for my desktop.

Anybody out there got any ideas? Thanks in advance for any help.

Mark

----------

## Keruskerfuerst

Please post

1. grub.cfg

2. relevant parts of kernel config

3. fdisk -l of your boot disk

----------

## Naib

What txt is Seen when the kernel panics

----------

## Roman_Gruber

You may try gentoo-sources and check out the eselect news about the past.

these days you need some certain things set in your kernel.

with the output of lspci / lsusb / lshw you could determine which modules you need and than build a kernel from scratch.

----------

## mark2

First @naib, since I go directly to the grub> prompt I use:

```
linux16 /boot/kernel-genkernel-x86_64-3.16.5-gentoo
```

Then I put:

```
set root=(hd0,3)
```

This is because I have the basic setup on my hard disk of /dev/sda1 for boot, /dev/sda2 for swap, and /dev/sda3 for everything else. Then I tell it to boot and I get (after a lot of lines scrolling) the kernel panic of:

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

And I have to reboot manually. In order to answer Keruskerfuerst, I have to boot my livecd and chroot, so I then can do:

```
fdisk -l

/dev/sda1 * 2048          67583          32768            83     Linux

/dev/sda2   67584         8456191      4194304         82     Linux swap/Solaris

/dev/sda3   8456192     488281249     239912529     83     Linux
```

But when I look in /boot/grub, I do not have a grub.cfg. There is a grub.cfg.new. I am not sure how to show "relevant parts of kernel config" (not very familiar with terminology).

For tw04l124:

I tried emerge gentoo-sources and it is pulling version 3.17.7. Maybe that will help. I have tried configuring the current kernel both manually and with genkernel, and have looked to see that usb stuff was chosen, but have not had any luck. My system used to be just fine and I loved the way it worked. I would just like to get it back because it my main home computer and I much prefer it to using this Mac for most of my work.

Note: my posts may be quite delayed as my wife is in the hospital, so this is understandably not my primary concern. But I will monitor this thread and do what I can to answer your questions. I thank each of you for your help.

----------

## Naib

Iirc that error message is indicative of missing HDD controller drivers built-in to the kernel (or initrd)

----------

## Keruskerfuerst

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

Possible reasons for that:

1. false root parameter in grub.cfg

2. no filesystem support for root partition  in the kernel

----------

## Naib

 *Keruskerfuerst wrote:*   

> 
> 
> ```
> not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
> ```
> ...

  (0,0) is missing HDD controller driver as I mentioned

----------

## mark2

Is the grub.cfg located in /boot/grub? If so, there is not one. Trying to open it with nano shows only a blank file. But there is one named grub.cfg.new that has a lot of stuff in it, which is commented to not edit directly because it is automatically generated. I did make sure there was file system support (ext4) for the root partition, however.

@naib: I am not sure how to check for missing HDD controllers in the kernel.

I will do some research and see if I can determine how to find that out.

----------

## mark2

I have tried to update the kernel and went through the make menuconfig to try to make sure that I had support for my HDD. Still not sure, but ran into another problem. When I tried to make install, it errors saying there is not enough room left on device to copy the bzimage. I ran into this before and tried to delete old kernels to make room, but I am not sure if that didn't mess something up in the meantime.

I would appreciate a clear and concise guide on how to clean out all the old kernel stuff and just have one clean kernel. I did try to search for info, but keep getting links to other distros and I am not familiar with any other than OpenSuse, and that doesn't exactly fit the bill. Maybe a cleanup might help things to work better together. I have installed linux-3.17.7-gentoo from gentoo-sources. I have remnants of several other kernels lying around that I think need to go. Thanks for any suggestions on this.

Mark

----------

## Roman_Gruber

hmm

basically you need.

a bootloader, which needs to be installed in /boot  e.g. grub2.

than you need just one entry each for each operating system you want to boot in your grub config

and for each entry you just need the files residing in the spot you specify in grub2.

basically any guide about grub2, when you use grub2, is enough as booting is basically the same.

for example linux mint added this as an entry to my grub config

```
menuentry 'Linux Mint 12 LXDE, 3.0.0-12-generic (/dev/sda1) -- recovery mode' --class linuxmint --class gnu-linux --class gnu --class os {

   recordfail

   insmod gzio

   insmod part_msdos

   insmod ext2

   set root='(hd0,msdos1)'

   search --no-floppy --fs-uuid --set=root 68e44433-b86e-4865-bb33-75c23b8d09ff

   echo   'Loading Linux 3.0.0-12-generic ...'

   linux   /vmlinuz-3.0.0-12-generic root=UUID=a0f74936-7c80-401d-9c33-98408f9603d0 ro recovery nomodeset 

   echo   'Loading initial ramdisk ...'

   initrd   /initrd.img-3.0.0-12-generic

}

```

this is for example a comment in grub2, because it starts with a #

```
### END /etc/grub.d/10_linux ###

```

Best is you comment out the old entries and add a new one for every os and add those files to your /boot

http://wiki.gentoo.org/wiki/GRUB2

you may grow your partition for /boot using gparted for example from sysrescuecd?

edit:

failproof solution would be => grow your /boot partition with gparted and keep the old files when you are unsure what you need and what you do not need. as those files are not that big anyway.

a clean apporach would be to backup /boot.

and start from scratch creating /boot + grub2 + entries 

which is somehow recommended

or just adjust your exisinting bootloader and remove old entries, check which entries are used and keep those entries, 

i do not think that you will find a guide about how to do this as this is different for every user szenario and installation. every grub2 entry gives you a hint which file is used for which entry. and you need to keep those. you need also to keep the grub2 related files

i assue you should at least keep this /boot/grub/

just make sure that you have mounted /boot before you proceed else you will generate the files in your /boot and not in the mounted /boot ... check with mount

----------

## teliot

boot off a livecd/usb and run the command

```
fdisk -l
```

to find out your partition types (i would assume ext2, ext3)

your kernel will need to support the file system type listed by fdisk, this is listed under

File Systems --->

from what you posted above i can tell you are using genkernel. you can run

```
genkernel --menuconfig
```

to select your file system type. i assume genkernel brings in the linux fs types of ext2/ext3 so will need to add your fs type if setting root= as a kernel argument does not work.

sounds like you are using the grub command prompt, type this

```

set root=(hd0,msdos3)

linux /boot/kern[tab key] root=/dev/sda3 ro

initrd /boot/init[tab key]

boot

```

if your /boot/grub/grub.cfg is empty you can move the grub.cfg.new that has stuff in it to grub.cfg or run the command

```
grub2-mkconfig -o /boot/grub/grub.cfg
```

you will want to ls /boot to ensure its mounted first if its on another partitionLast edited by teliot on Wed Jan 28, 2015 7:12 pm; edited 2 times in total

----------

## NeddySeagoon

mark2,

You need to load your initrd at the grub prompt too.

Your kernel panics with a unknown-block(0,0) because genkernel has made you a fully modular kernel and put the modules into the initrd but you onry load the kernel when you do

```
linux16 /boot/kernel-genkernel-x86_64-3.16.5-gentoo

set root=(hd0,3)
```

Clearly your kernel loads, or it could not panic.

----------

## teliot

 *mark2 wrote:*   

> I have tried to update the kernel and went through the make menuconfig to try to make sure that I had support for my HDD. Still not sure, but ran into another problem. When I tried to make install, it errors saying there is not enough room left on device to copy the bzimage. I ran into this before and tried to delete old kernels to make room, but I am not sure if that didn't mess something up in the meantime.
> 
> I would appreciate a clear and concise guide on how to clean out all the old kernel stuff and just have one clean kernel. I did try to search for info, but keep getting links to other distros and I am not familiar with any other than OpenSuse, and that doesn't exactly fit the bill. Maybe a cleanup might help things to work better together. I have installed linux-3.17.7-gentoo from gentoo-sources. I have remnants of several other kernels lying around that I think need to go. Thanks for any suggestions on this.
> 
> Mark

 

do 

```
ls -l
```

 and delete the kerneles and initrd's and system maps etc that are old you no longer use. then run 

```
grub2-mkconfig -o /boot/grub/grub.cfg

```

----------

