Arch linux refind install

refind на arch

Добрый день, устанавливаю arch и решил вместо systemd-boot поставить refind. Разместил, отформатировал, примонтировал. На моменте когда ставят systemd-boot поставил refind.

В /boot/arch/refind-linux.conf прописал

Refind запускается, но конфиг ничего не предлагает запустить. Поэтому в /boot/EFI/refind/refind.conf я прописал следующее

И вот тогда все запускается. Как сделать чтоб он запускался refind-linux.conf и как мне лучше настроить refind, если захочу dualboot, чтоб все работало? На reddit был пример что все в esp который привязан к boot

Про dualboot не заморачивался, но если все же нужны и другие недооси, то их лучше из виртуализации запускать из работающего топика, а не из загрузчика. Мне кажется это будет намного удобнее и не будут случайно сноситься загрузчики и диск планировать легче, легче обновляться будет и сносить неактуальные версии оффтопика. И переключаться удобнее будет на одной машинке между оффтопиками и арчем, причем работать можно будет параллельно на одной машинке сразу на двух и более осях и перегружать реальную машинку и возиться с её конфигами лишний раз не придется.

Если в биосе включеная виртуализация позволяет держать запущенными параллельно несколько недоосей, а также эмулятор нативного андроида.

В отличии от приведенных конфигов и набора ПО, у меня установлен ы в дополнение к rEFInd еще dracut и efibootmgr (последний очевидно нужен чтобы зачистить записи в BIOS и на диске от любых старых разгрузчиков и разных следов dualboot EFI).

Не забыть конфиг dracut.conf заполнить нужными значениями, чтобы затем автоматически все действия выполнялись при запуске командами dracut -f dkms install. . И ядро само будет копироваться при make -j16 install в /boot , если спланировать в конфигах rEFInd , что rEFInd должен собранное ядро искать именно в /boot раздела EFI (FAT32).

Чтобы система загрузилась, не забыть про драйвера (EFI) под / , в моем случе это ext4 .

ядро находится в нестандартном месте, поэтому refind его и не находит. Этот путь надо добавить в also_scan_dirs в refind.conf .

Рачвики еще советует изменить extra_kernel_version_strings .

Источник

SYNOPSIS

Some details that can affect how the script runs include the following:

