n-boot systems, bootloaders, and grub

Frank Fenderbender frankfenderbender at council124.org
Tue Oct 29 07:07:14 UTC 2019


I am seeking clarification on using 'update-grub' and/or 'grub-mkconfig'.

Here's the details upon which I am working.

   Systems: two Dell Precision 5820 Tower Workstations, each currently using 4 internal HDs.
   Primary/default OS on both systems: Ubuntu 18.04.
   Goal: add three (3) more operating systems (FreeBSD, Fedora, Debian added on one; Window10, GhostBSD, DragonflyBSD added onto the other).
   Required process: a step-wise installations with intermittent backup and and modification of GRUB (v2.x).

Okay, I've read about two methods of creating my N-boot system.

The essence of "Method 1" is:
$ sudo gedit /etc/default/grub
# menu will list ordered boot/bootloader options
# the "primary" will need to have the highest "GRUB_DEFAULT" number
# the list, with just a primary OS, starts with 0
# to add a secondary OS, add its section, and increment the primary #
# with four OSs, the primary OS ends up set as 3 
# and the secondary OSs will be set at 0, 1, and 2
GRUB_DEFAULT=3
GRUB_DEFAULT=2
GRUB_DEFAULT=1
GRUB_DEFAULT=0
# the OS-adding and default-tweaking must be done one-at-a-time
# with the use of a tool, 'update-grub', in-between.

The second, method, which I am opting for, because it is said to be less complicated, is:

$ sudo gedit /etc/default/grub
# change variable from original
GRUB_DEFAULT=0
to
GRUB_DEFAULT=saved
# also, change the default time allowed in menu before the default
# for the primary OS starts, i.e., the one with the highest number,
# however, will that be added into the file by the 'grub-set-default'
# method below?
GRUB_TIMEOUT=15
# save the edit session
# update the grub.cfg file
$ sudo update-grub
# run command
$ sudo grub-set-default 'Ubuntu 18.04 (loader) (on /dev/sda1)'
# there is no longer a need to set a number, since the list option is explicit
# now, add other OSs for each OS and HD#
# '[OS name] (loader) (on /dev/sd[hdd#][partition#])', such as
# $ sudo grub-set-default 'Ubuntu 18.04 (loader) (on /dev/sda1)'
# $ sudo grub-set-default 'FreeBSd (loader) (on /dev/sda2)'
# $ sudo grub-set-default 'Fedora 12 (loader) (on /dev/sda3)'
# $ sudo grub-set-default 'Debian (loader) (on /dev/sda4)'

I'm leaning towards Method2, as it is said to be "safer". 
No explanatory evidence for that statement was given.

I am using the following as references (versus the search results with uncertain starting points):
How Linux Works (2nd ed. - 2015) - by Brian Ward
Linux Administration: A Beginner's Guide (7th ed. - 2016) - by Wale Soyinka
Ubuntu 16.04 LTS Desktop Applications and Administration (2016) - by Richard Peterson
GNU Grub Reference Manual (2012) - by Matzigkeit, Okuji, Watson, Bennett

As I understand it so far, the UEFI partition on sda will be home to the one-and-only grub installation on the system (on sda in its /boot/grub directory's grub.cfg file).

After having its boot presented-list has received a valid selection input, it will direct the system boot process to the correct operating system /boot directory on either sda, sdb, sdc, or sdd.

I have partitions on sda set up as:

partition type mount-pt actual-size notes
--------- ------- ------------ ----------- ------
free space 1M for MBR backward-compatibility
/dev/sda1 fat32 /boot/efi 1G size input covers the preceding 'free space'
/dev/sda2 fat32 /biosgrub 10M
/dev/sda3 ext4 /boot 4G
/dev/sda4 ext4 / 300G "root partition", used for the OS
/dev/sda5 ext4 swap 12G
/dev/sda6 ext4 /usr 20G
/dev/sda7 ext4 /tmp 12G
/dev/sda8 ext4 /usr/local 50G
/dev/sda9 ext4 /home 450G

On sdb (and likewise, substituting "sdc" or "sdd" for the other secondary OSs) 
the partitions are:

free space 2.1M
/dev/sdb1 fat32 /biosgrub 34M
/dev/sdb2 ext4 /boot 4.2G
/dev/sdb3 ext4 / 315G "root partition", used for the OS
/dev/sdb4 ext4 swap 13G
/dev/sdb5 ext4 /usr 20G
/dev/sdb6 ext4 /tmp 12G
/dev/sdb7 ext4 /usr/local 50G
/dev/sdb8 ext4 /home 450G

Although additional comments are welcomed offline, my question is based in seeing two recommendations for updating the "live" grub.cfg file,  after each install-step, via running a referred-to command on /use/default/grub in order to create that "live" file. 

Two tools have been given, and, understanding their general use, I am trying to understand their specific use.

So, can you tell me what the difference(s) between, the [dis]advantage(s) of each, and the system/kernel requirement(s) of/for using the 'update-grub' and/or 'grub-mkconfig' commands?

I might guess that...
one is a specific to one OS (wrapped around Linux) over another;
it is the release of the Canonical Linux kernel (4.x versus 5.x);
it is more robust;
it reduces the number of "outside-of-the-tool" steps wherein higher possibility for error awaits.
That is just me guessing.

I've seen both commands referenced in reading about both methods.

I appreciate your review of this topic and any knowledge gleaned from your own n-boot setup experience.

Thanks much.
"Frank"







More information about the freebsd-questions mailing list