https://wiki.archlinux.org/api.php?action=feedcontributions&user=Kmshanah&feedformat=atomArchWiki - User contributions [en]2024-03-29T15:30:37ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Diskless_system&diff=229524Diskless system2012-10-18T22:23:28Z<p>Kmshanah: /* Bootstrapping installation */ the nfsv4 module does not work - the nfsmount utility from mkinitcpio-nfs-utils only supports nfsv2 and nfsv3, you have to use one of those two for now</p>
<hr />
<div>[[Category:Boot process]]<br />
[[Category:File systems]]<br />
[[Category:Networking]]<br />
{{Article summary start}}<br />
{{Article summary text|Detailed explanation of a PXE booted Arch installation with networked root filesystem.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|NFS}}<br />
{{Article summary wiki|PXE}}<br />
{{Article summary wiki|Mkinitcpio#Using_net}}<br />
{{Article summary end}}<br />
{{Merge|PXE|needs to be rewritten into sub-articles; duplicated information}}<br />
<br />
Contrast to the [[Installation Guide|official installation guide]], which concentrates on an arch installation on local storage, here the installation is to be placed on network storage.<br />
<br />
==Server configuration==<br />
<br />
You will need a DHCP server to setup networking, as well as a TFTP server to transfer the boot image (a requirement of all PXE option roms). Unlike [[PXE]] which is designed for quick-and-dirty/temporary setups to boot installation media, here you're actually doing a ''network'' installation, which is more-permanent, and thus calls for doing things properly.<br />
<br />
===DHCP===<br />
<br />
Install ISC {{pkg|dhcp}}.<br />
<br />
{{bc|# pacman -Syu dhcp}}<br />
<br />
Configure ISC DHCP.<br />
<br />
{{hc|# vim /etc/dhcpd.conf|2=<br />
<nowiki>allow booting;<br />
allow bootp;<br />
<br />
authoritative;<br />
<br />
option domain-name-servers 10.0.0.1;<br />
<br />
group <br />
{<br />
next-server 10.0.0.1;<br />
filename "pxelinux.0";<br />
<br />
subnet 10.0.0.0 netmask 255.255.255.0 {<br />
option routers 10.0.0.1;<br />
range 10.0.0.128 10.0.0.254;<br />
}<br />
}</nowiki>}}<br />
<br />
{{Note|{{ic|next-server}} should be the address of the TFTP server; everything else should be changed to match your network}}<br />
<br />
Start ISC DHCP.<br />
<br />
{{bc|# systemctl start dhcpd}}<br />
<br />
Or if you use {{pkg|sysvinit}},<br />
<br />
{{bc|# rc.d start dhcpd}}<br />
<br />
===TFTP===<br />
<br />
The TFTP server will be used to transfer the kernel, initramfs, and pxelinux to the client.<br />
<br />
Install {{pkg|tftp-hpa}}.<br />
<br />
{{bc|# pacman -Syu tftp-hpa}}<br />
<br />
{{Note|Change {{ic|/mnt/arch/boot}} to {{ic|/mnt/boot}} if you're going to use NBD, because you'll be unable to mount your root filesystem while in use}}<br />
<br />
====systemd====<br />
<br />
Configure tftp-hpa.<br />
<br />
{{bc|# cp /usr/lib/systemd/system/tftpd.s* /etc/systemd/system/}}<br />
<br />
{{hc|# vim /etc/systemd/system/tftpd.service|2=<br />
<nowiki><br />
[Unit]<br />
Description=hpa's original TFTP daemon<br />
<br />
[Service]<br />
ExecStart=/usr/sbin/in.tftpd -s /mnt/arch/boot/<br />
StandardInput=socket<br />
StandardOutput=inherit<br />
StandardError=journal<br />
</nowiki>}}<br />
<br />
Start tftpd :<br />
<br />
{{bc|# systemctl start tftpd.socket}}<br />
{{bc|# systemctl enable tftpd.socket}}<br />
<br />
====sysvinit====<br />
<br />
Configure tftp-hpa.<br />
<br />
{{hc|# vi /etc/conf.d/tftpd|<nowiki>TFTPD_ARGS="-l -s /mnt/arch/boot"</nowiki>}}<br />
<br />
Start tftpd.<br />
<br />
{{bc|# rc.d start tftpd}}<br />
<br />
===Network storage===<br />
<br />
The primary difference between using NFS and NBD is while with both you can in fact have multiple clients using the same installation, with NBD (by the nature of manipulating a filesystem directly) you'll need to use the {{ic|copyonwrite}} mode to do so, which ends up discarding all writes on client disconnected. In some situations however, this might be highly desirable.<br />
<br />
====NFS====<br />
<br />
Install {{pkg|nfs-utils}} on the server.<br />
<br />
{{bc|# pacman -Syu nfs-utils}}<br />
<br />
You'll need to add the root of your arch installation to your NFS exports.<br />
<br />
{{hc|# vim /etc/exports|2=<br />
/mnt/arch *(rw,fsid=0,no_root_squash,no_subtree_check,async)<br />
}}<br />
<br />
Next start NFS.<br />
<br />
{{bc|# systemctl start nfsd.service rpc-idmapd.service rpc-mountd.service rpcbind.service}}<br />
<br />
Or if you still use sysvinit,<br />
<br />
{{bc|# rc.d start rpcbind nfs-common nfs-server}}<br />
<br />
Additional information can be found in the [[NFS]] article.<br />
<br />
====NBD====<br />
<br />
Install {{pkg|nbd}}.<br />
<br />
{{bc|# pacman -Syu nbd}}<br />
<br />
Configure nbd.<br />
<br />
{{hc|# vim /etc/nbd-server/config|2=<br />
[generic]<br />
[arch]<br />
exportname = /mnt/arch.img<br />
copyonwrite = false}}<br />
<br />
{{note|Set {{ic|copyonwrite}} to true if you want to have multiple clients using the same NBD share simultaneously; refer to man 5 nbd-server for more details.}}<br />
<br />
Start nbd.<br />
<br />
{{bc|# systemctl start nbd}}<br />
<br />
Or if you still use sysvinit,<br />
<br />
{{bc|# rc.d start nbd-server}}<br />
<br />
==Client installation==<br />
<br />
===Directory setup===<br />
<br />
Create a [[Wikipedia: Sparse file|sparse file]] of at least 5 gigabytes, and create an ext4 filesystem on it (you can of course also use a real block device or [[LVM]] if you so desire).<br />
<br />
{{bc|1=<br />
# truncate -s 5G /mnt/arch.img<br />
# mkfs.ext4 /mnt/arch.img<br />
# mkdir -p /mnt/arch<br />
# mount /mnt/arch.img /mnt/arch}}<br />
<br />
{{Note|Creating a separate filesystem is required for NBD but optional for NFS and can be skipped/ignored}}<br />
<br />
First, create a directory that will contain the Arch installation; replace {{ic|/mnt/arch}} with wherever you'd like to put your installation.<br />
<br />
{{bc|1=<br />
<nowiki><br />
# export root=/mnt/arch<br />
# mkdir -p "$root/{proc,sys,run,tmp}"<br />
# mkdir -p "$root/dev/{pts,shm}"<br />
</nowiki>}}<br />
<br />
This also creates the directories that will be used for the API filesystem mountpoints later. Next we create the directory that pacman stores its database.<br />
<br />
{{bc|# mkdir -p "$root/var/lib/pacman"}}<br />
<br />
===Bootstrapping installation===<br />
<br />
{{Note|You can also use {{ic|arch-chroot}} and {{ic|pacstrap}} from {{pkg|arch-install-scripts}} rather than {{ic|chroot}} and {{pkg|pacman}} directly}}<br />
<br />
Mount the Linux API filesystems.<br />
<br />
{{bc|1=<br />
# mount -t proc proc "$root/proc" -o nosuid,noexec,nodev<br />
# mount -t sysfs sys "$root/sys" -o nosuid,noexec,nodev<br />
# mount -t devtmpfs udev "$root/dev" -o mode=0755,nosuid<br />
# mount -t devpts devpts "$root/dev/pts" -o mode=0620,gid=5,nosuid,noexec}}<br />
<br />
Install the essential packages needed.<br />
<br />
{{bc|# pacman -Syu --root "$root" --dbpath "$root/var/lib/pacman" base base-devel --arch x86_64}}<br />
<br />
Replace {{ic|x86_64}} with {{ic|i686}} as appropriate for your target hardware.<br />
<br />
You'll need to install either {{pkg|mkinitcpio-nfs-utils}} or {{aur|mkinitcpio-nbd}} depending on whether you are using NFS or NBD.<br />
<br />
Next, edit {{ic|"$root/etc/mkinitcpio.conf"}} and add {{ic|nfsv3}} to the {{ic|MODULES}} array, and add {{ic|net}} after {{ic|udev}} to the {{ic|HOOKS}} array.<br />
<br />
{{hc|# vim "$root/etc/mkinitcpio.conf"|2=<br />
MODULES="nfsv3"<br />
HOOKS="base udev '''net''' autodetect filesystems"}}<br />
<br />
{{Note|Add {{ic|nbd}} after the {{ic|net}} hook if you are using NBD.}}<br />
<br />
The initramfs now needs to be rebuilt; the easiest way to do this is [[chroot]].<br />
<br />
{{bc|1=<br />
# chroot "$root" /bin/bash<br />
(chroot) # mkinitcpio -p linux<br />
(chroot) # exit}}<br />
<br />
Finally, cleanup by unmounting all of the virtual filesystems we mounted earlier.<br />
<br />
{{bc|1=<br />
# umount \<br />
"$root/dev/pts" \<br />
"$root/dev" \<br />
"$root/sys" \<br />
"$root/proc"}}<br />
<br />
==Client configuration==<br />
<br />
In addition to the setup mentioned here, you should also set up your [[HOSTNAME#Set_the_host_name|hostname]], [[Timezone#Time_Zone|timezone]], [[Locale#Setting_system-wide_locale|locale]], and [[KEYMAP|keymap]].<br />
<br />
===Pxelinux===<br />
<br />
Install {{pkg|syslinux}}.<br />
<br />
{{bc|1=<br />
# pacman -Syu syslinux}}<br />
<br />
Copy the pxelinux bootloader (provided by the syslinux package) to the boot directory of the client.<br />
<br />
{{bc|1=<br />
# cp /usr/lib/syslinux/pxelinux.0 "$root/boot"<br />
# mkdir "$root/boot/pxelinux.cfg"}}<br />
<br />
We also created the {{ic|pxelinux.cfg}} directory, which is where pxelinux searches for configuration files by default. Because we don't want to discriminate between different host MACs, we then create the {{ic|default}} configuration.<br />
<br />
{{hc|# vim "$root/boot/pxelinux.cfg/default"|<nowiki><br />
default linux<br />
<br />
label linux<br />
kernel vmlinuz-linux<br />
append initrd=initramfs-linux.img rootfstype=nfs root=/dev/nfs nfsroot=10.0.0.1:/mnt/arch,v4,rsize=16384,wsize=16384 ip=:::::eth0:dhcp<br />
</nowiki>}}<br />
<br />
Or if you are using NBD, use the following append line:<br />
<br />
{{bc|<nowiki># append initrd=initramfs-linux.img root=/dev/nbd0 nbd_host=10.0.0.1 nbd_name=arch ip=:::::eth0:dhcp</nowiki>}}<br />
<br />
{{Note|You will need to change {{ic|nbd_host}} and/or {{ic|nfsroot}}, respectively, to match your network configuration (the address of the NFS/NBD server)}}<br />
<br />
The pxelinux configuration syntax identical to syslinux; refer to the upstream documentation for more information.<br />
<br />
The kernel and initramfs will be transferred via TFTP, so the paths to those are going to be relative to the TFTP root. Otherwise, the root filesystem is going to be the NFS mount itself, so those are relative to the root of the NFS server.<br />
<br />
===VFS mountpoints===<br />
<br />
Add hacks to your [[fstab]] for the root filesystem and devpts.<br />
<br />
{{hc|# vim "$root/etc/fstab"|2=<br />
none / none<br />
none /dev/pts devpts gid=5,mode=620 0 0}}<br />
<br />
===Late-boot networking===<br />
<br />
{{Out of date|Should no longer be necessary}} <br />
<br />
This is to prevent the client from trying to reconnect the network and killing itself. Any disconnect of the network and your client will freeze.<br />
<br />
One way to fix this is by running {{pkg|dhcpcd}} with the {{ic|-s}} option to use the existing lease obtained in early-boot instead of requesting a new one.<br />
<br />
{{hc|# vim "$root/etc/conf.d/dhcpcd"|2=<nowiki><br />
DHCPCD_ARGS=" -s $(ifconfig eth0 | grep -o '[0-9]*\.[0-9\.]*' | head -n1)"</nowiki>}}<br />
<br />
{{hc|# vim "$root/etc/rc.conf"|2=<nowiki><br />
NETWORK_PERSIST="yes"</nowiki>}}<br />
<br />
==Client boot==<br />
<br />
===NBD===<br />
<br />
If you're using NBD, you'll need to umount the {{ic|arch.img}} before/while you boot your client.<br />
<br />
This makes things particularly interesting when it comes to kernel updates. You can't have your client filesystem mounted while you're booting a client, but that also means you need to use a kernel separate from your client filesystem in order to build it.<br />
<br />
You'll need to first copy /boot from the client installation (make sure your TFTP root matches this).<br />
<br />
{{bc|# cp -r "$root/boot" /mnt/boot}}<br />
<br />
You'll then need to umount $root before you start the client.<br />
<br />
{{bc|# umount "$root"}}<br />
<br />
{{Note|To update the kernel in this setup, you either need to mount {{ic|/mnt/boot}} using [[NFS]] in [[fstab]] on the client (prior to doing the kernel update) or mount your client filesystem after the client has disconnected from NBD}}<br />
<br />
==References==<br />
<br />
[https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt kernel.org: Mounting the root filesystem via NFS (nfsroot)]<br />
<br />
[http://www.syslinux.org/wiki/index.php/PXELINUX syslinux.org: pxelinux FAQ]</div>Kmshanahhttps://wiki.archlinux.org/index.php?title=Diskless_system&diff=229366Diskless system2012-10-18T03:21:57Z<p>Kmshanah: /* Bootstrapping installation */ Since Linux 3.6 nfs has been split into one module per protocol version</p>
<hr />
<div>[[Category:Boot process]]<br />
[[Category:File systems]]<br />
[[Category:Networking]]<br />
{{Article summary start}}<br />
{{Article summary text|Detailed explanation of a PXE booted Arch installation with networked root filesystem.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|NFS}}<br />
{{Article summary wiki|PXE}}<br />
{{Article summary wiki|Mkinitcpio#Using_net}}<br />
{{Article summary end}}<br />
{{Merge|PXE|needs to be rewritten into sub-articles; duplicated information}}<br />
<br />
Contrast to the [[Installation Guide|official installation guide]], which concentrates on an arch installation on local storage, here the installation is to be placed on network storage.<br />
<br />
==Server configuration==<br />
<br />
You will need a DHCP server to setup networking, as well as a TFTP server to transfer the boot image (a requirement of all PXE option roms). Unlike [[PXE]] which is designed for quick-and-dirty/temporary setups to boot installation media, here you're actually doing a ''network'' installation, which is more-permanent, and thus calls for doing things properly.<br />
<br />
===DHCP===<br />
<br />
Install ISC {{pkg|dhcp}}.<br />
<br />
{{bc|# pacman -Syu dhcp}}<br />
<br />
Configure ISC DHCP.<br />
<br />
{{hc|# vim /etc/dhcpd.conf|2=<br />
<nowiki>allow booting;<br />
allow bootp;<br />
<br />
authoritative;<br />
<br />
option domain-name-servers 10.0.0.1;<br />
<br />
group <br />
{<br />
next-server 10.0.0.1;<br />
filename "pxelinux.0";<br />
<br />
subnet 10.0.0.0 netmask 255.255.255.0 {<br />
option routers 10.0.0.1;<br />
range 10.0.0.128 10.0.0.254;<br />
}<br />
}</nowiki>}}<br />
<br />
{{Note|{{ic|next-server}} should be the address of the TFTP server; everything else should be changed to match your network}}<br />
<br />
Start ISC DHCP.<br />
<br />
{{bc|# systemctl start dhcpd}}<br />
<br />
Or if you use {{pkg|sysvinit}},<br />
<br />
{{bc|# rc.d start dhcpd}}<br />
<br />
===TFTP===<br />
<br />
The TFTP server will be used to transfer the kernel, initramfs, and pxelinux to the client.<br />
<br />
Install {{pkg|tftp-hpa}}.<br />
<br />
{{bc|# pacman -Syu tftp-hpa}}<br />
<br />
{{Note|Change {{ic|/mnt/arch/boot}} to {{ic|/mnt/boot}} if you're going to use NBD, because you'll be unable to mount your root filesystem while in use}}<br />
<br />
====systemd====<br />
<br />
Configure tftp-hpa.<br />
<br />
{{bc|# cp /usr/lib/systemd/system/tftpd.s* /etc/systemd/system/}}<br />
<br />
{{hc|# vim /etc/systemd/system/tftpd.service|2=<br />
<nowiki><br />
[Unit]<br />
Description=hpa's original TFTP daemon<br />
<br />
[Service]<br />
ExecStart=/usr/sbin/in.tftpd -s /mnt/arch/boot/<br />
StandardInput=socket<br />
StandardOutput=inherit<br />
StandardError=journal<br />
</nowiki>}}<br />
<br />
Start tftpd :<br />
<br />
{{bc|# systemctl start tftpd.socket}}<br />
{{bc|# systemctl enable tftpd.socket}}<br />
<br />
====sysvinit====<br />
<br />
Configure tftp-hpa.<br />
<br />
{{hc|# vi /etc/conf.d/tftpd|<nowiki>TFTPD_ARGS="-l -s /mnt/arch/boot"</nowiki>}}<br />
<br />
Start tftpd.<br />
<br />
{{bc|# rc.d start tftpd}}<br />
<br />
===Network storage===<br />
<br />
The primary difference between using NFS and NBD is while with both you can in fact have multiple clients using the same installation, with NBD (by the nature of manipulating a filesystem directly) you'll need to use the {{ic|copyonwrite}} mode to do so, which ends up discarding all writes on client disconnected. In some situations however, this might be highly desirable.<br />
<br />
====NFS====<br />
<br />
Install {{pkg|nfs-utils}} on the server.<br />
<br />
{{bc|# pacman -Syu nfs-utils}}<br />
<br />
You'll need to add the root of your arch installation to your NFS exports.<br />
<br />
{{hc|# vim /etc/exports|2=<br />
/mnt/arch *(rw,fsid=0,no_root_squash,no_subtree_check,async)<br />
}}<br />
<br />
Next start NFS.<br />
<br />
{{bc|# systemctl start nfsd.service rpc-idmapd.service rpc-mountd.service rpcbind.service}}<br />
<br />
Or if you still use sysvinit,<br />
<br />
{{bc|# rc.d start rpcbind nfs-common nfs-server}}<br />
<br />
Additional information can be found in the [[NFS]] article.<br />
<br />
====NBD====<br />
<br />
Install {{pkg|nbd}}.<br />
<br />
{{bc|# pacman -Syu nbd}}<br />
<br />
Configure nbd.<br />
<br />
{{hc|# vim /etc/nbd-server/config|2=<br />
[generic]<br />
[arch]<br />
exportname = /mnt/arch.img<br />
copyonwrite = false}}<br />
<br />
{{note|Set {{ic|copyonwrite}} to true if you want to have multiple clients using the same NBD share simultaneously; refer to man 5 nbd-server for more details.}}<br />
<br />
Start nbd.<br />
<br />
{{bc|# systemctl start nbd}}<br />
<br />
Or if you still use sysvinit,<br />
<br />
{{bc|# rc.d start nbd-server}}<br />
<br />
==Client installation==<br />
<br />
===Directory setup===<br />
<br />
Create a [[Wikipedia: Sparse file|sparse file]] of at least 5 gigabytes, and create an ext4 filesystem on it (you can of course also use a real block device or [[LVM]] if you so desire).<br />
<br />
{{bc|1=<br />
# truncate -s 5G /mnt/arch.img<br />
# mkfs.ext4 /mnt/arch.img<br />
# mkdir -p /mnt/arch<br />
# mount /mnt/arch.img /mnt/arch}}<br />
<br />
{{Note|Creating a separate filesystem is required for NBD but optional for NFS and can be skipped/ignored}}<br />
<br />
First, create a directory that will contain the Arch installation; replace {{ic|/mnt/arch}} with wherever you'd like to put your installation.<br />
<br />
{{bc|1=<br />
<nowiki><br />
# export root=/mnt/arch<br />
# mkdir -p "$root/{proc,sys,run,tmp}"<br />
# mkdir -p "$root/dev/{pts,shm}"<br />
</nowiki>}}<br />
<br />
This also creates the directories that will be used for the API filesystem mountpoints later. Next we create the directory that pacman stores its database.<br />
<br />
{{bc|# mkdir -p "$root/var/lib/pacman"}}<br />
<br />
===Bootstrapping installation===<br />
<br />
{{Note|You can also use {{ic|arch-chroot}} and {{ic|pacstrap}} from {{pkg|arch-install-scripts}} rather than {{ic|chroot}} and {{pkg|pacman}} directly}}<br />
<br />
Mount the Linux API filesystems.<br />
<br />
{{bc|1=<br />
# mount -t proc proc "$root/proc" -o nosuid,noexec,nodev<br />
# mount -t sysfs sys "$root/sys" -o nosuid,noexec,nodev<br />
# mount -t devtmpfs udev "$root/dev" -o mode=0755,nosuid<br />
# mount -t devpts devpts "$root/dev/pts" -o mode=0620,gid=5,nosuid,noexec}}<br />
<br />
Install the essential packages needed.<br />
<br />
{{bc|# pacman -Syu --root "$root" --dbpath "$root/var/lib/pacman" base base-devel --arch x86_64}}<br />
<br />
Replace {{ic|x86_64}} with {{ic|i686}} as appropriate for your target hardware.<br />
<br />
You'll need to install either {{pkg|mkinitcpio-nfs-utils}} or {{aur|mkinitcpio-nbd}} depending on whether you are using NFS or NBD.<br />
<br />
Next, edit {{ic|"$root/etc/mkinitcpio.conf"}} and add {{ic|nfsv3}} or {{ic|nfsv2}} to the {{ic|MODULES}} array, and add {{ic|net}} after {{ic|udev}} to the {{ic|HOOKS}} array.<br />
<br />
{{hc|# vim "$root/etc/mkinitcpio.conf"|2=<br />
MODULES="nfsv3"<br />
HOOKS="base udev '''net''' autodetect filesystems"}}<br />
<br />
{{Note|Add {{ic|nbd}} after the {{ic|net}} hook if you are using NBD.}}<br />
<br />
The initramfs now needs to be rebuilt; the easiest way to do this is [[chroot]].<br />
<br />
{{bc|1=<br />
# chroot "$root" /bin/bash<br />
(chroot) # mkinitcpio -p linux<br />
(chroot) # exit}}<br />
<br />
Finally, cleanup by unmounting all of the virtual filesystems we mounted earlier.<br />
<br />
{{bc|1=<br />
# umount \<br />
"$root/dev/pts" \<br />
"$root/dev" \<br />
"$root/sys" \<br />
"$root/proc"}}<br />
<br />
==Client configuration==<br />
<br />
In addition to the setup mentioned here, you should also set up your [[HOSTNAME#Set_the_host_name|hostname]], [[Timezone#Time_Zone|timezone]], [[Locale#Setting_system-wide_locale|locale]], and [[KEYMAP|keymap]].<br />
<br />
===Pxelinux===<br />
<br />
Install {{pkg|syslinux}}.<br />
<br />
{{bc|1=<br />
# pacman -Syu syslinux}}<br />
<br />
Copy the pxelinux bootloader (provided by the syslinux package) to the boot directory of the client.<br />
<br />
{{bc|1=<br />
# cp /usr/lib/syslinux/pxelinux.0 "$root/boot"<br />
# mkdir "$root/boot/pxelinux.cfg"}}<br />
<br />
We also created the {{ic|pxelinux.cfg}} directory, which is where pxelinux searches for configuration files by default. Because we don't want to discriminate between different host MACs, we then create the {{ic|default}} configuration.<br />
<br />
{{hc|# vim "$root/boot/pxelinux.cfg/default"|<nowiki><br />
default linux<br />
<br />
label linux<br />
kernel vmlinuz-linux<br />
append initrd=initramfs-linux.img rootfstype=nfs root=/dev/nfs nfsroot=10.0.0.1:/mnt/arch,v4,rsize=16384,wsize=16384 ip=:::::eth0:dhcp<br />
</nowiki>}}<br />
<br />
Or if you are using NBD, use the following append line:<br />
<br />
{{bc|<nowiki># append initrd=initramfs-linux.img root=/dev/nbd0 nbd_host=10.0.0.1 nbd_name=arch ip=:::::eth0:dhcp</nowiki>}}<br />
<br />
{{Note|You will need to change {{ic|nbd_host}} and/or {{ic|nfsroot}}, respectively, to match your network configuration (the address of the NFS/NBD server)}}<br />
<br />
The pxelinux configuration syntax identical to syslinux; refer to the upstream documentation for more information.<br />
<br />
The kernel and initramfs will be transferred via TFTP, so the paths to those are going to be relative to the TFTP root. Otherwise, the root filesystem is going to be the NFS mount itself, so those are relative to the root of the NFS server.<br />
<br />
===VFS mountpoints===<br />
<br />
Add hacks to your [[fstab]] for the root filesystem and devpts.<br />
<br />
{{hc|# vim "$root/etc/fstab"|2=<br />
none / none<br />
none /dev/pts devpts gid=5,mode=620 0 0}}<br />
<br />
===Late-boot networking===<br />
<br />
{{Out of date|Should no longer be necessary}} <br />
<br />
This is to prevent the client from trying to reconnect the network and killing itself. Any disconnect of the network and your client will freeze.<br />
<br />
One way to fix this is by running {{pkg|dhcpcd}} with the {{ic|-s}} option to use the existing lease obtained in early-boot instead of requesting a new one.<br />
<br />
{{hc|# vim "$root/etc/conf.d/dhcpcd"|2=<nowiki><br />
DHCPCD_ARGS=" -s $(ifconfig eth0 | grep -o '[0-9]*\.[0-9\.]*' | head -n1)"</nowiki>}}<br />
<br />
{{hc|# vim "$root/etc/rc.conf"|2=<nowiki><br />
NETWORK_PERSIST="yes"</nowiki>}}<br />
<br />
==Client boot==<br />
<br />
===NBD===<br />
<br />
If you're using NBD, you'll need to umount the {{ic|arch.img}} before/while you boot your client.<br />
<br />
This makes things particularly interesting when it comes to kernel updates. You can't have your client filesystem mounted while you're booting a client, but that also means you need to use a kernel separate from your client filesystem in order to build it.<br />
<br />
You'll need to first copy /boot from the client installation (make sure your TFTP root matches this).<br />
<br />
{{bc|# cp -r "$root/boot" /mnt/boot}}<br />
<br />
You'll then need to umount $root before you start the client.<br />
<br />
{{bc|# umount "$root"}}<br />
<br />
{{Note|To update the kernel in this setup, you either need to mount {{ic|/mnt/boot}} using [[NFS]] in [[fstab]] on the client (prior to doing the kernel update) or mount your client filesystem after the client has disconnected from NBD}}<br />
<br />
==References==<br />
<br />
[https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt kernel.org: Mounting the root filesystem via NFS (nfsroot)]<br />
<br />
[http://www.syslinux.org/wiki/index.php/PXELINUX syslinux.org: pxelinux FAQ]</div>Kmshanah