lbwww/site/docs/linux/grub_boot_installer.md

179 lines
6.9 KiB
Markdown
Raw Permalink Normal View History

2021-05-18 14:21:48 +02:00
---
2023-04-09 23:38:30 +02:00
title: Installing Linux
2021-05-18 14:21:48 +02:00
x-toc-enable: true
...
# Introduction
2023-04-09 23:38:30 +02:00
This guide assumes that you are using the GRUB bootloader directly.
2021-05-18 14:21:48 +02:00
If you're using SeaBIOS, it's quite intuitive and works similarly to other BIOS
software; refer to the documentation on <https://seabios.org/SeaBIOS>.
This guide explains how to prepare a bootable USB for libreboot systems that
2023-04-09 23:38:30 +02:00
can be used to install several Linux distributions. For this guide, you
2021-05-18 14:21:48 +02:00
will only need a USB flash drive and the `dd` utility (it's installed into all
2023-04-09 23:38:30 +02:00
Linux distributions, by default).
2021-05-18 14:21:48 +02:00
These instructions are intended to be generic, applicable to just about any
2023-04-09 23:38:30 +02:00
Linux distribution.
2021-05-18 14:21:48 +02:00
2023-04-09 23:38:30 +02:00
## Prepare the USB Drive in Linux
If you downloaded your ISO while on an existing Linux system, here is how
to create the bootable Linux USB drive:
2021-05-18 14:21:48 +02:00
Connect the USB drive. Check `lsblk`, to confirm its device name
(e.g., **/dev/sdX**):
2023-01-08 02:22:04 +01:00
lsblk
2021-05-18 14:21:48 +02:00
For this example, let's assume that our drive's name is `sdb`. Make sure that
it's not mounted:
2023-01-08 02:22:04 +01:00
sudo umount /dev/sdb
2021-05-18 14:21:48 +02:00
Overwrite the drive, writing your distro ISO to it with `dd`. For example, if
2023-04-09 23:38:30 +02:00
we are installing *Foobarbaz* Linux, and it's located in our Downloads
2021-05-18 14:21:48 +02:00
folder, this is the command we would run:
2023-01-08 02:22:04 +01:00
sudo dd if=~/Downloads/foobarbaz.iso of=/dev/sdb bs=8M; sync
2021-05-18 14:21:48 +02:00
That's it! You should now be able to boot the installer from your USB drive
(the instructions for doing so will be given later).
## Prepare the USB drive in NetBSD
[This page](https://wiki.netbsd.org/tutorials/how_to_install_netbsd_from_an_usb_memory_stick/)
on the NetBSD website shows how to create a NetBSD bootable USB drive, from
within NetBSD itself. You should the `dd` method documented there. This will
2023-04-09 23:38:30 +02:00
work with any Linux ISO image.
2021-05-18 14:21:48 +02:00
## Prepare the USB drive in FreeBSD
[This page](https://www.freebsd.org/doc/handbook/bsdinstall-pre.html) on the
FreeBSD website shows how to create a bootable USB drive for installing
2023-04-09 23:38:30 +02:00
FreeBSD. Use the `dd` method documented. This will work with any Linux ISO
2021-05-18 14:21:48 +02:00
image.
## Prepare the USB drive in LibertyBSD or OpenBSD
If you downloaded your ISO on a LibertyBSD or OpenBSD system, here is how to
2023-04-09 23:38:30 +02:00
create the bootable Linux USB drive:
2021-05-18 14:21:48 +02:00
Connect the USB drive. Run `lsblk` to determine which drive it is:
2023-01-08 02:22:04 +01:00
lsblk
2021-05-18 14:21:48 +02:00
To confirm that you have the correct drive, use `disklabel`. For example,
if you thought the correct drive were **sd3**, run this command:
2023-01-08 02:22:04 +01:00
disklabel sd3
2021-05-18 14:21:48 +02:00
Make sure that the device isn't mounted, with `doas`; if it is, this command
will unmount it:
2023-01-08 02:22:04 +01:00
doas umount /dev/sd3i
2021-05-18 14:21:48 +02:00
The `lsblk` command told you what device it is. Overwrite the drive, writing
the OpenBSD installer to it with `dd`. Here's an example:
2023-04-09 23:57:42 +02:00
doas dd if=linux.iso of=/dev/rsdXc bs=1M; sync
2021-05-18 14:21:48 +02:00
That's it! You should now be able to boot the installer from your USB drive
(the instructions for doing so will be given later).
## GRUB2 config on external media
Pick the menu option: *Search for GRUB2 configuration on external media*
If the distro installer image has a `grub.cfg` file inside, this menuentry is
scripted to find it. This works well for many distros.
2021-05-18 14:21:48 +02:00
## Debian or Devuan net install
Download the Debian or Devuan net installer. You can download the Debian ISO
from [the Debian homepage](https://www.debian.org/), or the Devuan ISO from
[the Devuan homepage](https://www.devuan.org/).
Secondly, create a bootable USB drive using the commands in
2023-04-09 23:57:42 +02:00
[#prepare-the-usb-drive-in-linux](#prepare-the-usb-drive-in-linux).
2021-05-18 14:21:48 +02:00
You can select the option, in the Libreboot GRUB menu, to load GRUB config
from external media, and that should work just fine. Alternatively, pick one
of the ISOLINUX-related menu options.
2021-05-18 14:21:48 +02:00
## Booting ISOLINUX Images (Automatic Method)
Boot it in GRUB using the `Parse ISOLINUX config (USB)` option. A new menu
should appear in GRUB, showing the boot options for that distro; this is a GRUB
menu, converted from the usual ISOLINUX menu provided by that distro.
## Booting ISOLINUX Images (Manual Method)
These are generic instructions. They may or may not be correct for your
2023-04-09 23:38:30 +02:00
distribution. You must adapt them appropriately, for whatever Linux
2021-05-18 14:21:48 +02:00
distribution it is that you are trying to install.
If the `ISOLINUX parser` or `Search for GRUB configuration` options won't work,
then press `C` in GRUB to access the command line, then run the `ls` command:
2023-01-08 02:22:04 +01:00
ls
2021-05-18 14:21:48 +02:00
Get the device name from the above output (e.g., `usb0`). Here's an example:
2023-01-08 02:22:04 +01:00
cat (usb0)/isolinux/isolinux.cfg
2021-05-18 14:21:48 +02:00
Either the output of this command will be the ISOLINUX menuentries for that
ISO, or link to other `.cfg` files (e.g, **/isolinux/foo.cfg**). For example,
if the file found were **foo.cfg**, you would use this command:
2023-01-08 02:22:04 +01:00
cat (usb0)/isolinux/foo.cg`
2021-05-18 14:21:48 +02:00
And so on, until you find the correct menuentries for ISOLINUX.
For Debian-based distros (e.g., Ubuntu, Devuan), there are typically
menuentries listed in **/isolinux/txt.cfg** or **/isolinux/gtk.cfg**. For
dual-architecture ISO images (i686 and x86\_64), there may be separate files
directories for each architecture. Just keep searching through the image,
until you find the correct ISOLINUX configuration file.
**NOTE: Debian 8.6 ISO only lists 32-bit boot options in txt.cfg.
This is important, if you want 64-bit booting on your system. Devuan versions
based on Debian 8.x may also have the same issue.**
Now, look at the ISOLINUX menuentry; it'll look like this:
2023-01-08 02:22:04 +01:00
kernel /path/to/kernel append PARAMETERS initrd=/path/to/initrd ...
2021-05-18 14:21:48 +02:00
GRUB works similarly; here are some example GRUB commands:
2023-01-08 02:22:04 +01:00
```
set root='usb0'
linux /path/to/kernel PARAMETERS MAYBE_MORE_PARAMETERS
initrd /path/to/initrd
boot
```
2021-05-18 14:21:48 +02:00
Note: `usb0` may be incorrect. Check the output of the `ls` command (in GRUB),
to see a list of USB devices/partitions. Of course, this will vary from distro
to distro. If you did all of that correctly, then it should now be booting your
USB drive in the way that you specified.
## Troubleshooting
Most of these issues occur when using libreboot with coreboot's `text-mode`
2021-05-18 14:21:48 +02:00
with libgfxinit for video initialization. This mode is useful for text mode
2023-04-09 23:38:30 +02:00
payloads, like `MemTest86+`, which expect `text-mode`, but for Linux
2021-05-18 14:21:48 +02:00
distributions it can be problematic when they are trying to switch to a
framebuffer, because no mode switching support is present (Linux/BSD kernels
do Kernel Mode Setting, so they are able to initialize a frame buffer in bare
metal regardless of whatever coreboot is doing).
### debian-installer Graphical Corruption in Text-Mode (Debian and Devuan)
When using the ROM images that use Coreboot's `text mode`, instead of the
coreboot framebuffer, while using libgfxinit, booting the Debian or Devuan net
installer results in graphical corruption, because it is trying to switch to a
framebuffer while no mode switching support is present. Use this kernel
parameter on the `linux` line, when booting it:
2023-01-08 02:22:04 +01:00
fb=false
2021-05-18 14:21:48 +02:00
This forces debian-installer to start in `text-mode`, instead of trying to
switch to a framebuffer.
If selecting `text-mode` from a GRUB menu created using the ISOLINUX parser,
you can press `E` on the menu entry to add this. Or, if you are booting
manually (from GRUB terminal), then just add the parameters.