http://www.techradar.com/pro/linux December 2019 LXF257 73
Customising GRUB TUTORIALS
A simple graphical
system for
managing your
boot setup is
grub-customizer.
With it you can add
and remove menu
entries and import
gz-packed themes.
REFIND, THE ALTERNATIVE TO GRUB
using an ISO image. Ordinarily, you copy an ISO image
using dd, which creates the entire disc on that medium.
With some trickery, though, you can put several ISO
images on a memory stick and boot the image using
GRUB instead.
BIOS vs UEFI
Most of us know that the BIOS system is old and UEFI is
newer, but what has changed? The big difference is that
UEFI can address larger disks using the GUID partition
table or GPT. It also enables CPU independence and
things like network capability before the OS starts. This
makes it possible to troubleshoot a system remotely
even before you have a running OS.
Another interesting difference is that UEFI does
not rely on the boot sector alone; instead, you call a
boot manager. In your case, this will be GRUB. Most
distributions use GRUB as the default bootloader and
boot manager, so the install procedure will create all
files and install them to an appropriate drive. If you
have some odd setup you are interested in creating,
you need to consider where it should be and what you
want to add.
The common method in modern systems is to have
GRUB in the MBR (Master Boot Record) and a UEFI
partition for the boot and other files that relate to the
start of the system. You can install GRUB to a place on
the UEFI partition and use a generic boot loader in the
MBR. In the box bottom right, you can read about
rEFInd, which can load GRUB or do this job on its own.
You can use other methods but usually you will only
need to do this with very odd hardware.
Where the files are placed varies between
distributions, Fedora places all files in the EFI System
Partition (called the ESP). Ubuntu mixes where the files
go: the ESP is mounted under /boot/efi/ and /boot is
on your system partition. This could be complicated if
your system partition is damaged.
The manual method from tutorials on the web
usually describes where everything is under the ESP.
This would place the kernels in your ESP, which could
require a large ESP. With two kernels and all the mode
files, you end up with 150MB of ESP. Most of us can live
with that and an automatically-created ESP is usually
around 300MB, so do this when you are making your
own system.
When you start experimenting with GRUB, you may
end up with failed boots, so choose a method that can
help you back to a booting system.
Boot editing
If you think that a change to kernel parameters may
have a positive effect on your system, you should try
them out at boot. All parameters that you pass to the
kernel are in the list in GRUB before boot.
You can stop the boot and change the values before
you allow the boot to start. When you do this, the
changes you make are not stored in the GRUB
configuration – it only changes that particular boot.
You will have to continue changing the values in your
running system and update the configuration until you
have found the best solution for you.
In GRUB itself, you even have the possibility to use
command-line tools that are included. You also have the
choice to put GRUB on a memory stick and boot from
that. This also makes it possible to have your main
system running while you try out new choices on
another system. There are many scripts to help you do
this – Grml comes to mind. This system builds a
directory tree with ISO images and creates your GRUB
configuration. To understand it well, try the manual
approach using grub-install:
$ grub-install --force --removable --boot-directory=/
mnt/USB/boot --efi-directory=/dev/sd[x]/EFI/BOOT/
This command needs to have all the files needed for
the boot. These files are the binaries and configuration
files that are usually put there by the distribution
scripts. The important ones are the EFI binaries. There
is one for each system type, 32-bit and 64-bit. All these
files are available at https://webativo.com/uploads/
files/usb-pack_efi.zip. The other files are modules for
different functions, the crucial ones being to support
different file systems.
Vdi inside a VM
The safest way to try things out is to use a virtual
machine to test everything. For the sake of speed, use
small distributions so it is easy to start and restart.
GRUB usually boots to one of the partitions on your
rEFInd is a boot manager only, as opposed to GRUB, which manages
and loads the OS. This is not a problem when you run Linux since the
kernel can act as a boot loader. The feature ‘EFI Stub Loader’ enables
this and most distributions deliver kernels with this feature active.
You can use rEFInd in the same way as you use GRUB – the
differences are few. However rEFInd has a few more features; it
detects kernels on its own, for example. Thanks to this and a few
other features, rEFInd has a simpler configuration than GRUB. Most
people have no problems because the distribution has created scripts
that write the configuration.
When you want to install rEFInd, you need to use a separate file.
Most distributions include GRUB; rEFInd comes as a PPA for Ubuntu,
but is not default in many other distributions. Another neat feature of
rEFInd is that it can load BIOS-mode boot loaders; this is only a
problem for certain Macs when you need to boot Windows 7.
Although you can decorate GRUB, rEFInd has many more ways to
make it look good. Since rEFInd only has one developer it may never
really become mainstream – but who knows, at some point more
people might join the team.
Repeat this
in your head:
“The system
will become
unbootable
several times
before I get this
right”. Create a
recovery stick
before you try
anything in this
tutorial, then
decide how
to proceed.
7772Decmbr rb2c019tb09aksyo December 2019 LXF257 73
Customising GRUB TUTORIALS
A simplegraphical
systemfor
managingyour
bootsetupis
grub-customizer.
Withit youcanadd
andremovemenu
entriesandimport
gz-packedthemes.
REFIND,THEALTERNATIVETOGRUB
using an ISO image. Ordinarily, you copy an ISO image
using dd, which creates the entire disc on that medium.
With some trickery, though, you can put several ISO
images on a memory stick and boot the image using
GRUB instead.
BIOS vs UEFI
Most of us know that the BIOS system is old and UEFI is
newer, but what has changed? The big difference is that
UEFI can address larger disks using the GUID partition
table or GPT. It also enables CPU independence and
things like network capability before the OS starts. This
makes it possible to troubleshoot a system remotely
even before you have a running OS.
Another interesting difference is that UEFI does
not rely on the boot sector alone; instead, you call a
boot manager. In your case, this will be GRUB. Most
distributions use GRUB as the default bootloader and
boot manager, so the install procedure will create all
files and install them to an appropriate drive. If you
have some odd setup you are interested in creating,
you need to consider where it should be and what you
want to add.
The common method in modern systems is to have
GRUB in the MBR (Master Boot Record) and a UEFI
partition for the boot and other files that relate to the
start of the system. You can install GRUB to a place on
the UEFI partition and use a generic boot loader in the
MBR. In the box bottom right, you can read about
rEFInd, which can load GRUB or do this job on its own.
You can use other methods but usually you will only
need to do this with very odd hardware.
Where the files are placed varies between
distributions, Fedora places all files in the EFI System
Partition (called the ESP). Ubuntu mixes where the files
go: the ESP is mounted under /boot/efi/ and /boot is
on your system partition. This could be complicated if
your system partition is damaged.
The manual method from tutorials on the web
usually describes where everything is under the ESP.
This would place the kernels in your ESP, which could
require a large ESP. With two kernels and all the mode
files, you end up with 150MB of ESP. Most of us can live
with that and an automatically-created ESP is usually
around 300MB, so do this when you are making your
own system.
When you start experimenting with GRUB, you may
end up with failed boots, so choose a method that can
help you back to a booting system.
Boot editing
If you think that a change to kernel parameters may
have a positive effect on your system, you should try
them out at boot. All parameters that you pass to the
kernel are in the list in GRUB before boot.
You can stop the boot and change the values before
you allow the boot to start. When you do this, the
changes you make are not stored in the GRUB
configuration – it only changes that particular boot.
You will have to continue changing the values in your
running system and update the configuration until you
have found the best solution for you.
In GRUB itself, you even have the possibility to use
command-line tools that are included. You also have the
choice to put GRUB on a memory stick and boot from
that. This also makes it possible to have your main
system running while you try out new choices on
another system. There are many scripts to help you do
this – Grml comes to mind. This system builds a
directory tree with ISO images and creates your GRUB
configuration. To understand it well, try the manual
approach using grub-install:
$ grub-install --force --removable --boot-directory=/
mnt/USB/boot --efi-directory=/dev/sd[x]/EFI/BOOT/
This command needs to have all the files needed for
the boot. These files are the binaries and configuration
files that are usually put there by the distribution
scripts. The important ones are the EFI binaries. There
is one for each system type, 32-bit and 64-bit. All these
files are available at https://webativo.com/uploads/
files/usb-pack_efi.zip. The other files are modules for
different functions, the crucial ones being to support
different file systems.
Vdi inside a VM
The safest way to try things out is to use a virtual
machine to test everything. For the sake of speed, use
small distributions so it is easy to start and restart.
GRUB usually boots to one of the partitions on your
rEFInd is a boot manager only, as opposed to GRUB, which manages
and loads the OS. This is not a problem when you run Linux since the
kernel can act as a boot loader. The feature ‘EFI Stub Loader’ enables
this and most distributions deliver kernels with this feature active.
You can use rEFInd in the same way as you use GRUB – the
differences are few. However rEFInd has a few more features; it
detects kernels on its own, for example. Thanks to this and a few
other features, rEFInd has a simpler configuration than GRUB. Most
people have no problems because the distribution has created scripts
that write the configuration.
When you want to install rEFInd, you need to use a separate file.
Most distributions include GRUB; rEFInd comes as a PPA for Ubuntu,
but is not default in many other distributions. Another neat feature of
rEFInd is that it can load BIOS-mode boot loaders; this is only a
problem for certain Macs when you need to boot Windows 7.
Although you can decorate GRUB, rEFInd has many more ways to
make it look good. Since rEFInd only has one developer it may never
really become mainstream – but who knows, at some point more
people might join the team.
Repeatthis
inyourhead:
“Thesystem
willbecome
unbootable
severaltimes
beforeI getthis
right”.Createa
recoverystick
beforeyoutry
anythinginthis
tutorial,then
decidehow
toproceed.