<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nonas</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nonas"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Nonas"/>
	<updated>2026-05-04T03:19:06Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bootloaders&amp;diff=26135</id>
		<title>Bootloaders</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bootloaders&amp;diff=26135"/>
		<updated>2024-01-06T22:20:05Z</updated>

		<summary type="html">&lt;p&gt;Nonas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This page shows the basic steps you need to perform, if you for any reason want to switch bootloaders or apply some manual configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[[#rEFInd|rEFInd]]&amp;lt;/code&amp;gt; is an easy to use EFI boot menu that allows booting different operating systems.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;[[#Syslinux|Syslinux]]&amp;lt;/code&amp;gt; is the default light-weight bootloader used in Alpine.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;[[#GRUB|GRUB]]&amp;lt;/code&amp;gt; is a standard linux boot loader.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;[[#EFI_Boot_Stub|EFI Boot Stub]]&amp;lt;/code&amp;gt; allows booting linux directly from a motherboard supporting UEFI or another bootloader.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= rEFInd =&lt;br /&gt;
&lt;br /&gt;
For (U)EFI systems, the {{pkg|refind}} package can provide a graphical EFI boot menu that allows to boot operating systems that are found on the available partitions.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;refind&amp;lt;/code&amp;gt; is not yet available in the used alpine release, it may be installed in another dual/multi-booted linux distribution.&lt;br /&gt;
&lt;br /&gt;
For example, with a Debian based distribution, it can be installed to the EFI partition like this:&lt;br /&gt;
 &lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;# apt install refind             # installs the debian package&lt;br /&gt;
# refind-install --alldrivers    # installs refind to the EFI partition&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
(The &amp;lt;code&amp;gt;--alldrivers&amp;lt;/code&amp;gt; option includes all filesystem drivers instead of only the one needed to load the currently running kernel, to allow finding and booting operating systems from more partitions.)&lt;br /&gt;
&lt;br /&gt;
And a first (default) boot menu line needs to be configured with Alpine&#039;s default boot parameters. Assuming the bootable partition is mounted at {{path|/media/sdXY}} it can be done like this (at time of writing):&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;# echo &#039;&amp;quot;Alpine&amp;quot; &amp;quot;modules=loop,squashfs,sd-mod,usb-storage quiet initrd=\boot\intel-ucode.img initrd=\boot\amd-ucode.img initrd=\boot\initramfs-lts&amp;quot;&#039; &amp;gt; /media/sdXY/boot/refind_linux.conf&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
{{Note|At the time of writing, it was still needed to use backslashes in the .conf file.&amp;lt;br&amp;gt;&lt;br /&gt;
The path in the config file needs to be relative to the partition that the kernel resides on. If {{path|/boot}} resides on its own separate partition, then &amp;lt;code&amp;gt;\boot&amp;lt;/code&amp;gt; needs to be removed from the paths.}}&lt;br /&gt;
&lt;br /&gt;
= Syslinux =&lt;br /&gt;
&lt;br /&gt;
If you want to switch from another bootloader back to Syslinux, or if you for some reason want to install Syslinux manually, the following steps are required.&lt;br /&gt;
&lt;br /&gt;
Install the {{pkg|syslinux}} package:&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add syslinux}}&lt;br /&gt;
&lt;br /&gt;
If you&#039;re using GPT partitions, install the GPT MBR onto the drive you want to install the bootloader on (in this case {{path|/dev/sda}}):&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;# dd bs=440 count=1 conv=notrunc if=/usr/share/syslinux/gptmbr.bin of=/dev/sda&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Or if you&#039;re using DOS partitions, install the DOS MBR instead:&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;# dd bs=440 count=1 conv=notrunc if=/usr/share/syslinux/mbr.bin of=/dev/sda&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- See also: http://www.syslinux.org/wiki/index.php?title=Mbr --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next install the required Syslinux binaries. Despite being called &amp;lt;code&amp;gt;extlinux&amp;lt;/code&amp;gt;, Syslinux supports booting from FAT12/16/32, NTFS, ext2/3/4, [[Btrfs|btrfs]], XFS, and UFS/FFS filesystems.&lt;br /&gt;
&lt;br /&gt;
{{cmd|# extlinux --install /boot}}&lt;br /&gt;
&lt;br /&gt;
The configuration file is located in {{path|/boot/extlinux.conf}}.&lt;br /&gt;
Alpine ships with a script called &amp;lt;code&amp;gt;update-extlinux&amp;lt;/code&amp;gt; which automatically (re)generates this file, for example on updates to Syslinux.&lt;br /&gt;
The settings for this script can be found in {{path|/etc/update-extlinux.conf}}, including the option to disable automatic overwriting of {{path|/boot/extlinux.conf}}.&lt;br /&gt;
You can also place additional menu entries in the {{path|/etc/update-extlinux.d/}} directory, e.g. for dual booting.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== EFI ===&lt;br /&gt;
&lt;br /&gt;
{{Todo|Work in progress. This should at least get you started.}}&lt;br /&gt;
&lt;br /&gt;
Assuming {{path|/mnt}} is a FAT32 partition of type EF00 and {{path|/boot}} belongs to the rootfs created after running &amp;lt;code&amp;gt;setup-disk&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;# mkdir -p /mnt/EFI/syslinux&lt;br /&gt;
# cp /usr/share/syslinux/efi64/* /mnt/EFI/syslinux/&lt;br /&gt;
# cp /boot/extlinux.conf /mnt/EFI/syslinux/syslinux.cfg&lt;br /&gt;
# cp /boot/vmlinuz* /mnt/EFI/syslinux/&lt;br /&gt;
# cp /boot/initramfs* /mnt/EFI/syslinux/&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
You may need to modify {{path|/mnt/EFI/syslinux/syslinux.cfg}} to change the paths to absolute paths (just add a / in front of the vmlinuz/initramfs entries),&lt;br /&gt;
or copy the files to {{path|/mnt/EFI/syslinux}} instead (XXX: untested).&lt;br /&gt;
&lt;br /&gt;
At the end, the file {{path|/mnt/EFI/syslinux/syslinux.cfg}} should look like this:&lt;br /&gt;
{{cat|/mnt/EFI/syslinux/syslinux.cfg|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
DEFAULT menu.c32&lt;br /&gt;
PROMPT 0&lt;br /&gt;
MENU TITLE Alpine/Linux Boot Menu&lt;br /&gt;
MENU HIDDEN&lt;br /&gt;
MENU AUTOBOOT Alpine will be booted automatically in # seconds&lt;br /&gt;
TIMEOUT 10&lt;br /&gt;
LABEL lts&lt;br /&gt;
  MENU DEFAULT&lt;br /&gt;
  MENU LABEL Linux lts&lt;br /&gt;
  LINUX /vmlinuz-lts&lt;br /&gt;
  INITRD /initrd-lts&lt;br /&gt;
  APPEND root=/dev/sda3 modules=sd-load,usb-storage,ext4 quiet&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
And finally, add syslinux to EFI boot menu (assuming {{path|/dev/sda}} is your hard drive)&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;# apk add efibootmgr&lt;br /&gt;
# efibootmgr -c -d /dev/sda -p 1 -l \\EFI\\syslinux\\syslinux.efi -L &amp;quot;ALPINE-SYSLINUX&amp;quot;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
You can now verify that the boot entry has been added&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;efibootmgr&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
BootCurrent: 0001&lt;br /&gt;
Timeout: 0 seconds&lt;br /&gt;
BootOrder: 0001,0000,0002,...&lt;br /&gt;
Boot001* ALPINE-SYSLINUX HD(1,GPT,xxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)/FILE(\EFI\syslinux\syslinux.efi)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= GRUB =&lt;br /&gt;
&lt;br /&gt;
To install GRUB in BIOS mode, (optionally) remove the Syslinux package and install the required GRUB packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;# apk del syslinux&lt;br /&gt;
# apk add grub grub-bios&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
For EFI, install GRUB&#039;s EFI package instead. Note that {{path|/boot}} has to be an EFI compatible filesystem like FAT32.&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add grub-efi efibootmgr}}&lt;br /&gt;
&lt;br /&gt;
Next install the MBR and GRUB binaries to disk for BIOS mode:&lt;br /&gt;
&lt;br /&gt;
{{cmd|# grub-install /dev/vda}}&lt;br /&gt;
&lt;br /&gt;
For EFI mode:&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;# grub-install --target=x86_64-efi --efi-directory=/boot&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
then add this line to {{path|/etc/default/grub}}:&lt;br /&gt;
{{cat|/etc/default/grub|&amp;lt;nowiki&amp;gt;# GRUB_CMDLINE_LINUX_DEFAULT=&amp;quot;quiet rootfstype=ext4 modules=sd-mod,usb-storage,ext4&amp;quot;&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
GRUB ships with an automatic config generator, including some automatic detection of other operating systems installed on the device:&lt;br /&gt;
&lt;br /&gt;
{{cmd|# grub-mkconfig -o /boot/grub/grub.cfg}}&lt;br /&gt;
&lt;br /&gt;
This script can be configured via the {{path|/etc/default/grub}} file.&lt;br /&gt;
See [https://www.gnu.org/software/grub/manual/html_node/Simple-configuration.html] for a list of available options.&lt;br /&gt;
&lt;br /&gt;
= EFI Boot Stub =&lt;br /&gt;
&lt;br /&gt;
To boot directly from your motherboard&#039;s UEFI boot menu, a boot entry needs&lt;br /&gt;
to be created with either a UEFI shell or &#039;&#039;efibootmgr&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== efibootmgr ==&lt;br /&gt;
&lt;br /&gt;
Install efibootmgr:&lt;br /&gt;
{{cmd|# apk add efibootmgr}}&lt;br /&gt;
&lt;br /&gt;
Create a boot entry. It&#039;s recommended to do this in a script, as efibootmgr&lt;br /&gt;
does not allow editing entries.&lt;br /&gt;
&lt;br /&gt;
{{cat|add-bootentry|&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
params=&amp;quot;root=/dev/sdXZ rootfstype=ext4 rw \&lt;br /&gt;
  initrd=\intel-ucode.img \&lt;br /&gt;
  initrd=\initramfs-lts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
efibootmgr --create --label &amp;quot;Alpine Linux&amp;quot; \&lt;br /&gt;
  --disk /dev/sdX --part Y \&lt;br /&gt;
  --loader /vmlinuz-lts \&lt;br /&gt;
  --unicode &amp;quot;${params}&amp;quot; \&lt;br /&gt;
  --verbose&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Where {{path|/dev/sdXY}} contains the EFI partition and {{path|/dev/sdXZ}} contains the root partition. If you are using {{Pkg|linux-edge}}, replace &amp;lt;code&amp;gt;lts&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;edge&amp;lt;/code&amp;gt; in the script&lt;br /&gt;
&lt;br /&gt;
{{Note|&lt;br /&gt;
The kernel contains the [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/init/do_mounts.c#n254 exhaustive list] of ways to specify the block device. For a more robust boot entry, it is recommended to use a persistent name such as the PARTUUID.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Optionally, set the newly created entry as the default:&lt;br /&gt;
&lt;br /&gt;
{{cmd|# efibootmgr -n XXXX}}&lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;code&amp;gt;XXXX&amp;lt;/code&amp;gt; is the boot number of the new entry.&lt;br /&gt;
&lt;br /&gt;
{{Note|&lt;br /&gt;
The loader and initrd file arguments are relative to the EFI partition. In a default installation, alpine places these files in {{path|/boot/}}, while EFI is mounted to {{path|/boot/efi/}}. You can either update fstab to mount EFI at {{path|/boot/}}, or manually copy them to {{path|/boot/efi/}}.                                                                                           }}&lt;br /&gt;
&lt;br /&gt;
= Using a UKI (UEFI only) =&lt;br /&gt;
&lt;br /&gt;
It is possible to boot directly into a &#039;&#039;&#039;Unified Kernel Image&#039;&#039;&#039; (UKI). A UKI is a single file which contains the initfs, kernel and cmdline. While this is typically done in order to enable [https://en.wikipedia.org/wiki/UEFI SecureBoot], it is perfectly feasible to skip enrolling the custom keys and leave SecureBoot off.&lt;br /&gt;
&lt;br /&gt;
The page [[UEFI Secure Boot]] contains the instructions for setting an a UKI. Additionally, it is possible to install the UKI in the default fallback path used by most UEFI implementations. By installing the UKI into this path, the system will automatically boot into it if no other entries are defined. This can be automated as part of the kernel hook by adding the following to {{path|/etc/kernel-hooks.d/secureboot.conf}}&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/kernel-hooks.d/secureboot.conf|&amp;lt;nowiki&amp;gt;# For the edge kernel, install the UKI into the default UEFI path.&lt;br /&gt;
if [ &amp;quot;$1&amp;quot; == &amp;quot;edge&amp;quot; ]; then&lt;br /&gt;
  output_dir=&amp;quot;/efi/EFI/Boot/&amp;quot;&lt;br /&gt;
  output_name=&amp;quot;bootx64.efi&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
{{path|bootx64.efi}} is only correct for &amp;lt;code&amp;gt;x86_64&amp;lt;/code&amp;gt; systems. For other architectures the exact name will vary.&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Bootloader Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Arch_boot_process#Boot_loader Archwiki]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Category:Bootloaders PostmarketOS Wiki]&lt;br /&gt;
* [https://www.denx.de/wiki/U-Boot/ReleaseCycle U-Boot Release Cycle]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category:Booting]]&lt;/div&gt;</summary>
		<author><name>Nonas</name></author>
	</entry>
</feed>