[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how does grub2 locate grub.cfg

From: Jordan Uggla
Subject: Re: how does grub2 locate grub.cfg
Date: Thu, 16 Jan 2014 11:55:40 -0800

On Tue, Jan 14, 2014 at 6:04 PM, Avinash Sridharan <address@hidden> wrote:
> I have a slackware installation. I have 7 partitions on my hard disk where /dev/sda1 is the boot partition and /dev/sda7 is the root partition (on which slackware is installed). During installation, I didn't realize, but /boot was not a separate mount point. That is /boot is sitting on /dev/sda7.
> After installing slackware, I installed grub2 on /dev/sda1

What grub-install command did you actually run? If by "installed grub2 on /dev/sda1" you mean that you ran "grub-install /dev/sda1" then that is a mistake, grub's boot sector should be installed to the MBR because the MBR is what your BIOS will load at boot, and installing grub's boot sector to the MBR allows grub to use a stable embedding area.
> and created the /boot/grub/gurb.cfg using grub-mkconfig.

So during installation of Slackware, your kernels and everything else for /boot/ was installed to a directory in your root partition, and when you ran grub-install the path '/boot/' was not a mount point for a separate filesystem, so grub-install correctly installed grub's files to the /boot/ directory on your root partition and configured grub's core.img to have a $prefix (the variable grub uses to find its images and grub.cfg) to "(,msdos7)/boot/grub/" meaning "The first partition on the msdos partition table on the drive that the BIOS tells us that we booted from.". If you had had your separate /boot/ partition mounted at the path "/boot/" when you ran grub-install, then grub-install would have copied its images there and configured the core.img with a $prefix of "(,msdos7)/grub/". You could have also gotten the same effect by running "mount /dev/sda7 /mnt/ && grub-install --boot-directory=/mnt/ /dev/sda" which explicitly tells grub-install where your /boot/ directory is (if not provided, this option defaults to "/boot/").
> After hitting reboot, it hit me that grub.cfg is not on the boot partition, but on /dev/sda7 and I thought grub might not be able to find it. But low and behold, grub found it perfectly.
> I was wondering if I am missing something here, or there has been a little bit of magic added to grub2 to actually have the grub.cfg on a different location than the boot partition??

There is no magic here, grub did exactly what you told it to do.

Jordan Uggla (Jordan_U on

reply via email to

[Prev in Thread] Current Thread [Next in Thread]