Without installing, we can boot Arch Linux installation ISO and set it as a pxe server and boot the arch linux installer to another machine using bios/UEFI Network booting client of the machine.
Using grub4dos ( we may need memdisk as Kernel) we could boot the Arch Linux ISO.
Grub4Dos menu entry for booting arch iso
kernel /memdisk iso raw
initrd /archlinux_<some suffix>.iso
boot
The live installer will be booted from ISO. Without installation we can even setup PXE server. [The Arch PXE guide]
Since it comes from a read only iso, all files will be written in RAM so everyting will be lost on subsequent reboot. So we need to mount a hard disk partition to keep our necessary files for further uses.
e.g. mount /dev/sda5 /mnt
We need to do 3 works to up and run the Arch Linux PXE server:
SETUP IP Address:
At first we need to add IP address. [ e.g. ip addr add 192.168.0.1/24 dev enp1s0 ]
We shall setup and start the dnsmasq service that provides essential DHCP and TFTP services for PXE booting.
We can use everything as is by default from /run/archiso/bootmnt or we can customize the pxe boot configuration file.
For the default, the dnsmasq configuration file looks like:
Suppose, our TFTP home is /home directory, then the dnsmasq. conf file will be:
The issue of maintaining a certain path hierarchy:
dhcp-boot, the main boot loader takes an absolute path and it is fine.
The configuration file (dhcp-option-force=209) path is complicated. The full path is
SETUP NBD:
Once it is done, we can either use NBD - Network Block Device ( to load archlinux in PXE client from ISO directly); configuration file location for NBD is /etc/nbd-server/config
Sample config file content:
[generic]
# The [generic] section is required, even if nothing is specified there.
[archiso]
readonly = true
exportname = /path/to/archlinux-2019.08.01-x86_64.iso
Now, we can launch the NBD service: systemctl start nbd.service
----------------------------------
SETUP NFS:
Or, we can setup NFS - Network File System that will use the arch live directory /run/archiso/bootmnt/ ; configuration file is /etc/exports
In /etc/exports we appended the line:
Using grub4dos ( we may need memdisk as Kernel) we could boot the Arch Linux ISO.
Grub4Dos menu entry for booting arch iso
kernel /memdisk iso raw
initrd /archlinux_<some suffix>.iso
boot
The live installer will be booted from ISO. Without installation we can even setup PXE server. [The Arch PXE guide]
Since it comes from a read only iso, all files will be written in RAM so everyting will be lost on subsequent reboot. So we need to mount a hard disk partition to keep our necessary files for further uses.
e.g. mount /dev/sda5 /mnt
We need to do 3 works to up and run the Arch Linux PXE server:
- Set IP address
- Setup and start the dnsmasq service [the core PXE server]
- Setup and launch either NBD or NFS [to supply arch installer to remote client]
SETUP IP Address:
At first we need to add IP address. [ e.g. ip addr add 192.168.0.1/24 dev enp1s0 ]
SETUP dnsmasq service:
We shall setup and start the dnsmasq service that provides essential DHCP and TFTP services for PXE booting.We can use everything as is by default from /run/archiso/bootmnt or we can customize the pxe boot configuration file.
For the default, the dnsmasq configuration file looks like:
port=0For customized pxe boot configuration, we need to copy the syslinux/ and x86_64/ directories maintaining a certain path hierarchy, it is important to make it work properly.
interface=enp1s0
bind-interfaces
dhcp-range=192.168.0.5,192.168.0.10,12h
#This is a separate entry, relatively it begins after tftp-root
# tftp-root + dhcp-boot
dhcp-boot=arch/boot/syslinux/lpxelinux.0
#These 2 are pair 210 = foldre after tfpt-root; 209 is the config file
# tftp-root + 210 directory + 209 config file
dhcp-option-force=209,boot/syslinux/archiso.cfg
dhcp-option-force=210,/arch/
dhcp-option-force=66,192.168.0.1
enable-tftp
tftp-root=/run/archiso/bootmnt
Suppose, our TFTP home is /home directory, then the dnsmasq. conf file will be:
port=0
interface=enp1s0
bind-interfaces
dhcp-range=192.168.0.5,192.168.0.10,12h
#This is a separate entry, relatively it begins after tftp-root
# tftp-root + dhcp-boot
dhcp-boot=arch/boot/syslinux/lpxelinux.0
#These 2 are pair 210 = foldre after tfpt-root; 209 is the config file
# tftp-root + 210 directory + 209 config file
dhcp-option-force=209,boot/syslinux/archiso.cfg
dhcp-option-force=210,/arch/
dhcp-option-force=66,192.168.0.1
enable-tftp
tftp-root=/home
The issue of maintaining a certain path hierarchy:
dhcp-boot, the main boot loader takes an absolute path and it is fine.
The configuration file (dhcp-option-force=209) path is complicated. The full path is
tftp-root + 210 directory + 209 config file
Here, /home + /arch/ + boot/syslinux/archiso.cfg ( instead of boot/syslinux we can put the config file anywhere BUT! .)
But the most complicated is the path of other files like 'whichsys.c32' etc. How they are formed?
tftp-root + 210 directory + boot/syslinux/<filename> boot/syslinux/ is a MUST, in this way they asks the TFTPD to send files.
That's why we need to create the directory hierarchy
/TFTP root/ <something - for 210>/boot/ and inside /boot, copied the syslinux/ and x86_64/ directories. syslinux for pxe boot up and x86_64/ for Arch Linux booting.
cp -r /run/archiso/bootmnt/arch/boot/syslinux /home/arch/boot cp -r /run/archiso/bootmnt/arch/boot/x86_64 /home/arch/boot
We can not comment out or erase the option 210, the directory option, it does not work.
The customized arch Linux pxe boot menu takes in the /home/arch/boot/syslinux/archiso_pxe.cfg file. We removed the AMD and Intel specific initrd files and adding coytoram=n as kernel parameter. Our old machine could not boot otherwise.
The GRUB edit seemed a tedious job, and the default archiso mount folder /run/archiso/bootmnt is read-only, we do this work around.
----------------------------------SETUP NBD:
Once it is done, we can either use NBD - Network Block Device ( to load archlinux in PXE client from ISO directly); configuration file location for NBD is /etc/nbd-server/config
Sample config file content:
[generic]
# The [generic] section is required, even if nothing is specified there.
[archiso]
readonly = true
exportname = /path/to/archlinux-2019.08.01-x86_64.iso
----------------------------------
SETUP NFS:
Or, we can setup NFS - Network File System that will use the arch live directory /run/archiso/bootmnt/ ; configuration file is /etc/exports
In /etc/exports we appended the line:
/run/archiso/bootmnt 192.168.0.1/24(ro,no_subtree_check)
To launch the NFS service: systemctl start nfs-server.service----------------------------------SHARING the internet with PXE client:Since Arch Linux pacman needs internet to download packages, we shared the internet connection. We connected the server with internet and share connection with client. Server is equipped with 2 NIC cards.Arch pxe wiki provides the commands to be executed in the server:iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE----------------------------------We also made the internet gateway as default gateway:route add default gw <inet v4 IP address of gateway> <inet interface name>
ALL in a single run:
This is script that composes all necessary commands. So my job is even easier now, mounting the partition in /mnt where all my scripts are stored, run the commands by
zsh command_file_name
and done. PXE server is ready. Here is the commands file content:
ip addr add 192.168.0.1/24 dev enp1s0 # For default boot options cp -f /mnt/dnsmasq.conf /etc/dnsmasq.conf # For customized boot parameters. cp -f /mnt/dnsmasq.customconf.conf /etc/dnsmasq.conf mkdir -p /home/arch/boot/ cp -r /run/archiso/bootmnt/arch/boot/syslinux /home/arch/boot cp -r /run/archiso/bootmnt/arch/boot/x86_64 /home/arch/boot # Modify Arch Kernel parameters sed 's/^INITRD.*,/INITRD /;s/^APPEND/APPEND copytoram=n /' /home/arch/boot/syslinux/archiso_pxe.cfg -i # Now start the service systemctl start dnsmasq.service # For NFS - since a single line we do not created a file echo '/run/archiso/bootmnt 192.168.0.1/24(ro,no_subtree_check)' >> /etc/exports systemctl start nfs-server.service # For NBD systemctl start nbd.service # To setup internet connection in PXE server and share with PXE client: ip addr add <inet v4 IP address>/28 dev <inet interface name> route add default gw <inet v4 IP address of gateway> <inet interface name> # Routing the client IP iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE
For a low configuration (lower RAM) machine, NBD seems work better than NFS




