GRUB is crazy -- or I am

Kernels & Hardware, configuring network, installing services

GRUB is crazy -- or I am

Postby Ellen1910 » 2021-01-29 03:41

My computer has two drives:
Code: Select all
   /dev/nvme0n1p1    stretch    Legacy BIOS   MBR:  Not Present
   /dev/sda1         WindowsXP      “         MBR:  MBR only
   /dev/sda5         jessie         “         MBR:  Not Present
   /dev/sda6         buster         “         MBR:  Not Present


All three debian partitions (versions) have indvidual grub menus (grub.cfg).

All three versions list both grub-common and grub2-common in their apt archives. I do not know which grub they are using.

Here’s what happens when both drives are connected.
    Boot from nvme drive: the menu on sda6 appears; the default partition is /dev/sda6. All debian partitions are bootable.
    Note: even disabling /dev/sda in the computer’s bios doesn’t change anything. Nvme still finds the sda6 menu.
    Boot from sda drive: error: symbol ‘grub_calloc’ not found.
Here’s what happens on boot when only the nvme drive is connected (sda drive disconnected).
    error: no such device : UUID identifying /dev/sda6
    error: unknown file system

What’s going on? Why is /dev/sda6 dominant?

How do I get the grub menu from the nvme partition to appear when I boot from the nvme drive?

Note: I would give a history of the order of installations (and what drives were in the computer at those times), but I don’t remember and would only be guessing.
Ellen1910
 
Posts: 63
Joined: 2006-09-30 13:49

Re: GRUB is crazy -- or I am

Postby p.H » 2021-01-29 10:54

Simple. GRUB on /dev/nvme0p1 looks for /boot/grub in /dev/sda6 and GRUB on /dev/sda is an obsolete version which is not compatible with the current contents of /boot/grub it looks for.

You can confirm this with bootinfoscript from buster's boot-info-script package (previous versions are too old).

How do I get the grub menu from the nvme partition to appear when I boot from the nvme drive?

Reinstall GRUB on the NVME drive from the NVME partition.
p.H
 
Posts: 1669
Joined: 2017-09-17 07:12

Re: GRUB is crazy -- or I am

Postby Ellen1910 » 2021-01-29 13:44

@ pH. Thanks for the interest and the quick response.

Running boot-info-script on sda6 (buster) I find --

    ============================= Boot Info Summary: ===============================

    => Grub2 (v2.00) is installed in the MBR of /dev/sda and looks at sector 1 of
    the same hard drive for core.img. core.img is at this location and looks
    for (,msdos6)/boot/grub. It also embeds following components:

    modules
    ---------------------------------------------------------------------------
    fshelp ext2 part_msdos biosdisk
    ---------------------------------------------------------------------------

If I boot into the nvme drive (stretch) and run grub-install, where will GRUB write the boot.img and core.img? Will the GRUB images buster wrote to the MBR on /dev/sda be overwritten? There's only one MBR on my computer, and it's located at the beginning of /dev/sda.

Note. Currently, I can boot all Debian versions relying on the code that buster wrote to the MBR located on /dev/sda. On their own neither the nvme drive nor the sata drive is bootable. I'm deathly afraid of messing up what works, now.
Ellen1910
 
Posts: 63
Joined: 2006-09-30 13:49

Re: GRUB is crazy -- or I am

Postby p.H » 2021-01-29 14:30

Ellen1910 wrote:Running boot-info-script on sda6 (buster) I find

Go ahead - what did it find about the NVMe SSD ?

Ellen1910 wrote:If I boot into the nvme drive (stretch)

Do you mean boot the Stretch installation ? Currently you cannot successfully boot from /dev/sda anyway.

Ellen1910 wrote:and run grub-install, where will GRUB write the boot.img and core.img?

It will (try to) write where you tell it in the command.

Ellen1910 wrote:Will the GRUB images buster wrote to the MBR on /dev/sda be overwritten?

If you tell grub-install to install in /dev/sda, yes. Anyway these images are broken, so feel free to overwrite them.

Ellen1910 wrote:There's only one MBR on my computer, and it's located at the beginning of /dev/sda.

That cannot be correct, as you can boot from the NVMe drive alone. Maybe this version of bootinfoscript does not support NVMe drives yet.

Ellen1910 wrote:Currently, I can boot all Debian versions relying on the code that buster wrote to the MBR located on /dev/sda.

