update grub2

Chris Murphy lists at colorremedies.com
Sun May 18 20:57:55 UTC 2014


On May 18, 2014, at 1:42 PM, Patrick Dupre <pdupre at gmx.com> wrote:

> OK,
> 
> Thank you.
> 
> I understand the mistake:
> in /etc/fstab, there is
> /dev/mapper/VolGrpSys_DK0-root /                       ext4    defaults        1 1
> instead of:
> /dev/mapper/VolGrpSys_DK1-root /                       ext4    defaults        1 1
> However,
> mount gives:
> /dev/mapper/VolGrpSys_DK1-root on / type ext4 (rw,relatime,seclabel,stripe=2,data=ordered)
> 
> How is it possible?

I don't understand the question. But you need to remove the wrong entry from the fstab. Clearly grub2-mkconfig and grubby have different ideas about which entry to use. I'd argue that grubby creating a grub menu entry using a bogus fstab entry is failure of one the whole points of having grubby, so I'd file that as a bug even though the fstab man page says it's the sysadmins job to make certain the fstab is always correct.


> Is / mounted before the reading of /etc/fstab (ie from grub2)?

grub doesn't normally read fstab at all, except when doing grub2-mkconfig. Strictly speaking it's os-prober called by grub2-mkconfig that does this, it can locate fstab on non-mounted file systems so it can figure out how to create menu entries to boot other OS's installed on the system. At boot time, core.img (the embedded code on MBR systems, and it appears as grux64.efi on UEFI systems) contains code to read the file system that contains the grub directory. From there it can load the grub.cfg, and then additional file system modules as needed to read other directories so it can load the kernel and initramfs for any OS's that are listed in the grub menu.


> And then because / is already mounted, it cannot be mounted again, then
> why mount / in fstab then?

I don't completely understand the question. The fstab contains a complete picture of how the file system ought to be mounted. That's  how grub2-mkconfig can make boot entries for non-mounted OS file systems on a multiboot systems. But it's also there to indicate fs mount options, which aren't indicated elsewhere.

systemd is expecting to mount the root file system based on the boot parameter root= but it doesn't know any additional mount options without the benefit of fstab. The fstab isn't readable in early boot because the root file system isn't mounted. And at least on Rawhide right now I'm finding the initramfs contains an empty fstab. So systemd is going to do an fsck on the root= file system, then mount it ro, then it reads fstab and creates a bunch of mount jobs including one that remounts root from ro to rw along with fstab specified mount options.


Chris Murphy


More information about the users mailing list