* If you run the script as an ordinary user, it attempts to acquire root privileges by using the sudo command. This works on Mac OS X and some Linux installations (such as under Ubuntu or if you’ve added yourself to the sudo users list), but on some Linux installations this will fail. On such systems, you should run refind-install as root. * Under OS X, you can run the script with a mouse by opening a Terminal session and then dragging-and-dropping the refind-install file to the Terminal window. You’ll need to press the Return or Enter key to run the script. * If you’re using OS X 10.7’s Whole Disk Encryption (WDE) feature, or the loogical volumes feature in OS X 10.10, you must install rEFInd to the ESP or to a separate HFS+ partition. The default in rEFInd 0.8.4 and later is to install to the ESP. If you prefer to use a separate HFS+ volume, the —ownhfs device-file option to refind-install is required. * If you’re not using WDE or logical volumes, you can install rEFInd to the OS X root (/) partition by using the —notesp option to refind-install. Using this option is recommended when upgrading from a working rEFInd installation in this location. * If you’re replacing rEFIt with rEFInd on a Mac, there’s a chance that refind-install will warn you about the presence of a program called /Library/StartupItems/rEFItBlesser and ask if you want to delete it. This program is designed to keep rEFIt set as the boot manager by automatically re-blessing it if the default boot manager changes. This is obviously undesirable if you install rEFInd as your primary boot manager, so it’s generally best to remove this program. If you prefer to keep your options open, you can answer N when refind-install asks if you want to delete rEFItBlesser, and instead manually copy it elsewhere. If you subsequently decide to go back to using rEFIt as your primary boot manager, you can restore rEFItBlesser to its place. * If you intend to boot BIOS-based OSes on a UEFI-based PC, you must edit the refind.conf file’s scanfor line to enable the relevant searches. This is not necessary on Macs, though; because of the popularity of dual boots with Windows on Macs, the BIOS/legacy scans are enabled by default on Macs. * On Linux, refind-install checks the filesystem type of the /boot directory and, if a matching filesystem driver is available, installs it. Note that the «/boot directory» may be on a separate partition or it may be part of your root (/) filesystem, in which case the driver for your root filesystem is installed. This feature is unlikely to work properly from an emergency system, although it might if you have a separate /boot partition and if you mount that partition at /boot in your emergency system, and the ESP at /boot/efi. * On OS X, refind-install checks your partition tables for signs of a Linux installation. If such a sign is found, the script installs the EFI filesystem driver for the Linux ext4 filesystem. This will enable rEFInd to read your Linux kernel if it’s on an ext2, ext3, or ext4 filesystem. Note that some configurations will require a /boot/refind_linux.conf file, which can be reliably generated only under Linux. (The mkrlconf script that comes with rEFInd will do this job once you’ve booted Linux.) In the meantime, you can launch GRUB from rEFInd or press F2 or Insert twice after highlighting the Linux option in rEFInd. This will enable you to enter a root=/dev/whatever specification, where /dev/whatever is the device identifier of your Linux root (/) filesystem. * If you run refind-install on Linux and if /boot/refind_linux.conf doesn’t already exist, refind-install creates this file and populates it with a few sample entries. If /boot is on a FAT partition (or HFS+ on a Mac), or if it’s on an ext2fs, ext3fs, ext4fs, ReiserFS, Btrfs, or HFS+ partition and you install an appropriate driver, the result is that rEFInd will detect your kernel and will probably boot it correctly. Some systems will require manual tweaking to refind_linux.conf, though — for instance, to add dolvm to the boot options on Gentoo systems that use LVM. * If you pass the —shim option to the script (along with a filename for a Shim binary), the script sets up for a Secure Boot configuration via Shim. By default, this causes the rEFInd binary to be renamed as grubx64.efi. Recent versions of Shim support passing the name of the follow-on program to Shim via a parameter, though. If you want to use this feature, you can pass the —keepname option to refind-install.

Читайте также:  Windows free ssh client

After you run refind-install, you should peruse the script’s output to ensure that everything looks OK. refind-install displays error messages when it encounters errors, such as if the ESP is mounted read-only or if you run out of disk space. You may need to correct such problems manually and re-run the script. In some cases you may need to fall back on manual installation, which gives you better control over details such as which partition to use for installation.

OPTIONS

AUTHORS

SEE ALSO

AVAILABILITY

Package name: extra/refind Version: 0.13.2-1 Upstream: https://www.rodsbooks.com/refind/ Licenses: BSD, CCPL, FDL1.3, GPL2, GPL3, LGPL3 Manuals: /listing/extra/refind/ Table of contents

Powered by archmanweb, using mandoc for the conversion of manual pages.

Источник

Dual boot ArchLinux и Windows 8 на UEFI без GRUB c помощью rEFInd

Инструкция для новичков, о том, как сделать красивый dualboot windows и archlinux (и других ОС) через efi без grub и лишних заморочек.

Фото для привлечения внимания:

Можете посмотерть в google как это ещё может выглядеть.

Сразу оговорюсь.
Предполагается, что вы уже поставили windows и archlinux, понимаете как размечать диски и что куда монтировать и осталось вам только разобраться с загрузчиком. Если нет, то рекомендую посмотреть для начала вот это видео.

Я пробовал различные варианты, как описано тут, тут и тут и прочие выкрутасы с efibootmgr. Пытался добавлять опции прямо в «BIOSе» — ничего хорошего у меня не получилось, то рут раздел не находит то ещё что-то. Да и сам подход к переключению систем (жать Esc при включении ПК для выбора системы) меня не очень радовал.

Провозившись весь выходной, нашёл для себя простое и элегантное решение — пакет refind-efi (ArchWiki).
Если коротко, — достаточно установить этот пакет (pacman -S refind-efi) и выполнить refind-install, — всё.
В /boot/efi/EFI/ будет создан каталог refind и в опции загрузки добавлен новый пунк «rEFInd boot manager ».