No, relying on the code that is written to the MBR located on the NVMe drive and the code that is written in /boot/grub located on /dev/sda6.

May I suggest to reinstall GRUB in /dev/sda from any system installed on that drive, check boot from that drive works and do the same with the NVMe drive ?
p.H
 
Posts: 1669
Joined: 2017-09-17 07:12

Re: GRUB is crazy -- or I am

Postby Ellen1910 » 2021-01-29 20:26

Go ahead - what did it [boot-info-script] find about the NVMe SSD ?


When run on buster (sda6), it found --

    =================== sda6: Location of files loaded by Grub: ====================

    GiB - GB......................File.........................Fragment(s)

    927.538341522 = 995.936710656 boot/grub/grub.cfg 3
    923.675338745 = 991.788843008 boot/grub/i386-pc/core.img 1
    930.147457123 = 998.738227200 boot/vmlinuz-4.19.0-13-amd64 2
    930.660179138 = 999.288758272 boot/vmlinuz-4.19.0-6-amd64 1
    931.406276703 = 1000.089874432 boot/vmlinuz-4.19.0-8-amd64 1
    930.147457123 = 998.738227200 vmlinuz 2
    931.406276703 = 1000.089874432 vmlinuz.old 1
    931.016109467 = 999.670935552 boot/initrd.img-4.19.0-13-amd64 9
    931.173931122 = 999.840395264 boot/initrd.img-4.19.0-6-amd64 1
    930.889350891 = 999.534829568 boot/initrd.img-4.19.0-8-amd64 5
    931.016109467 = 999.670935552 initrd.img 9
    930.889350891 = 999.534829568 initrd.img.old 5



When run on stretch (nvme), it found --

    =================== sda6: Location of files loaded by Grub: ====================

    GiB - GB..........................File............................Fragment(s)


    =============================== StdErr Messages: ===============================

    cat: /tmp/BootInfo-9nL1uNga/Tmp_Log: No such file or directory
    cat: /tmp/BootInfo-9nL1uNga/Tmp_Log: No such file or directory


    Which makes sense. GRUB is using the vmlinuz and initrd files residing on the nvme drive. Note: there's no "nvme1:Location of files loaded by Grub" entry.

Do you mean boot the Stretch installation ? Currently you cannot successfully boot from /dev/sda anyway.

True, and I can't boot into /dev/nvme, either. But I can boot(?) into jessie (dev/sda5), stretch (dev/nvme1), and buster (dev/sda6).

Ellen1910 wrote:
Currently, I can boot all Debian versions relying on the code that buster wrote to the MBR located on /dev/sda.

p.H wrote:
No, relying on the code that is written to the MBR located on the NVMe drive and the code that is written in /boot/grub located on /dev/sda6.

I don't understand that explanation. If stretch (nvme) had written to an MBR on /dev/nvme, then, GRUB would display the menu called for in /boot/grub/grub.cfg on stretch. But it doesn't; it looks at the /boot/grub/grub.cfg residing on /dev/sda6 (buster). In other words when I boot from the nvme drive, the menu which pops up lists /dev/sda6 (buster) as the first entry.

Note: I'm relying on gdisk for the finding that only /dev/sda1 has an MBR. So --
If gdisk is correct, and there isn't an MBR on /dev/nvme, where will GRUB install boot.img and core.img?
Ellen1910
 
Posts: 63
Joined: 2006-09-30 13:49

Re: GRUB is crazy -- or I am

Postby p.H » 2021-01-29 21:56

Ellen1910 wrote:When run on buster (sda6), it found

Uninteresting.

Ellen1910 wrote:I can't boot into /dev/nvme, either

You can, and you do.

Ellen1910 wrote: If stretch (nvme) had written to an MBR on /dev/nvme

I did not write that stretch wrote to the MBR on /dev/nvme0n1. Buster did.

Ellen1910 wrote:I'm relying on gdisk for the finding that only /dev/sda1 has an MBR.

You are confusing the two parts in the MBR : the boot code and the DOS partition table. gdisk is interested only in the latter. Boot and GRUB are interested in the former.

Now you can keep beating around the bush or just boot buster and run
Code: Select all
grub-install /dev/sda

then boot stretch and run
Code: Select all
grub-install /dev/nvme0n1
p.H
 
Posts: 1669
Joined: 2017-09-17 07:12


Return to System configuration

Who is online

Users browsing this forum: No registered users and 15 guests

fashionable