I have compiled my own kernel on Gentoo (following the handbook) and then I have moved the bzImage to /boot/vmlinuz-4.0.5. But when I boot the system I get the Grub2 shell. What am I doing wrong?

Also, when I try to boot the system from the Grub shell I got the following error: kernel panic-not syncing: VFS: unable to mount root fs on unknown block(0, 0). I also have Windows 10 installed on this hard drive.

Initially, /boot was a separate partition of 2MB but I discovered that I didn't need to do that and I removed any reference to that partition from /etc/fstab (basically, I removed the line from fstab concerning the /boot). Given the fact that after I rebooted the system I got the grub2 shell. I booted from an Ubuntu live CD and I built the kernel, after that I moved the kernel manually to /boot. I did it manually because make install (which should've handle this job) would have copied it to the wrong place.

These are the commands that I used in order to build the kernel from the Ubuntu live CD:

ubuntu@ubuntu:/media/ubuntu/a243b31a-80dd-4a49-8de2-f4417816981d/usr/src/linux$ make menuconfig
ubuntu@ubuntu:/media/ubuntu/a243b31a-80dd-4a49-8de2-f4417816981d/usr/src/linux$ make && make modules_install
ubuntu@ubuntu:/media/ubuntu/a243b31a-80dd-4a49-8de2-f4417816981d/usr/src/linux$ cp arch/bzImage ../../../boot/vmlinuz-4.0.5

Then I rebooted.

  • @FaheemMitha but do you hav any ideea why doesn't grub2 detect the available boot options or why it doesn't show the boot menu? – cristid9 Feb 10 '16 at 16:11
  • @FaheemMitha This is the guide that I am following wiki.gentoo.org/wiki/Handbook:X86/Installation/Kernel. The fact is that I followd the guid first time. But after I rebooted the system I got the gurb shell. After a bit of research, I discovered that the only thing in /boot was /boot/grub. So I booted using a ubuntu live cd and compiled the kernel and moved it to from arch/x86_64/bzImage to /boot/vmlinuz-4.0.5. I did 80% of the steps described in the guide, excepting the make install, which would've copied the kernel to the wrong path. – cristid9 Feb 10 '16 at 16:27
  • @cristid9 Put all that information into the question, please. Also, it seems odd that a "official" guide would contain errors. Make sure you haven't make any mistakes following the guide. Can you provide more details about what make install was trying to do? Also, try asking on a Gentoo forum. Sometimes IRC channels are can helpful. – Faheem Mitha Feb 10 '16 at 16:45
  • @FaheemMitha As far as I know, make install should've copied the kernel from /arch to /boot. I have asked this question on IRC, and I am waiting for answers. – cristid9 Feb 10 '16 at 16:57
  • So, where does it copy the kernel then? Can you paste the make install commands into the question? Again, put all relevant information into the question, not comments. – Faheem Mitha Feb 10 '16 at 17:19

I ran into the same error earlier when I manually copied the bzImage to /boot. However running make install fixed the issue for me. make install generates the initramfs image. The initramfs file is named


on my system

After you have both the vmlinuz and initramfs files, you need to run the grub2-mkconfig command

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

It will automatically generate the grub.cfg file and it will associate the kernel with initramfs file, like below

 --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-4.12.0-rc3+-advanced-1cd90ed5-08a6-4ca3-8b96-65b5a30382ae' {
        insmod gzio
        insmod part_msdos
        insmod xfs
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  f33e4ffc-4d5b-44be-aedd-7aacc6241ed9
          search --no-floppy --fs-uuid --set=root f33e4ffc-4d5b-44be-aedd-7aacc6241ed9
        linux16 /vmlinuz-4.12.0-rc3+ root=/dev/mapper/cl-root ro crashkernel=auto rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet LANG=en_US.UTF-8
        initrd16 /initramfs-4.12.0-rc3+.img
  • please go back and edit your post and add the code formatting please, without it your answer is very hard to read – ivanivan May 31 '17 at 1:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.