Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Existing formerly working grub2 fails after adding new kerne
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
dbishop
Tux's lil' helper
Tux's lil' helper


Joined: 08 Dec 2007
Posts: 99

PostPosted: Fri Sep 06, 2013 3:29 am    Post subject: Existing formerly working grub2 fails after adding new kerne Reply with quote

Hi all,

I built a new kernel (3.10.7) on a machine that had a running 3.7.10 kernel (both gentoo-sources). The machine uses EFI and Grub2 and worked fine with the 3.7.10 kernel. I am new to Grub2 and I have never added a new kernel to it but I mounted boot etc, then ran
Code:
grub2-mkconfig -o /boot/efi/grub2/grub.cfg


That seemed to go well, sine the new kernel and the old kernel options appear in he grub2 menu after reboot.

The Problem

Now I get a kernel panic and the infamous error

Code:
VFS: Cannot open root device "UUID=blahblahblah" or unknown-block(0,0): error -6
Please append a correct "root=" boot option; here are the available partitions:


This machine was bootable before I created a new kernel and ran the grub2 script to add the menu item. Now, even if I choose the other formerly working kernel, I get the same kernel panic message.

I really don't know where to begin, Grub2 seems a lot more mystical and difficult than Grub "legacy" which I run on more that a dozen other machines...

Frankly I am a little desperate and would be grateful for whatever help can be provided. I have read a lot of Grub2 pages that deal with this error, but most of them are getting things working in the first place. I did that part already (after much pain) and things were working fine. Things broke after I tried to add another kernel to boot menu with the hope I could boot from it. Now nothing boots.
Back to top
View user's profile Send private message
boerKrelis
Apprentice
Apprentice


Joined: 01 Jul 2003
Posts: 241
Location: The Netherlands

PostPosted: Fri Sep 06, 2013 6:00 am    Post subject: Reply with quote

Is your root partition listed by the kernel?
You mention it outputs :
Code:
 here are the available partitions:


Keep in mind that if you change variables in /etc/default/grub, those changes are applied to every kernel entry, including the old ones. The whole config is regenerated.
Back to top
View user's profile Send private message
dbishop
Tux's lil' helper
Tux's lil' helper


Joined: 08 Dec 2007
Posts: 99

PostPosted: Fri Sep 06, 2013 1:09 pm    Post subject: Reply with quote

it just lists this:

Code:

Pleas append a correct "root=" boot option. Here are the available options:
0800      [   disk size   ]    sda    driver: sd
0801      [partition size]    sda1   [UUID]
0802      [partition size]    sda2   [UUID]
0803      [partition size]    sda3   [UUID]
0804      [partition size]    sda4   [UUID]
0805      [partition size]    sda5   [UUID]
0806      [partition size]    sda6   [UUID]
0807      [partition size]    sda7   [UUID]
0808      [partition size]    sda8   [UUID]
0809      [partition size]    sda9   [UUID]
Kernel panic -- not syncing: VFS: Unable to mount root fs on unknown-block(0,0)


I do not understand what Grub2 is trying to do. Did I skip a step?

I put the new kernel in /boot then executed the grub2-mkconfig -o /boot/efi/grub2/grub.cfg script. The new menu seemed to generate correctly and when I rebooted I can see the new kernel choice (3.10.7) along with the old kernel choice (3.7.10). I didn't change anything in /etc/default/grub this time. It is whatever it was before. I do not remember what I did when I set this up. I have, i dunno, 15 machines running Gentoo but only this one is EFI + GPT + Grub2.
Back to top
View user's profile Send private message
boerKrelis
Apprentice
Apprentice


Joined: 01 Jul 2003
Posts: 241
Location: The Netherlands

PostPosted: Sat Sep 07, 2013 5:54 am    Post subject: Reply with quote

1. Which one is your root partition?

2. What happens if you edit your kernel parameters (from within grub, press 'e') and change the 'root=UUID=XXXXXXX' to 'root=/dev/sdaX' ?
Back to top
View user's profile Send private message
dbishop
Tux's lil' helper
Tux's lil' helper


Joined: 08 Dec 2007
Posts: 99

PostPosted: Sun Sep 08, 2013 12:32 am    Post subject: Reply with quote

My root partition is the 4th (ie, sda4). 1 is the EFI partition, 2 is boot, 3 is swap, 4 is root, then usr, var, home, and so on.

I took your hint and edited the boot menu option. Thgere is a bunch of gobbledygook in there, not sure why it is there, but I changed all the UUID references to /dev/sda4 (but nothing else, not even the references to gpt2). I pressed F10, and grub next complained there was no valid root partition there -- but then miracle of miracles -- it actually booted the OS anyway (finally)