Предупреждение

Добавлю к этой статье предупреждение: запись в NVRAM из ОС — достаточно опасная операция, которая может приводить к «кирпичу» на некоторых моделях ноутбуков с BIOSами на платформе Phoenix SCT. У автора BIOS на платформе AMI Aptio, с ним таких проблем нет.
Именно поэтому я настоятельно не рекомендую использовать на ноутбуках как саму efibootmgr, так и все, что ее вызывает, и устанавливать любые загрузчики вручную, либо заменяя имеющийся загрузчик по умолчанию (fs0:/EFI/BOOT/bootx64.efi), либо прописывая новый загрузчик из UEFI Shell командой bсfg boot add 0 fs0:/path/to/bootloader.efi «My Fancy Bootloader» — это намного безопаснее.

Всё что вы делаете, вы делаете на свой страх и риск!

Теперь подробнее об установке и конфигурировании

Для начала сверим конфигурации.
В моём случае это:

  • Windows 8.1
  • Arch Linux x86_64 Kernel Release: 3.14.4-1-ARCH

Вывод lsblk:

Раздел с типом «EFI System» созданный инсталятором windows, монтируем в /boot/efi/ ( /mnt/boot/efi/ ведь мы загрузились с liveiso верно?)

где X это номер вашего EFI раздела ( например mount /dev/sda2 /mnt/boot/efi ).

Далее перейдя в уже установленный arch ( arch-chroot /mnt/ ) устанавливаем сам refind:

Если вдруг такой пакет не найден, поищите в yaourt:

и если не было ошибок

После перезагрузки можно поставить в «биосе» в настройках приоритета загрузки «rEFInd boot manager » на первое место.

И не забудьте отключить «Secure Boot».

В каталоге /boot/efi/EFI создана дирректория refind. В ней есть refind.conf в котором можно установить время отображения списка ОС и настроить внешний вид.

Refind сам находит установленные ОС и определяет параметры их загрузки. Так же мне очень понравилось что если вставлена загрузочная флешка или диск они тоже появляются в списке.

Мне понравилась тема Next-Theme (вы можете подобрать что-то на свой вкус), положил её в /boot/efi/EFI/refind/next-theme и прописал в конфиге:

Конфиг хорошо документирован и вопросов вызывать не должен.

Источник

rEFInd

rEFInd is a UEFI boot manager capable of launching EFISTUB kernels. It is a fork of the no-longer-maintained rEFIt and fixes many issues with respect to non-Mac UEFI booting. It is designed to be platform-neutral and to simplify booting multiple operating systems.

Contents

Installation

Installing the rEFInd Boot Manager

rEFInd ships with UEFI drivers that implement read-only support for ReiserFS, Ext2, Ext4, Btrfs, ISO-9660 and HFS+. Additionally rEFInd can access any file system that UEFI itself can, that includes FAT (as mandated by the UEFI specification), HFS+ on Macs and ISO-9660 on some systems.

To use the rEFInd, you must install it to the EFI system partition either using the refind-install script or by copying the files and setting up the boot entry manually.

Installation with refind-install script

The rEFInd package includes the refind-install script to simplify the process of setting rEFInd as your default EFI boot entry. The script has several options for handling differing setups and UEFI implementations. See refind-install(8) or read the comments in the install script for explanations of the various installation options.

For many systems it should be sufficient to simply run:

This will attempt to find and mount your ESP, copy rEFInd files to esp/EFI/refind/ , and use efibootmgr to make rEFInd the default EFI boot application.

Alternatively you can install rEFInd to the default/fallback boot path esp/EFI/BOOT/bootx64.efi . This is helpful for bootable USB flash drives or on systems that have issues with the NVRAM changes made by efibootmgr:

Читайте также:  Знак разделителя windows 10

Where /dev/sdXY is your EFI system partition (the block device, not its mountpoint).

After installing rEFInd’s files to the ESP, verify that rEFInd has created refind_linux.conf containing kernel parameters in the same directory as your kernel. Then this will not be created if you used the —usedefault option, run mkrlconf as root to create it.

By default, rEFInd will scan all of your drives (that it has drivers for) and add a boot entry for each EFI bootloader it finds, which should include your kernel (since Arch enables EFISTUB by default). So you may have a bootable system at this point.

Secure Boot

Using PreLoader

See Secure Boot#Set up PreLoader to acquire signed PreLoader.efi and HashTool.efi binaries.

Execute refind-install with the option —preloader /path/to/preloader

Next time you boot with Secure Boot enabled, HashTool will launch and you will need to enroll the hash of rEFInd ( loader.efi ), rEFInd’s drivers (e.g. ext4_x64.efi ) and kernel (e.g. vmlinuz-linux ).

See refind-install(8) for more information.

Using shim
Using hashes

To use only hashes with shim, execute refind-install with the option —shim /path/to/shim

Next time you boot with Secure Boot enabled, MokManager will launch and you will need to enroll the hash of rEFInd ( grubx64.efi ), rEFInd’s drivers (e.g. ext4_x64.efi ) and kernel (e.g. vmlinuz-linux ).

Using Machine Owner Key

To sign rEFInd with a Machine Owner Key (MOK), install sbsigntools .

Execute refind-install with the options —shim /path/to/shim and —localkeys :

refind-install will create the keys for you and sign itself and its drivers. You will need to sign the kernel with the same key, e.g.:

Once in MokManager add refind_local.cer to MoKList. refind_local.cer can be found inside a directory called keys in the rEFInd’s installation directory, e.g. esp/EFI/refind/keys/refind_local.cer .

See refind-install(8) for more information.

Using your own keys

Create directory /etc/refind.d/keys and place Signature Database (db) key and certificates in it. Name the files: refind_local.key (PEM format private key), refind_local.crt (PEM format certificate) and refind_local.cer (DER format certificate).

When running install script add option —localkeys , e.g.:

rEFInd EFI binaries will be signed with the supplied key and certificate.

Manual installation

If the refind-install script does not work for you, rEFInd can be set up manually.

First, copy the executable to the ESP:

If you want to install rEFInd to the default/fallback boot path replace esp/EFI/refind/ with esp/EFI/BOOT/ in the following instructions and copy rEFInd EFI executable to esp/EFI/BOOT/bootx64.efi :

Then use efibootmgr to create a boot entry in the UEFI NVRAM, where /dev/sdX and Y are the device and partition number of your EFI system partition. If you are installing rEFInd to the default/fallback boot path esp/EFI/BOOT/bootx64.efi , you can skip this step.

At this point, you should be able to reboot into rEFInd, but it will not be able to boot your kernel. If your kernel does not reside on your ESP, rEFInd can mount your partitions to find it — provided it has the right drivers.

rEFInd automatically loads all drivers from the subdirectories drivers and drivers_arch (e.g. drivers_x64 ) in its install directory.

Now rEFInd should have a boot entry for your kernel, but it will not pass the correct kernel parameters. Set up #Passing kernel parameters. You should now be able to boot your kernel using rEFInd. If you are still unable to boot or if you want to tweak rEFInd’s settings, many options can be changed with a configuration file:

The sample configuration file is well commented and self-explanatory.

Unless you have set textonly in the configuration file, you should copy rEFInd’s icons to get rid of the ugly placeholders:

You can try out different fonts by copying them and changing the font setting in refind.conf :

Upgrading

Pacman updates the rEFInd files in /usr/share/refind/ and will not copy new files to the ESP for you. If refind-install worked for your original installation of rEFInd, you can rerun it to copy the updated files. The new configuration file will be copied as refind.conf-sample so that you can integrate changes into your existing configuration file using a diff tool. If your rEFInd required #Manual installation, you will need to figure out which files to copy yourself.

Pacman hook

You can automate the update process using a pacman hook:

Where the Exec= may need to be changed to the correct update command for your setup. If you did #Manual installation, you could create your own update script to call with the hook.

Configuration

The rEFInd configuration refind.conf is located in the same directory as the rEFInd EFI application (usually esp/EFI/refind or esp/EFI/BOOT ). The default configuration file contains extensive comments explaining all its options, see Configuring the Boot Manager for more detailed explanations.

Passing kernel parameters

There are two methods for setting the kernel parameters that rEFInd will pass to the kernel.

For kernels automatically detected by rEFInd

For automatically detected kernels you can either specify the kernel parameters explicitly in /boot/refind_linux.conf or rely on rEFInd’s ability to identify the root partition and kernel parameters. See Methods of Booting Linux: For Those With Foresight or Luck: The Easiest Method for more information.

For rEFInd to support the naming scheme of Arch Linux kernels and thus allow matching them with their respective initramfs images, you must uncomment and edit extra_kernel_version_strings option in refind.conf . E.g.:

refind_linux.conf

If rEFInd automatically detects your kernel, you can place a refind_linux.conf file containing the kernel parameters in the same directory as your kernel. You can use /usr/share/refind/refind_linux.conf-sample as a starting point. The first uncommented line of refind_linux.conf will be the default parameters for the kernel. Subsequent lines will create entries in a submenu accessible using + , F2 , or Insert .

Alternatively, try running mkrlconf as root. It will attempt to find your kernel in /boot and automatically generate refind_linux.conf . The script will only set up the most basic kernel parameters, so be sure to check the file it created for correctness.

If you do not specify an initrd= parameter, rEFInd will automatically add it by searching for common RAM disk filenames in the same directory as the kernel. If you need multiple initrd= parameters, you must specify them manually in refind_linux.conf . For example, a microcode passed before the initramfs:

Читайте также:  Windows activation and bios
Without configuration

If you merely install rEFInd onto the ESP and launch it without any further ado (say via UEFI shell or KeyTool, or directly from firmware) you still get a menu to boot from via autodetection, with no configuration required whatsoever.

This works because rEFInd has a fallback mechanism that can:

  • Identify the root partition (for root= parameter ) via the Discoverable Partitions Specification or /etc/fstab .
  • Detect kernel options ( ro or rw ) from GPT partition attributes (using attribute 60 «read-only») or /etc/fstab .

Manual boot stanzas

If your kernel is not autodetected, or if you simply want more control over the options for a menu entry, you can manually create boot entries using stanzas in refind.conf . Ensure that scanfor includes manual or these entries will not appear in rEFInd’s menu. Kernel parameters are set with the options keyword. rEFInd will append the initrd= parameter using the file specified by the initrd keyword in the stanza. If you need additional initrds (e.g. for Microcode), you can specify them in options (and the one specified by the initrd keyword will be added to the end).

Manual boot stanzas are explained in Creating Manual Boot Stanzas.

It is likely that you will need to change volume to match either a filesystem’s LABEL, a PARTLABEL, or a PARTUUID of the partition where the kernel image resides. The PARTUUID needs to be in uppercase. See Persistent block device naming#by-label for examples of assigning a volume label. If volume is not specified it defaults to volume from which rEFInd was launched (typically EFI system partition).

Installation alongside an existing UEFI Windows installation

rEFInd is compatible with the EFI system partition created by a UEFI Windows installation, so there is no need to create or format another FAT32 partition when installing Arch alongside Windows. Simply mount the existing ESP and install rEFInd as usual. By default, rEFInd’s autodetection feature should recognize any existing Windows/recovery bootloaders.

Tools

This article or section is a candidate for moving to Unified Extensible Firmware Interface.

rEFInd supports running various 3rd-party tools. Tools need to be installed separately. Edit showtools in refind.conf to choose which ones to show.

UEFI shell

Copy shellx64.efi to the root of the EFI system partition.

Memtest86

Install memtest86-efi AUR and copy it to esp/EFI/tools/ .

Key management tools

