4

Can anyone provide a clear explanation what the root directory is for grub-install and when to use it?

3
  • Did you mean boot directory? grub-install doesn't need the root directory at all.
    – YoMismo
    Apr 20, 2015 at 10:14
  • @YoMismo No, I meant root directory. See man
    – ThatsMe
    Apr 20, 2015 at 10:31
  • I did, root search returns: Pattern not found (press RETURN) at least in my version (1.99-27+deb7u2)
    – YoMismo
    Apr 20, 2015 at 11:24

2 Answers 2

2

The root directory is just what it says: your root directory, i.e /. If you are running grub-install while booted from some other medium and have your normal root directory mounted somewhere other than /, then you want to specify this argument to point it to your root directory.

3
  • 1
    An nice explanation is here: "The --root-directory=/x option tells grub where to look for the grub directory during the installation process. The grub directory is /x/boot/grub on typical distributions such as Ubuntu and Debian, but may be /x/grub on some *bsd setups. ... the inode of interest will be reached by the path "/x" during the installation process. Grub assumes this inode will be reached by the simple path "/" later .... This distinction is, alas, not well documented. Aug 4, 2016 at 22:03
  • 5
    Apparently the grub-install of the original grub had the option --root-directory, but grub-install of grub2 has option --boot-directory: --boot-directory=DIR: Use DIR as the boot directory. The default is /boot. GRUB will put its files in a subdirectory of this directory named grub. Aug 4, 2016 at 22:07
  • 1
    @DavidTonhofer You should convert your comment to an answer :)
    – SebMa
    Mar 22, 2020 at 0:17
1

I'm not too much of an expert about GRUB, but as far as I know, the root directory for GRUB it's the directory where you can install a working GRUB when you have started your system in recovery mode:

grub-install –-root-directory=/test/kernelimage /dev/sda

Here the root directory contains an image of the Linux kernel to boot, and must also contain a directory /boot/grub.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .