§2023-10-27

systemd-boot, formerly known as gummiboot (rubber dinghy), is a minimal UEFI boot manager.

¶Features

¶ Installation

systemd-boot is included within sys-apps/systemd and, for users of non-systemd-init systems, sys-apps/systemd-utils.

make menuconfig Because systemd-boot can only load EFI executables, the desired kernel must support EFI stub (CONFIG_EFI_STUB=y):

Processor type and features  --->
    [*] EFI runtime service support
    [*]   EFI stub support
    [*]     EFI mixed-mode support
Kernel

¶systemd

For versions of systemd >= 254, emerge sys-apps/systemd with the boot USE flag enabled:

emerge --ask app-portage/gentoolkit

(chroot) x8664Arch /usr/src/linux-6.1.57-gentoo # equery --quiet list systemd
sys-apps/systemd-253.11

root #mkdir -p /etc/portage/package.use root #echo "sys-apps/systemd boot" >> /etc/portage/package.use/systemd root #emerge --ask --oneshot --verbose sys-apps/systemd

> --oneshot: This option tells Portage to treat the specified package as a one-time installation, meaning that it won't be added to your system's world file. The world file is a record of installed packages that Portage keeps for managing your system.

¶ Make sure the system is booted with efi support

```bash
(chroot) h2Jammy / # ls /sys/firmware/efi/efivars
Boot0000-8be4df61-93ca-11d2-aa0d-00e098032b8c           ConOut-8be4df61-93ca-11d2-aa0d-00e098032b8c                         MemoryOverwriteRequestControlLock-bb983ccf-151d-40e1-a07b-4a17be168292  SSRAMBASE-9cfa1ece-4488-49be-9a4b-e9b511826577
Boot0001-8be4df61-93ca-11d2-aa0d-00e098032b8c           ConOutDev-8be4df61-93ca-11d2-aa0d-00e098032b8c                      MokListRT-605dab50-e046-4300-abb6-3dd810dd8b23                          SbatLevelRT-605dab50-e046-4300-abb6-3dd810dd8b23
Boot0002-8be4df61-93ca-11d2-aa0d-00e098032b8c           DefaultBootOrder-45cf35f6-0d6e-4d04-856a-0370a5b16f53               MokListTrustedRT-605dab50-e046-4300-abb6-3dd810dd8b23                   SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c
Boot0003-8be4df61-93ca-11d2-aa0d-00e098032b8c           DeploymentModeNv-97e8965f-c761-4f48-b6e4-9ffa9cb2a2d6               MokListXRT-605dab50-e046-4300-abb6-3dd810dd8b23                         SetUpdateCountVar-81c76078-bfde-4368-9790-570914c01a65
Boot0004-8be4df61-93ca-11d2-aa0d-00e098032b8c           EPCBIOS-c60aa7f6-e8d6-4956-8ba1-fe26298f5e87                        MonotonicCounter-01368881-c4ad-4b1d-b631-d57a8ec8db6b                   SetupMode-8be4df61-93ca-11d2-aa0d-00e098032b8c
Boot0005-8be4df61-93ca-11d2-aa0d-00e098032b8c           EfiTime-9d0da369-540b-46f8-85a0-2b5f2c301e15                        OA3MSDMvariable-01368881-c4ad-4b1d-b631-d57a8ec8db6b                    SignatureSupport-8be4df61-93ca-11d2-aa0d-00e098032b8c
Boot0006-8be4df61-93ca-11d2-aa0d-00e098032b8c           ErrOut-8be4df61-93ca-11d2-aa0d-00e098032b8c                         OsIndications-8be4df61-93ca-11d2-aa0d-00e098032b8c                      SmbiosEntryPointTable-4b3082a3-80c6-4d7e-9cd0-583917265df1
Boot0007-8be4df61-93ca-11d2-aa0d-00e098032b8c           ErrOutDev-8be4df61-93ca-11d2-aa0d-00e098032b8c                      OsIndicationsSupported-8be4df61-93ca-11d2-aa0d-00e098032b8c             SmbiosScratchBuffer-4b3082a3-80c6-4d7e-9cd0-583917265df1
Boot0008-8be4df61-93ca-11d2-aa0d-00e098032b8c           FPDT_Volatile-01368881-c4ad-4b1d-b631-d57a8ec8db6b                  PK-8be4df61-93ca-11d2-aa0d-00e098032b8c                                 SmbiosV3EntryPointTable-4b3082a3-80c6-4d7e-9cd0-583917265df1
Boot0009-8be4df61-93ca-11d2-aa0d-00e098032b8c           IBBROBBBase-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9                    PKDefault-8be4df61-93ca-11d2-aa0d-00e098032b8c                          Timeout-8be4df61-93ca-11d2-aa0d-00e098032b8c
Boot000B-8be4df61-93ca-11d2-aa0d-00e098032b8c           ItkBiosModVar-3812723d-7e48-4e29-bc27-f5a39ac94ef1                  PlatformInfo-19ad5244-fd6b-4e5c-826a-414646d6da6a                       VendorKeys-8be4df61-93ca-11d2-aa0d-00e098032b8c
BootCurrent-8be4df61-93ca-11d2-aa0d-00e098032b8c        KEK-8be4df61-93ca-11d2-aa0d-00e098032b8c                            PlatformLang-8be4df61-93ca-11d2-aa0d-00e098032b8c                       WriteOnceStatus-4b3082a3-80c6-4d7e-9cd0-583917265df1
BootOptionSupport-8be4df61-93ca-11d2-aa0d-00e098032b8c  KEKDefault-8be4df61-93ca-11d2-aa0d-00e098032b8c                     PlatformLangCodes-8be4df61-93ca-11d2-aa0d-00e098032b8c                  db-d719b2cb-3d3a-4596-a3bc-dad00e67656f
BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c          LoaderSystemToken-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f              PlatformRelatedInfo-fd72b1b5-5391-4c6a-bdfd-9f59a7880a21                dbDefault-8be4df61-93ca-11d2-aa0d-00e098032b8c
ConIn-8be4df61-93ca-11d2-aa0d-00e098032b8c              MaximumTableSize-4b3082a3-80c6-4d7e-9cd0-583917265df1               SLP20Magic-41282ef2-9b5a-4eb7-95d8-d9cd7bdce367                         dbx-d719b2cb-3d3a-4596-a3bc-dad00e67656f
ConInDev-8be4df61-93ca-11d2-aa0d-00e098032b8c           MemoryOverwriteRequestControl-e20939be-32d4-41be-a150-897f85d49829  SOFTWAREGUARDSTATUS-9cb2e73f-7325-40f4-a484-659bb344c3cd                dbxDefault-8be4df61-93ca-11d2-aa0d-00e098032b8c

¶ Note

bootctl will attempt to automatically identify an ESP mounted at /efi, /boot, or /boot/efi (in that order). If the ESP is mounted elsewhere, pass the --esp-path option to specify the appropriate location.

I prefer using /boot/efi

(chroot) h2Jammy / # mkdir /boot/efi
(chroot) h2Jammy / # mount /dev/sdb1 /boot/efi
(chroot) h2Jammy / # bootctl install
Created "/boot/efi/EFI/systemd".
Created "/boot/efi/EFI/BOOT".
Created "/boot/efi/EFI/Linux".
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/efi/EFI/systemd/systemd-bootx64.efi".
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/efi/EFI/BOOT/BOOTX64.EFI".
Random seed file /boot/efi/loader/random-seed successfully written (32 bytes).
Created EFI boot entry "Linux Boot Manager".

/boot/
├── efi
│   ├── EFI
│   │   ├── BOOT
│   │   │   └── BOOTX64.EFI
│   │   ├── gentoo
│   │   │   └── grubx64.efi
│   │   ├── Linux
│   │   └── systemd
│   │       └── systemd-bootx64.efi
│   ├── gentoo
│   │   └── 6.1.57-gentoo-x86_64
│   │       ├── initrd
│   │       └── linux
│   └── loader
│       ├── entries
│       │   └── gentoo-6.1.57-gentoo-x86_64.conf
│       ├── entries.srel
│       ├── loader.conf
│       └── random-seed
├── initramfs-6.1.57-gentoo-x86_64.img
├── System.map-6.1.57-gentoo-x86_64
└── vmlinuz-6.1.57-gentoo-x86_64

11 directories, 12 files
(chroot) h2Jammy / # cat /boot/efi/loader/entries/gentoo-6.1.57-gentoo-x86_64.conf 
# Boot Loader Specification type#1 entry
# File created by /usr/lib/kernel/install.d/90-loaderentry.install (systemd 253)
# title      Gentoo Linux
# version    6.1.57-gentoo-x86_64
# sort-key   gentoo
# options    root=UUID=f8023652-925e-46ef-8d10-e6c74d620beb ro quiet splash vt.handoff=7
# linux      /gentoo/6.1.57-gentoo-x86_64/linux
# initrd     /gentoo/6.1.57-gentoo-x86_64/initrd

# Boot Loader Specification type#1 entry
# File created by /usr/lib/kernel/install.d/90-loaderentry.install (systemd 253)
title      Gentoo Linux
version    6.1.57-gentoo-x86_64
sort-key   gentoo
options    root=UUID=4a47f5a1-b321-4b88-8342-b6753403a93c ro quiet splash vt.handoff=7
linux      /vmlinuz-6.1.57-gentoo-x86_64
initrd     /initramfs-6.1.57-gentoo-x86_64.img
(chroot) h2Jammy / # sudo mouont /dev/sdb1 /boot/efi
bash: sudo: command not found
(chroot) h2Jammy / #  mount /dev/sdb1 /boot/efi
(chroot) h2Jammy / # tree boot/
boot/
├── efi
│   ├── EFI
│   │   ├── BOOT
│   │   │   └── BOOTX64.EFI
│   │   ├── gentoo
│   │   │   └── grubx64.efi
│   │   ├── Linux
│   │   └── systemd
│   │       └── systemd-bootx64.efi
│   ├── gentoo
│   │   └── 6.1.57-gentoo-x86_64
│   │       ├── initrd
│   │       └── linux
│   └── loader
│       ├── entries
│       │   └── gentoo-6.1.57-gentoo-x86_64.conf
│       ├── entries.srel
│       ├── loader.conf
│       └── random-seed
├── initramfs-6.1.57-gentoo-x86_64.img
├── System.map-6.1.57-gentoo-x86_64
└── vmlinuz-6.1.57-gentoo-x86_64

11 directories, 12 files
(chroot) h2Jammy / # grub-install --efi-directory=/boot/efi
Installing for x86_64-efi platform.
Installation finished. No error reported.
(chroot) h2Jammy / # tree boot/
boot/
├── efi
│   ├── EFI
│   │   ├── BOOT
│   │   │   └── BOOTX64.EFI
│   │   ├── gentoo
│   │   │   └── grubx64.efi
│   │   ├── Linux
│   │   └── systemd
│   │       └── systemd-bootx64.efi
│   ├── gentoo
│   │   └── 6.1.57-gentoo-x86_64
│   │       ├── initrd
│   │       └── linux
│   └── loader
│       ├── entries
│       │   └── gentoo-6.1.57-gentoo-x86_64.conf
│       ├── entries.srel
│       ├── loader.conf
│       └── random-seed
├── grub
│   ├── fonts
│   │   └── unicode.pf2
│   ├── grubenv
│   ├── locale
│   │   ├── ast.mo
│   │   ├── ca.mo
│   │   ├── da.mo
│   │   ├── de_CH.mo
│   │   ├── de@hebrew.mo
│   │   ├── de.mo
│   │   ├── en@arabic.mo
│   │   ├── en@cyrillic.mo
│   │   ├── en@greek.mo
│   │   ├── en@hebrew.mo
│   │   ├── en@piglatin.mo
│   │   ├── en@quot.mo
│   │   ├── eo.mo
│   │   ├── es.mo
│   │   ├── fi.mo
│   │   ├── fr.mo
│   │   ├── gl.mo
│   │   ├── hr.mo
│   │   ├── hu.mo
│   │   ├── id.mo
│   │   ├── it.mo
│   │   ├── ja.mo
│   │   ├── ko.mo
│   │   ├── lg.mo
│   │   ├── lt.mo
│   │   ├── nb.mo
│   │   ├── nl.mo
│   │   ├── pa.mo
│   │   ├── pl.mo
│   │   ├── pt_BR.mo
│   │   ├── pt.mo
│   │   ├── ro.mo
│   │   ├── ru.mo
│   │   ├── sl.mo
│   │   ├── sr.mo
│   │   ├── sv.mo
│   │   ├── tr.mo
│   │   ├── uk.mo
│   │   ├── vi.mo
│   │   ├── zh_CN.mo
│   │   └── zh_TW.mo
│   ├── themes
│   │   └── starfield
│   │       ├── blob_w.png
│   │       ├── boot_menu_c.png
│   │       ├── boot_menu_e.png
│   │       ├── boot_menu_ne.png
│   │       ├── boot_menu_n.png
│   │       ├── boot_menu_nw.png
│   │       ├── boot_menu_se.png
│   │       ├── boot_menu_s.png
│   │       ├── boot_menu_sw.png
│   │       ├── boot_menu_w.png
│   │       ├── COPYING.CC-BY-SA-3.0
│   │       ├── dejavu_10.pf2
│   │       ├── dejavu_12.pf2
│   │       ├── dejavu_14.pf2
│   │       ├── dejavu_16.pf2
│   │       ├── dejavu_bold_14.pf2
│   │       ├── README
│   │       ├── slider_c.png
│   │       ├── slider_n.png
│   │       ├── slider_s.png
│   │       ├── starfield.png
│   │       ├── terminal_box_c.png
│   │       ├── terminal_box_e.png
│   │       ├── terminal_box_ne.png
│   │       ├── terminal_box_n.png
│   │       ├── terminal_box_nw.png
│   │       ├── terminal_box_se.png
│   │       ├── terminal_box_s.png
│   │       ├── terminal_box_sw.png
│   │       ├── terminal_box_w.png
│   │       └── theme.txt
│   └── x86_64-efi
│       ├── acpi.mod
│       ├── adler32.mod
│       ├── affs.mod
│       ├── afs.mod
│       ├── afsplitter.mod
│       ├── ahci.mod
│       ├── all_video.mod
│       ├── aout.mod
│       ├── appleldr.mod
│       ├── archelp.mod
│       ├── ata.mod
│       ├── at_keyboard.mod
│       ├── backtrace.mod
│       ├── bfs.mod
│       ├── bitmap.mod
│       ├── bitmap_scale.mod
│       ├── blocklist.mod
│       ├── boot.mod
│       ├── bsd.mod
│       ├── bswap_test.mod
│       ├── btrfs.mod
│       ├── bufio.mod
│       ├── cat.mod
│       ├── cbfs.mod
│       ├── cbls.mod
│       ├── cbmemc.mod
│       ├── cbtable.mod
│       ├── cbtime.mod
│       ├── chain.mod
│       ├── cmdline_cat_test.mod
│       ├── cmp.mod
│       ├── cmp_test.mod
│       ├── command.lst
│       ├── configfile.mod
│       ├── core.efi
│       ├── cpio_be.mod
│       ├── cpio.mod
│       ├── cpuid.mod
│       ├── crc64.mod
│       ├── cryptodisk.mod
│       ├── crypto.lst
│       ├── crypto.mod
│       ├── cs5536.mod
│       ├── ctz_test.mod
│       ├── datehook.mod
│       ├── date.mod
│       ├── datetime.mod
│       ├── diskfilter.mod
│       ├── disk.mod
│       ├── div.mod
│       ├── div_test.mod
│       ├── dm_nv.mod
│       ├── echo.mod
│       ├── efifwsetup.mod
│       ├── efi_gop.mod
│       ├── efinet.mod
│       ├── efi_uga.mod
│       ├── ehci.mod
│       ├── elf.mod
│       ├── eval.mod
│       ├── exfat.mod
│       ├── exfctest.mod
│       ├── ext2.mod
│       ├── extcmd.mod
│       ├── f2fs.mod
│       ├── fat.mod
│       ├── file.mod
│       ├── fixvideo.mod
│       ├── font.mod
│       ├── fshelp.mod
│       ├── fs.lst
│       ├── functional_test.mod
│       ├── gcry_arcfour.mod
│       ├── gcry_blowfish.mod
│       ├── gcry_camellia.mod
│       ├── gcry_cast5.mod
│       ├── gcry_crc.mod
│       ├── gcry_des.mod
│       ├── gcry_dsa.mod
│       ├── gcry_idea.mod
│       ├── gcry_md4.mod
│       ├── gcry_md5.mod
│       ├── gcry_rfc2268.mod
│       ├── gcry_rijndael.mod
│       ├── gcry_rmd160.mod
│       ├── gcry_rsa.mod
│       ├── gcry_seed.mod
│       ├── gcry_serpent.mod
│       ├── gcry_sha1.mod
│       ├── gcry_sha256.mod
│       ├── gcry_sha512.mod
│       ├── gcry_tiger.mod
│       ├── gcry_twofish.mod
│       ├── gcry_whirlpool.mod
│       ├── geli.mod
│       ├── gettext.mod
│       ├── gfxmenu.mod
│       ├── gfxterm_background.mod
│       ├── gfxterm_menu.mod
│       ├── gfxterm.mod
│       ├── gptsync.mod
│       ├── grub.efi
│       ├── gzio.mod
│       ├── halt.mod
│       ├── hashsum.mod
│       ├── hdparm.mod
│       ├── hello.mod
│       ├── help.mod
│       ├── hexdump.mod
│       ├── hfs.mod
│       ├── hfspluscomp.mod
│       ├── hfsplus.mod
│       ├── http.mod
│       ├── iorw.mod
│       ├── iso9660.mod
│       ├── jfs.mod
│       ├── jpeg.mod
│       ├── json.mod
│       ├── keylayouts.mod
│       ├── keystatus.mod
│       ├── ldm.mod
│       ├── legacycfg.mod
│       ├── legacy_password_test.mod
│       ├── linux16.mod
│       ├── linux.mod
│       ├── loadbios.mod
│       ├── loadenv.mod
│       ├── loopback.mod
│       ├── lsacpi.mod
│       ├── lsefimmap.mod
│       ├── lsefi.mod
│       ├── lsefisystab.mod
│       ├── lsmmap.mod
│       ├── ls.mod
│       ├── lspci.mod
│       ├── lssal.mod
│       ├── luks2.mod
│       ├── luks.mod
│       ├── lvm.mod
│       ├── lzopio.mod
│       ├── macbless.mod
│       ├── macho.mod
│       ├── mdraid09_be.mod
│       ├── mdraid09.mod
│       ├── mdraid1x.mod
│       ├── memdisk.mod
│       ├── memrw.mod
│       ├── minicmd.mod
│       ├── minix2_be.mod
│       ├── minix2.mod
│       ├── minix3_be.mod
│       ├── minix3.mod
│       ├── minix_be.mod
│       ├── minix.mod
│       ├── mmap.mod
│       ├── moddep.lst
│       ├── modinfo.sh
│       ├── morse.mod
│       ├── mpi.mod
│       ├── msdospart.mod
│       ├── mul_test.mod
│       ├── multiboot2.mod
│       ├── multiboot.mod
│       ├── nativedisk.mod
│       ├── net.mod
│       ├── newc.mod
│       ├── nilfs2.mod
│       ├── normal.mod
│       ├── ntfscomp.mod
│       ├── ntfs.mod
│       ├── odc.mod
│       ├── offsetio.mod
│       ├── ohci.mod
│       ├── part_acorn.mod
│       ├── part_amiga.mod
│       ├── part_apple.mod
│       ├── part_bsd.mod
│       ├── part_dfly.mod
│       ├── part_dvh.mod
│       ├── part_gpt.mod
│       ├── partmap.lst
│       ├── part_msdos.mod
│       ├── part_plan.mod
│       ├── part_sun.mod
│       ├── part_sunpc.mod
│       ├── parttool.lst
│       ├── parttool.mod
│       ├── password.mod
│       ├── password_pbkdf2.mod
│       ├── pata.mod
│       ├── pbkdf2.mod
│       ├── pbkdf2_test.mod
│       ├── pcidump.mod
│       ├── pgp.mod
│       ├── play.mod
│       ├── png.mod
│       ├── priority_queue.mod
│       ├── probe.mod
│       ├── procfs.mod
│       ├── progress.mod
│       ├── raid5rec.mod
│       ├── raid6rec.mod
│       ├── random.mod
│       ├── rdmsr.mod
│       ├── read.mod
│       ├── reboot.mod
│       ├── regexp.mod
│       ├── reiserfs.mod
│       ├── relocator.mod
│       ├── romfs.mod
│       ├── scsi.mod
│       ├── search_fs_file.mod
│       ├── search_fs_uuid.mod
│       ├── search_label.mod
│       ├── search.mod
│       ├── serial.mod
│       ├── setjmp.mod
│       ├── setjmp_test.mod
│       ├── setpci.mod
│       ├── sfs.mod
│       ├── shift_test.mod
│       ├── signature_test.mod
│       ├── sleep.mod
│       ├── sleep_test.mod
│       ├── smbios.mod
│       ├── spkmodem.mod
│       ├── squash4.mod
│       ├── strtoull_test.mod
│       ├── syslinuxcfg.mod
│       ├── tar.mod
│       ├── terminal.lst
│       ├── terminal.mod
│       ├── terminfo.mod
│       ├── test_blockarg.mod
│       ├── testload.mod
│       ├── test.mod
│       ├── testspeed.mod
│       ├── tftp.mod
│       ├── tga.mod
│       ├── time.mod
│       ├── tpm.mod
│       ├── trig.mod
│       ├── tr.mod
│       ├── true.mod
│       ├── udf.mod
│       ├── ufs1_be.mod
│       ├── ufs1.mod
│       ├── ufs2.mod
│       ├── uhci.mod
│       ├── usb_keyboard.mod
│       ├── usb.mod
│       ├── usbms.mod
│       ├── usbserial_common.mod
│       ├── usbserial_ftdi.mod
│       ├── usbserial_pl2303.mod
│       ├── usbserial_usbdebug.mod
│       ├── usbtest.mod
│       ├── video_bochs.mod
│       ├── video_cirrus.mod
│       ├── video_colors.mod
│       ├── video_fb.mod
│       ├── videoinfo.mod
│       ├── video.lst
│       ├── video.mod
│       ├── videotest_checksum.mod
│       ├── videotest.mod
│       ├── wrmsr.mod
│       ├── xfs.mod
│       ├── xnu.mod
│       ├── xnu_uuid.mod
│       ├── xnu_uuid_test.mod
│       ├── xzio.mod
│       ├── zfscrypt.mod
│       ├── zfsinfo.mod
│       ├── zfs.mod
│       └── zstd.mod
├── initramfs-6.1.57-gentoo-x86_64.img
├── System.map-6.1.57-gentoo-x86_64
└── vmlinuz-6.1.57-gentoo-x86_64

17 directories, 362 files
(chroot) h2Jammy / #

(chroot) x8664Arch / # grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.1.57-gentoo-x86_64
Found initrd image: /boot/initramfs-6.1.57-gentoo-x86_64.img
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done

(chroot) x8664Arch / # cat /boot/grub/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod ext2
set root='hd1,gpt3'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt3 --hint-efi=hd1,gpt3 --hint-baremetal=ahci1,gpt3  4a47f5a1-b321-4b88-8342-b6753403a93c
else
  search --no-floppy --fs-uuid --set=root 4a47f5a1-b321-4b88-8342-b6753403a93c
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-4a47f5a1-b321-4b88-8342-b6753403a93c' {
	load_video
	if [ "x$grub_platform" = xefi ]; then
		set gfxpayload=keep
	fi
	insmod gzio
	insmod part_gpt
	insmod ext2
	set root='hd1,gpt3'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt3 --hint-efi=hd1,gpt3 --hint-baremetal=ahci1,gpt3  4a47f5a1-b321-4b88-8342-b6753403a93c
	else
	  search --no-floppy --fs-uuid --set=root 4a47f5a1-b321-4b88-8342-b6753403a93c
	fi
	echo	'Loading Linux 6.1.57-gentoo-x86_64 ...'
	linux	/boot/vmlinuz-6.1.57-gentoo-x86_64 root=UUID=4a47f5a1-b321-4b88-8342-b6753403a93c ro  
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initramfs-6.1.57-gentoo-x86_64.img
}
submenu 'Advanced options for Gentoo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-4a47f5a1-b321-4b88-8342-b6753403a93c' {
	menuentry 'Gentoo GNU/Linux, with Linux 6.1.57-gentoo-x86_64' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.57-gentoo-x86_64-advanced-4a47f5a1-b321-4b88-8342-b6753403a93c' {
		load_video
		if [ "x$grub_platform" = xefi ]; then
			set gfxpayload=keep
		fi
		insmod gzio
		insmod part_gpt
		insmod ext2
		set root='hd1,gpt3'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt3 --hint-efi=hd1,gpt3 --hint-baremetal=ahci1,gpt3  4a47f5a1-b321-4b88-8342-b6753403a93c
		else
		  search --no-floppy --fs-uuid --set=root 4a47f5a1-b321-4b88-8342-b6753403a93c
		fi
		echo	'Loading Linux 6.1.57-gentoo-x86_64 ...'
		linux	/boot/vmlinuz-6.1.57-gentoo-x86_64 root=UUID=4a47f5a1-b321-4b88-8342-b6753403a93c ro  
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initramfs-6.1.57-gentoo-x86_64.img
	}
	menuentry 'Gentoo GNU/Linux, with Linux 6.1.57-gentoo-x86_64 (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.57-gentoo-x86_64-recovery-4a47f5a1-b321-4b88-8342-b6753403a93c' {
		load_video
		if [ "x$grub_platform" = xefi ]; then
			set gfxpayload=keep
		fi
		insmod gzio
		insmod part_gpt
		insmod ext2
		set root='hd1,gpt3'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt3 --hint-efi=hd1,gpt3 --hint-baremetal=ahci1,gpt3  4a47f5a1-b321-4b88-8342-b6753403a93c
		else
		  search --no-floppy --fs-uuid --set=root 4a47f5a1-b321-4b88-8342-b6753403a93c
		fi
		echo	'Loading Linux 6.1.57-gentoo-x86_64 ...'
		linux	/boot/vmlinuz-6.1.57-gentoo-x86_64 root=UUID=4a47f5a1-b321-4b88-8342-b6753403a93c ro single 
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initramfs-6.1.57-gentoo-x86_64.img
	}
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
	fwsetup
}
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg
fi
### END /etc/grub.d/41_custom ###
¶ set up alexlai

(chroot) h2Jammy / # useradd -u 1026 -m -G wheel,video alexlai (chroot) h2Jammy / # passwd alexlai (chroot) h2Jammy / # passwd root


¶dhcpcd

```bash
(chroot) h2Jammy / # emerge net-misc/dhcpc
(chroot) h2Jammy / # emerge net-misc/openssh

Booting From grub>

This is how to set the boot files and boot the system from the grub> prompt. We know from running the ls command that there is a Linux root filesystem on (hd0,1), and you can keep searching until you verify where /boot/grub is. Then run these commands, using your own root partition, kernel, and initrd image:

grub> ls
(hd0) (hd0,gpt3) (hd0,gpt2) (hd0,gpt1) (hd1) (hd1,gpt3)) (hd1,gpt2)) (hd1,gpt1)
grub> set root=(hd1,gpt3)
grub> linux /boot/vmlinuz-6.1.57-genyoo-x86_64 root=/dev/sdb3
grub> initrd /boot/initramfs-6.1.57-genyoo-x86_64.img
grub> boot

The first line sets the partition that the root filesystem is on. The second line tells GRUB the location of the kernel you want to use. Start typing /boot/vmli, and then use tab-completion to fill in the rest. Type root=/dev/sdX to set the location of the root filesystem. Yes, this seems redundant, but if you leave this out you’ll get a kernel panic. How do you know the correct partition? hd0,1 = /dev/sda1. hd1,1 = /dev/sdb1. hd3,2 = /dev/sdd2. I think you can extrapolate the rest.

The third line sets the initrd file, which must be the same version number as the kernel.

The fourth line boots your system.