Configuring/using grub with grub-install and grub-mkconfig
Colin Watson
cjwatson at ubuntu.com
Mon Nov 18 18:02:41 UTC 2019
On Mon, Nov 18, 2019 at 05:23:23PM +0000, Chris Green wrote:
> On Mon, Nov 18, 2019 at 12:07:53PM +0000, Colin Watson wrote:
> > 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.
>
> So, having said that, which should one run first? Say I have changed
> where my /boot is do I run grub-mkconfig to create grub.cfg and then
> grub-install?
It doesn't matter. Neither one depends on the output of the other one
(I mean, when running the tools; of course both outputs have to be there
at boot time if you want things to work).
> > 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.
>
> OK, so, if I understand it right, I run update-grub (which runs
> grub-mkconfig for me with some parameters pre-set) which creates
> /boot/grub/grub.cfg and then I should run grub-install to write the
> things the BIOS needs to start the system.
Correct.
--
Colin Watson [cjwatson at ubuntu.com]
More information about the ubuntu-users
mailing list