Difference between revisions of "PXE"

From ArchWiki
Jump to navigation Jump to search
m (Preparation)
(Adding a slash on dnsmasq configuration)
Line 64: Line 64:

Revision as of 23:38, 12 October 2012

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary end

Merge-arrows-2.pngThis article or section is a candidate for merging with Network Installation Guide.Merge-arrows-2.png

Notes: needs to be rewritten into sub-articles; duplicated information (Discuss in Talk:PXE#)

The Preboot eXecution Environment allows you to boot the installation media using a network interface (with an appropriate option-rom that supports PXE on the target), independent of any storage devices.


Archiso makes it fairly trivial to use the official install media directly to set up PXE booting and, unlike earlier methods (archboot), does not require any modification and can be used as-is.

Download the latest official install media from your favorite mirror.

$ wget http://hive.ist.unomaha.edu/archlinux/iso/latest/archlinux-2012.10.06-dual.iso
--2012-10-06 22:06:37--  http://hive.ist.unomaha.edu/archlinux/iso/latest/archlinux-2012.10.06-dual.iso
Resolving hive.ist.unomaha.edu... 2620:d5:0:22bb::dead:beef,
Connecting to hive.ist.unomaha.edu|2620:d5:0:22bb::dead:beef|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 435159040 (415M) [application/x-iso9660-image]
Saving to: ‘archlinux-2012.10.06-dual.iso’

100%[====================================================================================>] 435,159,040  109MB/s   in 3.9s   

2012-10-06 22:06:41 (109 MB/s) - ‘archlinux-2012.10.06-dual.iso’ saved [435159040/435159040]

Next mount the image:

# mkdir -p /mnt/archiso
# mount -o loop,ro archlinux-2012.10.06-dual.iso /mnt/archiso

Server setup

You'll need to setup a DHCP, TFTP, and HTTP server to configure networking, load pxelinux/kernel/initramfs, and finally load the root filesystem (respectively).


Bring up your wired NIC, and assign it an address appropriately.

# ip link set eth0 up
# ip addr add dev eth0


You'll need both a DHCP and TFTP server to configure networking on the install target and to facilitate the transfer of files between the PXE server and client; dnsmasq does both, and is extremely easy to set up.

Install dnsmasq:

# pacman -S dnsmasq

Configure dnsmasq:

# vim /etc/dnsmasq.conf

Start dnsmasq:

# systemctl start dnsmasq.service

For those still using sysvinit:

# rc.d start dnsmasq


Due recent changes in archiso, it is now possible to boot from HTTP (archiso_pxe_http initcpio hook) or NFS (archiso_pxe_nfs initcpio hook); among all alternatives, darkhttpd is by far the most trivial to setup (and the lightest-weight).

First, install darkhttpd:

# pacman -S darkhttpd

Then start darkhttpd using our /mnt/archiso as the document root:

# darkhttpd /mnt/archiso
darkhttpd/1.8, copyright (c) 2003-2011 Emil Mikulic.
listening on:


For this portion you'll 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 /var/log/messages.log on the PXE server will provide some additional insight to what exactly is going on during the early stages of the PXE boot process:

# grep dnsmasq /var/log/messages.log | cut -d' ' -f5-
dnsmasq-dhcp[2544]: DHCPDISCOVER(eth1) 00:1a:64:6a:a2:4d 
dnsmasq-dhcp[2544]: DHCPOFFER(eth1) 00:1a:64:6a:a2:4d 
dnsmasq-dhcp[2544]: DHCPREQUEST(eth1) 00:1a:64:6a:a2:4d 
dnsmasq-dhcp[2544]: DHCPACK(eth1) 00:1a:64:6a:a2:4d 
dnsmasq-tftp[2544]: sent /mnt/archiso/arch/boot/syslinux/pxelinux.0 to
dnsmasq-tftp[2544]: sent /mnt/archiso/arch/boot/syslinux/archiso.cfg to
dnsmasq-tftp[2544]: sent /mnt/archiso/arch/boot/syslinux/whichsys.c32 to
dnsmasq-tftp[2544]: sent /mnt/archiso/arch/boot/syslinux/archiso_pxe_choose.cfg to
dnsmasq-tftp[2544]: sent /mnt/archiso/arch/boot/syslinux/ifcpu64.c32 to
dnsmasq-tftp[2544]: sent /mnt/archiso/arch/boot/syslinux/archiso_pxe_both_inc.cfg to
dnsmasq-tftp[2544]: sent /mnt/archiso/arch/boot/syslinux/archiso_head.cfg to
dnsmasq-tftp[2544]: sent /mnt/archiso/arch/boot/syslinux/archiso_pxe32.cfg to
dnsmasq-tftp[2544]: sent /mnt/archiso/arch/boot/syslinux/archiso_pxe64.cfg to
dnsmasq-tftp[2544]: sent /mnt/archiso/arch/boot/syslinux/archiso_tail.cfg to
dnsmasq-tftp[2544]: sent /mnt/archiso/arch/boot/syslinux/vesamenu.c32 to
dnsmasq-tftp[2544]: sent /mnt/archiso/arch/boot/syslinux/splash.png to

After you load pxelinux.0 and archiso.cfg via TFTP, you'll (hopefully) be presented with a syslinux boot menu with several options, two of which are of potential usefulness to us.

Select either

Boot Arch Linux (x86_64) (HTTP)


Boot Arch Linux (i686) (HTTP)

depending on your CPU architecture.

Next the kernel and initramfs (appropriate for the architecture you selected) will be transferred, again via TFTP:

dnsmasq-tftp[2544]: sent /mnt/archiso/arch/boot/x86_64/vmlinuz to
dnsmasq-tftp[2544]: sent /mnt/archiso/arch/boot/x86_64/archiso.img to

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:

1348347586 "GET /arch/aitab" 200 678 "" "curl/7.27.0"
1348347587 "GET /arch/x86_64/root-image.fs.sfs" 200 107860206 "" "curl/7.27.0"
1348347588 "GET /arch/x86_64/usr-lib-modules.fs.sfs" 200 36819181 "" "curl/7.27.0"
1348347588 "GET /arch/any/usr-share.fs.sfs" 200 63693037 "" "curl/7.27.0"

After the root filesystem is downloaded via HTTP, you'll eventually end up at a root zsh prompt with that fancy grml config.


Unless you want all traffic to be routed through your PXE server (which won't work anyway unless you set it up properly), you'll want to kill dnsmasq and get a new lease on the install target, as appropriate for your network layout.

# systemctl stop dnsmasq.service

For sysvinit users:

# rc.d stop dnsmasq

You can also kill darkhttpd; the target has already downloaded the root filesystem, so it's no longer needed. While you're at it, you can also unmount the installation image:

# umount /mnt/archiso

At this point you can follow the official installation guide.

Alternate Methods

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: verify (Discuss in Talk:PXE#)

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:PXE#)

As implied in the syslinux menu, there are several other alternatives:


You will need to setup a NFS server with the root export at the root of your mounted installation media--that would be /mnt/archiso if you followed the earlier sections of this guide.


Install nbd and configure it:

# vim /etc/nbd-server/config
    readonly = true
    exportname = /dev/disk/by-label/ARCH_201208

See Also