Note I said /dev/sda4 -- that's the '/' partition. /dev/sda2 is the more classical /boot partition. If I use that, I get a kernel panic. I quit hacking because I am not sure what to do now, the fact that /dev/sda4 works (although it does give an error that says "error: no such device: /dev/sda4. Loading Linux 3.10.7-gentoo ..." and then it boots fine.

Here is what the Grub2 menu choice says:

Code:

setparams 'Gentoo GNU/Linux'

    load_video
    insmod gzio
    insmod part_gpt
    insmod reiserfs
    set root='hd0,gpt2'
    if  [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  17661700-4af8-4663-966b-9d5d972debe8
    else
        search --no-floppy --fs-uuid --set=root 17661700-4af8-4663-966b-9d5d972debe8
    fi
    echo        'Loading Linux 3.10.7-gentoo ...'
    linux        /kernel-3.10.7-gentoo root=UUID=6dff46f6-28aa-467a-86b3-b1dce8486608 ro


Another concern I have is all the insmod's. I am not so sure about all of them, but 100% certain that reiserfs is built into the kernel.

thank you for your help. It's helping :-)
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7131
Location: almost Mile High in the USA

PostPosted: Sun Sep 08, 2013 12:39 am    Post subject: Reply with quote

Did the base kernel finally allow root=UUID=XXX without initrd?

If not, where is your initrd specified? That's the only way root=UUID=XXX will work.

The insmods you have in your grub affect grub only - has nothing to do with your kernel after it is booted. Grub needs to know the layout of your filesystem too, before it can figure out how to load stuff from it.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
dbishop
Tux's lil' helper
Tux's lil' helper


Joined: 08 Dec 2007
Posts: 99

PostPosted: Sun Sep 08, 2013 3:13 am    Post subject: Reply with quote

I don't have an initrd. Never did. In all my gentoo machines for the past 10+years (I am running 15+ right now) I have never used an initrd (or grub2 for that matter).

Please note that this worked just fine until i built a new kernel and ran the script to add it to the menu.

I guess I need some serious help to fix this.

here is what the edited boot menu looked like, the one that finally booted the machine:


Code:

setparams 'Gentoo GNU/Linux'

    load_video
    insmod gzio
    insmod part_gpt
    insmod reiserfs
    set root='hd0,gpt2'
    if  [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  /dev/sda4
    else
        search --no-floppy --fs-uuid --set=root /dev/sda4
    fi
    echo        'Loading Linux 3.10.7-gentoo ...'
    linux        /kernel-3.10.7-gentoo root=UUID=/dev/sda4 ro
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7131
Location: almost Mile High in the USA

PostPosted: Sun Sep 08, 2013 4:24 am    Post subject: Reply with quote

You should only need

root=/dev/sda4

To use root=UUID=XXXXXXX (or what I use, root=LABEL=my_computers_name_root) traditionally has required an initrd that handles the mount in userland. From what it looks it should know what the UUIDs for the partitions are so it should work... Don't know. Will have to try it someday and see (then again, I've never seen it dump out that table before...)
(Also, I'd have to wonder about the new feature of adding an initrd to the kernel image too, maybe we do have a stealth initrd at play anyway... )
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
dbishop
Tux's lil' helper
Tux's lil' helper


Joined: 08 Dec 2007
Posts: 99

PostPosted: Sun Sep 08, 2013 6:50 pm    Post subject: Reply with quote

I am sneaking up on the problem (the solution still eludes me)

It appears that the grub2-mkconfig script uses the disk partition UUID (in my case). As it happens, this is exactly what I want, it just doesn't work.

The grub line that gets auto-generated (and I expected to see) is this:

Code:

linux        /kernel-3.10.7-gentoo root=UUID=6dff46f6-28aa-467a-86b3-b1dce8486608 ro


The UUID listed is in fact the UUID for the partition that I am trying to boot. It matches what is listed for ../../sda4 in /dev/disk/by-uuid:

Code:

root@machine ~ $ ls -al /dev/disk/by-uuid/
total 0
drwxr-xr-x 2 root root 240 Sep  8 14:18 .
drwxr-xr-x 8 root root 160 Sep  8 14:18 ..
lrwxrwxrwx 1 root root  10 Sep  8 14:18 0470d7b6-3d95-4d4e-88b7-ae14a9618bbf -> ../../sda6
lrwxrwxrwx 1 root root  10 Sep  8 14:18 17661700-4af8-4663-966b-9d5d972debe8 -> ../../sda2
lrwxrwxrwx 1 root root  10 Sep  8 14:18 29842257-9338-406d-9575-f3dc21e07969 -> ../../sda7
lrwxrwxrwx 1 root root  10 Sep  8 14:18 2d0dbbdc-935a-4660-860e-2af7b2b0122c -> ../../sda8
lrwxrwxrwx 1 root root  10 Sep  8 14:18 53DA-3FF3 -> ../../sda1
lrwxrwxrwx 1 root root  10 Sep  8 14:18 561117cd-2608-4acf-b0bd-e1a33b617930 -> ../../sda3
lrwxrwxrwx 1 root root  10 Sep  8 14:18 6dff46f6-28aa-467a-86b3-b1dce8486608 -> ../../sda4
lrwxrwxrwx 1 root root  10 Sep  8 14:18 A2E8387EE83852B1 -> ../../sdc1
lrwxrwxrwx 1 root root  10 Sep  8 14:18 E6E8A922E8A8F1CB -> ../../sdb1
lrwxrwxrwx 1 root root  10 Sep  8 14:18 fd86e92c-2484-47c5-a44e-b74343441aab -> ../../sda5



But it will fail to boot like that. However, if I change the grub line to

Code:
linux        /kernel-3.10.7-gentoo root=UUID=/dev/sda4 ro


the system boots perfectly! I guess it is fair to say I don't understand why the /dev/sda4 reference works buy the GPT UUID does not -- especially considering it worked with UUID originally, and only stopped after I copied a new kernel image to /boot and re-ran grub2-mkconfig! Very confusing!

There are a few issues that arise from this:

1. The output from grub2-mkconfig doesn't work. This means that I have to figure out where to set things so that /dev/'s are used and not UUIDs (not what I want, actually)
2. The UUID mechanism is broken (at least in my case).
3. I am not sure which commands need to get run when I add a new kernel -- grub-mkconfig, efibootmgr, grub-mkimage, ... ???

Is anyone thinking of making rEFInd available as an ebuild? Grub2 seems to be very poorly documented, and the howto's I have found are new install howto's and most of them only explain the recipe to get things running, but not necessarily how to troubleshoot things. EFI also makes things more complicated. Even the Gentoo Wiki page is confusing to me. For example, it says this:

Quote:
To override the default boot loader, according to UEFI 2 specifications, one has to run the following command. This is handy when one cannot add an EFI boot entry as the utility will fails if `/sys/firmware/efi/vars/' is not empty meaning that you have to boot in EFI mode to be able to have a non empty directroy.


I really don't know what that is trying to say, apart from the command line that followed it gets run under some condition. It says that if the directory is not empty the command fails, so do the following comad so that the directory is not empty... I am not trying to nit-pick, it's just that this seems to be the general state of the howto's on grub2

Can anyone help me understand either how to fix the UUID issue or how to get grub2-mkconfig use /dev/'s instead of GPT UUIDs?

Thanks once again for all the support
Back to top
View user's profile Send private message
Knute
Guru
Guru


Joined: 28 Jun 2004
Posts: 362
Location: Fargo, ND

PostPosted: Mon Sep 09, 2013 2:48 am    Post subject: Reply with quote

Most times when I've had that message, especially when it happens after a new kernel, I've normally forgotten to include what type of partition the root is (ext2, ext3, etc... ) as built into the kernel rather than as a module.

So what type of partition is sda4? and is that partition type built into your kernel?
_________________
Knute
----------
The human race has one really effective weapon, and that is laughter.
-- Mark Twain

If you want proof of that, take a look at windows sometime. :)
Back to top
View user's profile Send private message
dbishop
Tux's lil' helper
Tux's lil' helper


Joined: 08 Dec 2007
Posts: 99

PostPosted: Mon Sep 09, 2013 3:22 am    Post subject: Reply with quote

The partition type is reiserfs -- all of them are. I always build reiserfs into my kernels. I also have the habit of copying my last kernel's .config to my new kernel subdirectory and then do a "make oldconfig" from there. Keeps me from leaving out such things.

That said, this doesn't feel like that kind of problem to me, because it no longer boots the old kernel either (which it did just fine before).

I understand that the old grub.cfg file gets wiped out each running of grub2-mkconfig, assuming you tell it to write to the same place -- which is generally the point. I did not change any of the script options in /etc/grub.d so the new config file should have gotten created in exactly the same manner as the one that got replaced. All I did was copy the arch/x86_64/boot/bzimage to /boot/kernel-3.10.7-gentoo and run grub2-mkconfig -o /boot/efi/grub2/grub.cfg The new menu item got created but nothing would boot.

The UUID's were all correct and grub2 could find the boot partition (which is also reiserfs).

The other thing is that all I did to get everything working again was edit out the partition UUID from the grub.cfg file and replace it with /dev/sda4 -- the same partition that the UUID referenced. Now it boots just fine again. Same kernel, same modules, same everything.

Something is screwy in that grub2 cannot find the root partition by UUID -- the disk is GPT. I will try using the root=LABEL="myrootlabel" as suggested above (all my partitions are appropriately named too, ain't GPT grand???)

I'd like to get to the bottom of this, if for no other reason than there is such a dearth of information on grub2 troubleshooting, not to mention on mundane maintenance and normal life-cycle tasks. For example, I have yet to find any reference on how to reorder grub2 menu items or even change what they are called in the menu itself -- the files are auto-generated, or at least that is what everyone suggests as they best way to generate them. However when I look at the way the sysrescuecd folks organized their grub2 layout, it is completely different than anything I've seen described -- and clearly they do not use the grub2-mkconfig script.

We'll just keep digging on the UUID problem.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7131
Location: almost Mile High in the USA

PostPosted: Mon Sep 09, 2013 4:39 am    Post subject: Reply with quote

LABEL=xxx will not work either if UUID=xxx does not work.

LABEL requires initrd to resolve the labels.

The command line option is root=xxxxxxx

When passing something to root=xxxxxxx you normally pass it a device name by itself, or use the "fake" device LABEL= or UUID=

These are what the options normally look like, pick one:

root=/dev/sda4
root=LABEL=MyRootDisk
root=UUID=12345678-9abc-def0-1234-56789abcdef0

Usually when using initramfs, the initramfs is the root during initial boot, and another option real_root= is used to clarify the real root filesystem after it figures out how to mount your "real" root.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7552
Location: Goose Creek SC

PostPosted: Mon Sep 09, 2013 5:47 am    Post subject: Reply with quote

UUID and LABEL are identifiers for file systems on msdos or gpt labeled disks
PARTUUID and PARTLABEL are identifiers for partitions on gpt labeled disks
/dev/disk contains by-partuuid and by-partlabel listings for gpt disks
root=PARTLABEL=<value> and root=PARTUUID=<value> are usable in an EFI stub kernel built in command line without an initrd
root=PARTLABEL=<value> and root=PARTUUID=<value> might work with grub2 without an initrd; the limit would be grub2 not the kernel
_________________
Defund the FCC.
Back to top
View user's profile Send private message
dbishop
Tux's lil' helper
Tux's lil' helper


Joined: 08 Dec 2007
Posts: 99

PostPosted: Mon Sep 09, 2013 2:13 pm    Post subject: Reply with quote

I presently do not have the EFI stub built into my kernel. I did not know it was useful with grub2 (I had looked into the stub in conjunction with rEFInd, but I shy away from non-ebuild-based packages so while attractive, I passed).

I can/will rebuild the kernel with that option and then try the root=PARTLABEL=<value> and root=PARTUUID=<value> methods. It would be great if they worked. I will report back.

But that brings me to another point of this thread -- creating menu options outside of the context of the grub2-mkconfig script. I would like to add options at my whim just like with grub legacy (and lilo for that matter). But the allowable syntax eludes me. The grub2 official documents etc are technically accurate, I am sure, but they do not clearly communicate the concepts to me. I am looking for something more explanatory.

Is there someplace that has readable/usable documentation on menu generation?
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7552
Location: Goose Creek SC

PostPosted: Mon Sep 09, 2013 4:23 pm    Post subject: Reply with quote

https://help.ubuntu.com/community/Grub2 https://help.ubuntu.com/community/Grub2/CustomMenus may help. The gentoo grub2 dev used to have a good short practical guide but that has disappeared, replaced by some typical grub2 wiki.
You can edit grub.cfg. As grub2 documents are worse than bad, I just replace root=/dev/sdx with root=PARTUUID=<value> when I used the technique during a brief flirtation with grub2.
As far as I can tell configuring an efi_stub kernel will not provide a bootloader without efi,; configuring efi_stub without efi is harmless.
There are downloads for refind on cd and flash, you might want to take a look at how that works.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
dbishop
Tux's lil' helper
Tux's lil' helper


Joined: 08 Dec 2007
Posts: 99

PostPosted: Tue Sep 10, 2013 2:43 am    Post subject: Reply with quote

Thx for the links, I'll be looking at them. Now I know why grub legacy is still around. grub2 is for the birds. (GRossly Unusable Bootloader)^2

I do have UEFI BIOS (Asus P877 MoBo c.2012). What else is there besides Grub2, eLilo, and rEFInd ? I liked Rod's write-up on the choices and their strengths. Would be nice if someone could pull together an ebuild for it...

I will try the partuuid thing in a day or so, I'm travelling on business for the next few days.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum