- Preboot Execution Environment
- Contents
- Preparation
- Overview
- Boot from install media
- Boot from netboot
- Pixiecore
- Server setup
- Network
- DHCP + TFTP
- BIOS boot from install media
- UEFI boot from netboot
- Transferring archiso root filesystem
- Existing PXE server
- Installation
- Post-boot
- Low memory systems
- Sharing internet with PXE clients
- Troubleshooting
- DHCP interface rename bug
- VirtualBox cannot boot while real machines can
- Preboot Execution Environment (Русский)
- Contents
- Как это работает
- Подготовка
- Настройка сервера
- DHCP + TFTP
- Установка
- Загрузка
- После загрузки
- Альтернативные способы
- Существующий сервер PXE
- Ошибка переименования интерфейса DHCP
- Системы с небольшим объемом памяти
Preboot Execution Environment
The Preboot eXecution Environment (PXE, most often pronounced as pixie) specification describes a standardized client-server environment that boots a software assembly, retrieved from a network, on PXE-enabled clients. On the client side it requires only a PXE-capable network interface controller (NIC), and uses a small set of industry-standard network protocols such as DHCP and TFTP.
In this guide, PXE is used to boot the installation media with an appropriate option-rom that supports PXE on the target. This works well when you already have a server set up.
Contents
Preparation
Overview
It is useful to give an overview of the PXE boot process in order to understand the #Server setup, the #Installation on the client side and the Arch Linux files needed.
The client starts by broadcasting packets asking for a DHCP server and containing specific PXE options. The DHCP server responds with networking information (the IP address assigned to the client) and also provides, by using specific bootstrap protocol (BOOTP) parameters of the DHCP, additional information like the TFTP server address, the path of the initial network bootstrap program (NBP) to download or the boot configuration file name.
The NBP is transferred from the PXE server to the client using TFTP, to be loaded into memory and executed. The kernel and the initramfs are also transferred this way.
Then the root filesystem is transferred using one of the following protocols: HTTP, NFS or NBD.
Boot from install media
In order to gather the files that will be transferred from the server to the client for booting, get the latest official install media from the download page.
Next mount the image:
where release_date is the release date in the ISO filename like, e.g., 2020.10.01 .
Boot from netboot
Arch Linux netboot images can be used to download the latest Arch Linux release on the fly upon system boot. Download the image compatible with your configuration.
Pixiecore
A all-in-one solution is provided by pixiecore
- Install pixiecore-gitAUR
- Run pixiecore quick arch —dhcp-no-bind as root
- Boot via PXE
Server setup
You will need to setup a DHCP server, a TFTP server for transferring the NBP and one of the following services for transferring the root filesystem: HTTP server, NFS or NBD.
Network
Bring up your wired network adapter, and assign it an address appropriately.
DHCP + TFTP
You will need both a DHCP server and a TFTP server to configure networking on the install target and to facilitate the transfer of files between the server and the client. dnsmasq does both, and is extremely easy to set up.
dnsmasq needs to be configured. See instructions on how to setup a dnsmasq#TFTP server and a dnsmasq#PXE server.
Are provided below some common configuration instructions. tftp_root is the directory where the Arch ISO is mounted (e.g. /mnt/archiso ) or where the network boot program is located.
To enable the DHCP server and give IPv4 addresses within a range, add to the configuration file a line similar to:
Or in case there is already a DHCP-server running on the network and you want to interoperate with it, see dnsmasq#Proxy DHCP.
Two examples covering different boot style and installation media are provided below.
Once configured according to your needs, start dnsmasq.service .
BIOS boot from install media
The path of the initial bootstrap program to be transferred is defined with the dhcp-boot option in the configuration file.
In order to send specific bootstrap protocol (BOOTP) parameters, like the configuration file path, the dhcp-option-force=flag,value line is used.
UEFI boot from netboot
To send a file depending on the architecture, here the netboot image for UEFI-style boot, use:
If using netboot, the rest of the server setup section which focuses on the Arch ISO does not apply.
Transferring archiso root filesystem
Thanks to archiso_pxe_http , archiso_pxe_nfs and archiso_pxe_nbd initcpio hooks in archiso, it is possible to boot using HTTP, NFS or NBD. Boot time is approximately the same in all three methods, but HTTP method allows you to watch a state of downloading airootfs.sfs in percents.
Among all alternatives, darkhttpd is by far the most trivial to setup (and the lightest-weight).
Then start darkhttpd using our /mnt/archiso as the document root:
You will need to set up an NFS server with an export at the root of your mounted installation media, which would be /mnt/archiso if you followed #Preparation. After setting up the server, add the following line to your /etc/exports file:
If the server was already running, re-export the filesystems with exportfs -r -a -v .
The default settings in the installer expect to find the NFS at /run/archiso/bootmnt , so you will need to edit the boot options. To do this, press Tab on the appropriate boot menu choice and edit the archiso_nfs_srv option accordingly:
Alternatively, you can use /run/archiso/bootmnt for the entire process.
After the kernel loads, the Arch bootstrap image will copy the root filesystem via NFS to the booting host. This can take a little while. Once this completes, you should have a running system.
Install the nbd package and configure it:
where release_date is the release date in the ISO filename like, e.g., 2020.03.01 .
Existing PXE server
If you have an existing PXE server with a PXELINUX system setup (e.g. a combination of DHCP and TFTP), you can add the following menu items to your /tftpboot/pxelinux.cfg/default file in order to boot Arch via your preferred method:
You can replace archiso_http_srv with archiso_nfs_srv for NFS or archiso_nbd_srv for NBD (see usage examples in arch/boot/syslinux/archiso_pxe.cfg file resided on ArchLinux iso). Whichever method you choose, you must pass ip= parameter to instruct the kernel to bring up the network interface before it attempts to mount the installation medium over the network. Passing BOOTIF= is required when there are several wired interfaces on the client side and/or you want resolv.conf to be already configured inside booted archiso. You can use sysappend mask 3 (which is 1+2) to pass these parameters automatically. For available boot parameters see README.bootparams.
Installation
For this portion you will need to figure out how to tell the client to attempt a PXE boot; in the corner of the screen along with the normal post messages, usually there will be some hint on which key to press to try PXE booting first. On an IBM x3650 F12 brings up a boot menu, the first option of which is Network; on a Dell PE 1950/2950 pressing F12 initiates PXE booting directly.
Looking at journald on the PXE server will provide some additional insight to what exactly is going on during the early stages of the PXE boot process:
After you load pxelinux.0 and archiso.cfg via TFTP, you will (hopefully) be presented with a syslinux boot menu with several options, where you can select Boot Arch Linux (x86_64) (HTTP).
Next the kernel and initramfs (appropriate for the architecture you selected) will be transferred, again via TFTP:
If all goes well, you should then see activity on darkhttpd coming from the PXE-target; at this point the kernel would be loaded on the PXE-target, and in init:
After the root filesystem is downloaded via HTTP, you will eventually end up at the normal live system root zsh prompt.
Post-boot
Unless you want all traffic to be routed through your PXE server (which will not work anyway unless you set it up properly), you will want to stop dnsmasq.service and get a new lease on the install target, as appropriate for your network layout.
You can also kill darkhttpd; the target has already downloaded the root filesystem, so it is no longer needed. While you are at it, you can also unmount the installation image:
At this point you can follow the Installation guide.
Low memory systems
The copytoram initramfs option can be used to control whether the root filesystem should be copied to ram in its entirety in early-boot.
It highly recommended to leave this option alone, and should only be disabled if entirely necessary (systems with less than
256MB physical memory). Append copytoram=n to your kernel line if you wish to do so.
Sharing internet with PXE clients
If your network for PXE clients is private (for example, 192.168.1.0/24), and you want them to be able to access internet (for example, for packages installation), you should configure masquerade/source nat properly. Your PXE server must have a separate NIC connected to the internet. You can use such command to pass through the internet to clients:
To make this rule persistent after reboot, run the following command:
Troubleshooting
DHCP interface rename bug
FS#36749 causes default predictable network interface renaming to fail and then DHCP client to fail because of it. A workaround is to add the kernel boot parameter net.ifnames=0 to disable predictable interface names.
VirtualBox cannot boot while real machines can
When using VirtualBox to test your configuration, the virtual machine may get stuck at:
While PXE booting with a real machine works fine. The problem may be because you have set several CPU cores to your client machine, and you set its type as Other and version as Other/Unknown (64 bit). So VirtualBox does not know which paravirtualization interface to use by default.
Adding loglevel=7 to the kernel parameters lets you see where it actually got stuck:
To resolve this, either use one CPU core, or go to Machine > Settings > System > Acceleration and set one of the following paravirtualization interface: Minimal, Hyper-V or KVM.
Источник
Preboot Execution Environment (Русский)
Ваш ноутбук поставляется без дисковода, и не позволяет загружаться с USB-накопителя? Не бойтесь, вы можете загрузиться с помощью PXE.
PXE (англ.Preboot eXecution Environment произносится пикси) — среда для загрузки компьютеров с помощью сетевой карты без использования жёстких дисков, компакт-дисков и других устройств, применяемых при загрузке операционной системы.
В этом руководстве PXE используется для загрузки установочного носителя с соответствующей опцией-rom, которая поддерживает PXE в целевом объекте. Это хорошо работает, когда у вас уже установлен сервер.
Contents
Как это работает
Грубое описание процесса загрузки с помощью PXE:
- клиент (тот компьютер на который вы хотите установить) подключается к сети и опрашивает DHCP-сервера для аренды IP.
- DHCP-сервер передает клиенту IP и другую, необходимую для сетевой загрузки, информацию.
- затем клиент, на основе полученной информации, подключается к TFTP-серверу по протоколу TFTP (который очень похож на обычный FTP) и загружает файлы.
после этого клиент загружает систему со скаченных файлов. После загрузки системы можно отключить сетевое соединение (образ полностью загружается в память).
Подготовка
Загрузите последний официальный установочный образ со страницы загрузки.
Затем смонтируйте образ:
Настройка сервера
Вам необходимо установить DHCP, TFTP и HTTP-сервер для настройки сети, загрузки pxelinux/kernel/initramfs, и, наконец, загрузки корневой файловой системы (соответственно).
На данный момент Arch поддерживает загрузку PXE только в стиле BIOS. Для получения дополнительной информации смотрите FS#50188.
Подключите проводную сетевую карту и назначьте ее соответствующим образом.
DHCP + TFTP
Для настройки сети на устройстве вам потребуется как DHCP, так и TFTP-сервер, чтобы облегчить передачу файлов между сервером PXE и клиентом; dnsmasq делает и то, и другое, и очень прост в настройке.
Благодаря недавним изменениям в archiso, теперь можно загрузиться с HTTP ( archiso_pxe_http initcpio hook) или NFS ( archiso_pxe_nfs initcpio hook); среди всех альтернатив, darkhttpd на сегодняшний день является самым тривиальным (и самым легким) для настройки.
Затем запустите darkhttpd, используя наш /mnt/archiso в качестве корневого документа:
Обратите внимание, что важно, чтобы сервер работал на 80 порту. Если вы запустите darkhttpd без доступа суперпользователя, по умолчанию он будет 8080 . Клиент попытается получить доступ к 80 порту, и загрузка завершится неудачно.
Установка
Для этой части вам нужно выяснить, как сообщить клиенту выбрать загрузку PXE; в углу экрана вместе с обычными сообщениями обычно появляется подсказка о том, какую клавишу нажать, чтобы сначала запустить загрузку PXE. На IBM x3650 при нажатии F12 появляется меню загрузки, первым вариантом которого является Network; на Dell PE 1950/2950 нажатие F12 инициирует загрузку PXE напрямую.
Загрузка
Просмотр journald на сервере PXE даст дополнительную информацию о том, что именно происходит на ранних этапах процесса загрузки PXE:
После загрузки pxelinux.0 и archiso.cfg через TFTP вам (надеюсь) будет представлено меню загрузки syslinux с несколькими параметрами, в которых вы можете выбрать Boot Arch Linux (x86_64) (HTTP).
Затем ядро и initramfs (подходящие для выбранной вами архитектуры) будут переданы снова через TFTP:
Если все пойдет хорошо, вы должны увидеть активность на darkhttpd исходящую от PXE-target; на этом этапе ядро будет загружено на PXE-target и инициализировано:
После того, как корневая файловая система загружается через HTTP, вы в конечном итоге окажетесь в обычном запросе суперпользователя zsh.
После загрузки
Если вы не хотите, чтобы весь трафик маршрутизировался через ваш PXE-сервер (который не будет работать в любом случае, если вы не настроите его правильно), вы захотите остановить dnsmasq.service и получить новую аренду на цели установки, в зависимости от вашего сетевого расположения.
Вы также можете убить darkhttpd; объект уже загрузил корневую файловую систему, поэтому он больше не нужен. Пока он активен, вы также можете размонтировать установочный образ:
На этом этапе вы можете следовать Руководство по установке.
Альтернативные способы
Как видно из меню syslinux, существует несколько других альтернатив:
Вам нужно будет настроить сервер NFS с экспортом в корне вашего смонтированного установочного носителя, который будет /mnt/archiso , если вы следовали за разделом #Подготовка. После настройки сервера добавьте следующую строку в файл /etc/exports :
Если сервер уже запущен, повторно экспортируйте файловые системы с помощью exportfs -r -a -v .
Настройки по умолчанию в установщике ожидают найти NFS в /run/archiso/bootmnt , поэтому вам нужно будет отредактировать параметры загрузки. Для этого нажмите вкладку в соответствующем выборе меню загрузки и отредактируйте параметр archiso_nfs_srv соответственно:
Кроме того, вы можете использовать /run/archiso/bootmnt для всего процесса.
После загрузки образа ядра начальной загрузки Arch скопирует корневую файловую систему через NFS на загрузочный хост. Это может занять некоторое время. Как только это завершится, у вас появится работающая система.
Установите пакет nbd и настройте его:
Существующий сервер PXE
Если у вас есть PXE-сервер с настроенной системой PXELINUX (например, комбинация DHCP и TFTP), вы можете добавить в файл pxelinux.cfg следующие пункты меню, чтобы загрузить Arch предпочтительным для вас способом:
Вы можете заменить archiso_http_srv на archiso_nfs_srv для NFS или archiso_nbd_srv для NBD. Добавление инструкции ip= необходимо, чтобы дать указание ядру вызвать сетевой интерфейс, прежде чем попытаться смонтировать установочный носитель по сети. Смотрите README.bootparams, чтобы узнать доступные параметры загрузки.
Ошибка переименования интерфейса DHCP
FS#36749 вызывает предсказуемое переименование сетевого интерфейса по умолчанию, а затем отказ клиента dhcp из-за него. Обходным путем является добавление параметра загрузки ядра net.ifnames=0 , чтобы отключить предсказуемые имена интерфейсов.
Системы с небольшим объемом памяти
Опция copytoram initramfs может использоваться для контроля того, должна ли корневая файловая система полностью копироваться в оперативную память в полном объеме в начале загрузки.
Настоятельно рекомендуется оставить этот параметр в покое, и его следует отключать только в случае необходимости (системы с физической памятью размером менее 256 МБ). Если вы хотите это сделать, добавьте copytoram=n в строку ядра.
Источник