rEFInd can detect Secure Boot key management tools if they are placed in rEFInd’s directory on ESP, esp/ or esp/EFI/tools/ .

HashTool

Follow #Using PreLoader and HashTool.efi will be placed in rEFInd’s directory.

MokManager

Follow #Using shim and MokManager will be placed in rEFInd’s directory.

KeyTool

Place KeyTool EFI binary in esp/ or esp/EFI/tools/ with the name KeyTool.efi or KeyTool-signed.efi .

See Secure Boot#Using KeyTool for instructions on signing KeyTool.efi .

GPT fdisk (gdisk)

Download the gdisk EFI application and copy gdisk_x64.efi to esp/EFI/tools/ .

fwupdate

Install and setup fwupd.

Copy the fwupx64.efi binary and firmware file to esp/EFI/tools/ :

Poweroff or reboot

rEFInd reportedly have poweroff and reboot menu entries built in. Since this list of tools is the most extensive of its kind in this wiki, users of UEFI shell, or other UEFI boot managers, such as systemd-boot, might be interested in powerofforreboot.efi AUR .

Tips and tricks

Using drivers in UEFI shell

This article or section is a candidate for moving to Unified Extensible Firmware Interface#UEFI drivers.

To use rEFInd’s drivers in UEFI shell load them using command load and refresh mapped drives with map -r .

Now you can access your file system from UEFI shell.

Setting efifb resolution

This article or section needs expansion.

If the resolution in refind.conf is set to an incorrect value, on all systems except Apple Macs rEFInd will display a list of supported resolutions. For Apple Macs it will silently use the default resolution.

To determine framebuffer resolutions supported by efifb, copy /usr/share/gnu-efi/apps/x86_64/modelist.efi from gnu-efi to the root of ESP. Enter the UEFI shell and run modelist.efi .

Set one in refind.conf . Reboot and check if settings has been applied by running dmesg | grep efifb as root.

Btrfs subvolume support

Auto detection

To allow kernel auto detection on a Btrfs subvolume uncomment and edit also_scan_dirs in refind.conf .

Next add subvol=subvolume to rootflags in refind_linux.conf and then prepend subvolume to the initrd path.

Manual boot stanza

If booting a btrfs subvolume as root, prepend the path to the subvolume to the loader and initrd paths, and amend the options line with rootflags=subvol=root_subvolume . In the example below, root has been mounted as a btrfs subvolume called ‘ROOT’ (e.g. mount -o subvol=ROOT /dev/sdxY /mnt ):

A failure to do so will otherwise result in the following error message: ERROR: Root device mounted successfully, but /sbin/init does not exist.

LoaderDevicePartUUID

Since version 0.13.1, rEFInd supports setting the UEFI variable LoaderDevicePartUUID. Enabling this allows systemd-gpt-auto-generator(8) to automount the EFI system partition without needing to specify it in /etc/fstab . See systemd#GPT partition automounting.

For rEFInd to set LoaderDevicePartUUID , edit refind.conf and uncomment write_systemd_vars true :

You can verify if it is set by checking its value with cat /sys/firmware/efi/efivars/LoaderDevicePartUUID-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f or by looking at the state of «Boot loader sets ESP information» in bootclt output.

Troubleshooting

Apple Macs

mactel-boot AUR is an experimental bless utility for Linux. If that does not work, use bless from within OSX to set rEFInd as the default boot entry:

VirtualBox

VirtualBox before version 6.1 will only boot the default esp/EFI/BOOT/bootx64.efi path, so refind-install needs to be used with at least the —usedefault option. See VirtualBox/Install Arch Linux as a guest#Installation in EFI mode on VirtualBox Blank rEFInd menu screen

If your refind/drivers_x64 folder contains multiple file system drivers (see #Installing the rEFInd Boot Manager for clarification), this can lead to an improper functioning of rEFInd through a file system driver bug, whereby only a blank screen and with the rEFInd logo is shown (for custom themes, this would be the set background image). To fix this, simply remove all drivers except the one for the file system on which the kernel resides.

Источник

Оцените статью