Booting a Live ISO Image from Network
In KIWI NG, live ISO images can be configured to boot via the PXE boot protocol. This functionality requires a network boot server setup on the system. Details on how to set up such a server can be found in Setting Up a Network Boot Server.
After the live ISO is built as shown in Build an ISO Hybrid Live Image, the following configuration steps are required to boot from the network:
Extract initrd/kernel from Live ISO
The PXE boot process loads the configured kernel and initrd from the PXE server. For this reason, these two files must be extracted from the live ISO image and copied to the PXE server as follows:
$ mount kiwi-test-image-live.x86_64-1.15.6.iso /mnt $ cp /mnt/boot/x86_64/loader/initrd /srv/tftpboot/boot/initrd $ cp /mnt/boot/x86_64/loader/linux /srv/tftpboot/boot/linux $ umount /mnt
Note
This step must be repeated with any new build of the live ISO image.
Export Live ISO to the Network
Access to the live ISO file must be provided by either
ftp,http,https, ordolly. The simplest method is to set up a FTP server, e.g.,vsftpd, and copy the live ISO file to the data directory:$ mkdir -p /srv/ftp/image $ cp kiwi-test-image-live.x86_64-1.15.6.iso /srv/ftp/image
Note
Check if the image can be downloaded via:
wget ftp://IP/image/kiwi-test-image-live.x86_64-1.15.6.isobefore the next step.Set up live ISO boot entry in PXE configuration
Note
The following step assumes that the
pxelinux.0loader has been configured on the boot server to boot up network clients.Edit the file
/srv/tftpboot/pxelinux.cfg/defaultand create a boot entry of the form:LABEL Live-Boot kernel boot/linux append initrd=boot/initrd ip=dhcp root=live:ftp://IP/image/kiwi-test-image-live.x86_64-1.15.6.iso
The
ip=parameter controls how the dracut network module sets up the network. Several options exist to control how the network interface should be set up. Please consult the dracut manual for further information.The boot parameter
root=live:PROTOCOL://IP/PATH...specifies the remote endpoint and protocol to find the live ISO file. So far,ftp,http,https, anddollyare supported.
Boot from the Network
Within the network that has access to the PXE server and the IP in the
root=option, any network client can now boot the live system. A test based on QEMU can be done as follows:$ qemu -boot n
Available Remote Boot Options
The following kernel boot options are available to control the behavior of the remote boot process.
- rd.kiwi.live.curl_options=
Options passed along to the curl call
- rd.kiwi.live.dolly_options=
Options passed along to the dolly call
- rd.kiwi.live.system=
Block device to use for the system. By default, this is set to
/dev/ram0.- ramdisk_size=bytes
Size of the ramdisk in bytes. By default, this is set to 2097152 (2G).
- rd.kiwi.live.reset
Force reset of the live system. This option only makes sense if the live system device (rd.kiwi.live.system) points to a persistent storage device. In this case, KIWI NG loads the system only once and does not overwrite it unless a reset is requested.
Persistent Live System
The remote boot process of a live ISO image places the ISO file
into a ramdisk by default. This means all data lives in memory and
is not persistent. To boot the live system from a remote
location and keep it on persistent storage, it’s required to
pass the rd.kiwi.live.system boot option with the device name
pointing to that persistent storage.
Warning
All data on the device given via rd.kiwi.live.system will be wiped.
A test based on QEMU can be done as follows:
Edit the file /srv/tftpboot/pxelinux.cfg/default and create
a boot entry of the form:
LABEL Live-Boot
kernel boot/linux
append initrd=boot/initrd ip=dhcp root=live:ftp://IP/image/kiwi-test-image-live.x86_64-1.15.6.iso ramdisk_size=3545728 rd.kiwi.live.system=/dev/sda rd.live.overlay.persistent rd.live.overlay.cowfs=xfs
The
rd.live.overlay.persistentandrd.live.overlay.cowfs=xfsoptions are standard KIWI NG live ISO options to control if and how a persistent write partition should be created. The options only take effect when booting into a persistent storage device.
Next, create a persistent storage disk of 3G and attach it to the QEMU instance.
$ qemu-img create mydisk.raw 3G
$ qemu -boot n -hda mydisk.raw
The live system will be deployed once to the locally attached disk and
will boot from it. Any subsequent boot process will not modify the local
disk unless rd.kiwi.live.reset is passed on the kernel command line.
If deployed, there is no need for the network anymore, and the
system could also boot standalone.