Configuring/using grub with grub-install and grub-mkconfig

Colin Watson cjwatson at ubuntu.com
Mon Nov 18 12:07:53 UTC 2019


On Sun, Nov 17, 2019 at 06:05:56PM +0000, Chris Green wrote:
> I have been searching around (and asking questions) about how to add a
> separate /boot partition.  As a result I have become steadily *more*
> confused about the relationship between grub-mkconfig and grub-install.

grub-install puts the boot loader code on disk such that the system
firmware can transfer control to it at boot time, with enough
information that it knows how to find /boot/grub.

grub-mkconfig generates grub.cfg, which the boot loader runs, and whose
main purpose is to find the root filesystem and transfer control to an
appropriate kernel found there.

(On Debian-based systems such as Ubuntu, you should normally run
update-grub rather than running grub-mkconfig directly.  It's just a
simple wrapper, but it saves you from typing out the path to
/boot/grub/grub.cfg.)

> I just need to reconfigure my system to use a separate (small) boot
> partition and a large (non bootable from BIOS) main partition.
[...]
> So I can mount /dev/sda1, no problem there.  So what do I do next?
> Do I run grub-install?  Do I run grub-mkconfig?

You'll definitely need to run grub-install, because you're trying to
make parts of the boot loader code live in a new place and refer to the
new /boot directory.

It may be possible to get away without running update-grub if you move
across the existing /boot/grub/grub.cfg and don't move the existing root
filesystem, because grub.cfg shouldn't itself depend on the details of
where /boot is, only on where / is.  However, just running update-grub
is simpler and doesn't hurt.

-- 
Colin Watson                                       [cjwatson at ubuntu.com]




More information about the ubuntu-users mailing list