| 1 |
.. _network_live_boot: |
| 2 |
|
| 3 |
Booting a Live ISO Image from Network |
| 4 |
===================================== |
| 5 |
|
| 6 |
.. sidebar:: Abstract |
| 7 |
|
| 8 |
This page provides further information for handling |
| 9 |
ISO images built with {kiwi} and references the following |
| 10 |
articles: |
| 11 |
|
| 12 |
* :ref:`hybrid_iso` |
| 13 |
|
| 14 |
In {kiwi}, live ISO images can be configured to boot via the |
| 15 |
PXE boot protocol. This functionality requires a network boot |
| 16 |
server setup on the system. Details on how to set up such a server |
| 17 |
can be found in :ref:`network-boot-server`. |
| 18 |
|
| 19 |
After the live ISO is built as shown in :ref:`hybrid_iso`, |
| 20 |
the following configuration steps are required to boot from |
| 21 |
the network: |
| 22 |
|
| 23 |
1. Extract initrd/kernel from Live ISO |
| 24 |
|
| 25 |
The PXE boot process loads the configured kernel and initrd from |
| 26 |
the PXE server. For this reason, these two files must be extracted |
| 27 |
from the live ISO image and copied to the PXE server as follows: |
| 28 |
|
| 29 |
.. code:: bash |
| 30 |
|
| 31 |
$ mount {exc_image_base_name_live}.x86_64-{exc_image_version}.iso /mnt |
| 32 |
$ cp /mnt/boot/x86_64/loader/initrd /srv/tftpboot/boot/initrd |
| 33 |
$ cp /mnt/boot/x86_64/loader/linux /srv/tftpboot/boot/linux |
| 34 |
$ umount /mnt |
| 35 |
|
| 36 |
.. note:: |
| 37 |
|
| 38 |
This step must be repeated with any new build of the live ISO image. |
| 39 |
|
| 40 |
2. Export Live ISO to the Network |
| 41 |
|
| 42 |
Access to the live ISO file must be provided by either `ftp`, |
| 43 |
`http`, `https`, or `dolly`. The simplest method is to set up an FTP server, |
| 44 |
e.g., `vsftpd`, and copy the live ISO file to the data directory: |
| 45 |
|
| 46 |
.. code:: bash |
| 47 |
|
| 48 |
$ mkdir -p /srv/ftp/image |
| 49 |
$ cp {exc_image_base_name_live}.x86_64-{exc_image_version}.iso /srv/ftp/image |
| 50 |
|
| 51 |
.. note:: |
| 52 |
|
| 53 |
Check if the image can be downloaded via: |
| 54 |
`wget ftp://IP/image/{exc_image_base_name_live}.x86_64-{exc_image_version}.iso` |
| 55 |
before the next step. |
| 56 |
|
| 57 |
3. Set up live ISO boot entry in PXE configuration |
| 58 |
|
| 59 |
.. note:: |
| 60 |
|
| 61 |
The following step assumes that the `pxelinux.0` loader |
| 62 |
has been configured on the boot server to boot up network |
| 63 |
clients. |
| 64 |
|
| 65 |
Edit the file :file:`/srv/tftpboot/pxelinux.cfg/default` and create |
| 66 |
a boot entry of the form: |
| 67 |
|
| 68 |
.. code:: bash |
| 69 |
|
| 70 |
LABEL Live-Boot |
| 71 |
kernel boot/linux |
| 72 |
append initrd=boot/initrd ip=dhcp root=live:ftp://IP/image/{exc_image_base_name_live}.x86_64-{exc_image_version}.iso |
| 73 |
|
| 74 |
* The `ip=` parameter controls how the dracut network module sets up |
| 75 |
the network. Several options exist to control how the network |
| 76 |
interface should be set up. Please consult the dracut manual |
| 77 |
for further information. |
| 78 |
|
| 79 |
* The boot parameter `root=live:PROTOCOL://IP/PATH...` specifies the |
| 80 |
remote endpoint and protocol to find the live ISO file. So far, |
| 81 |
`ftp`, `http`, `https`, and `dolly` are supported. |
| 82 |
|
| 83 |
4. Boot from the Network |
| 84 |
|
| 85 |
Within the network that has access to the PXE server and the |
| 86 |
IP in the `root=` option, any network client can now boot the |
| 87 |
live system. A test based on QEMU can be done as follows: |
| 88 |
|
| 89 |
.. code:: bash |
| 90 |
|
| 91 |
$ qemu -boot n |
| 92 |
|
| 93 |
Available Remote Boot Options |
| 94 |
----------------------------- |
| 95 |
|
| 96 |
The following kernel boot options are available to control |
| 97 |
the behavior of the remote boot process. |
| 98 |
|
| 99 |
rd.kiwi.live.curl_options= |
| 100 |
Options passed along to the curl call |
| 101 |
|
| 102 |
rd.kiwi.live.dolly_options= |
| 103 |
Options passed along to the dolly call |
| 104 |
|
| 105 |
rd.kiwi.live.system= |
| 106 |
Block device to use for the system. By default, this is set to `/dev/ram0`. |
| 107 |
|
| 108 |
ramdisk_size=kbytes |
| 109 |
Size of the ramdisk in kilobytes; the value is passed to the kernel `brd` |
| 110 |
module as `rd_size`. By default, this is set to 2097152, which is 2 GiB. |
| 111 |
|
| 112 |
rd.kiwi.live.reset |
| 113 |
Force reset of the live system. This option only makes sense if |
| 114 |
the live system device (rd.kiwi.live.system) points to a persistent |
| 115 |
storage device. In this case, {kiwi} loads the system only once |
| 116 |
and does not overwrite it unless a reset is requested. |
| 117 |
|
| 118 |
Persistent Live System |
| 119 |
---------------------- |
| 120 |
|
| 121 |
The remote boot process of a live ISO image places the ISO file |
| 122 |
into a ramdisk by default. This means all data lives in memory and |
| 123 |
is not persistent. To boot the live system from a remote |
| 124 |
location and keep it on persistent storage, it's required to |
| 125 |
pass the `rd.kiwi.live.system` boot option with the device name |
| 126 |
pointing to that persistent storage. |
| 127 |
|
| 128 |
.. warning:: |
| 129 |
|
| 130 |
All data on the device given via `rd.kiwi.live.system` will be wiped. |
| 131 |
|
| 132 |
A test based on QEMU can be done as follows: |
| 133 |
|
| 134 |
Edit the file :file:`/srv/tftpboot/pxelinux.cfg/default` and create |
| 135 |
a boot entry of the form: |
| 136 |
|
| 137 |
.. code:: bash |
| 138 |
|
| 139 |
LABEL Live-Boot |
| 140 |
kernel boot/linux |
| 141 |
append initrd=boot/initrd ip=dhcp root=live:ftp://IP/image/{exc_image_base_name_live}.x86_64-{exc_image_version}.iso ramdisk_size=3545728 rd.kiwi.live.system=/dev/sda rd.live.overlay.persistent rd.live.overlay.cowfs=xfs |
| 142 |
|
| 143 |
* The `rd.live.overlay.persistent` and `rd.live.overlay.cowfs=xfs` |
| 144 |
options are standard {kiwi} live ISO options to control if and how a |
| 145 |
persistent write partition should be created. The options only take |
| 146 |
effect when booting into a persistent storage device. |
| 147 |
|
| 148 |
Next, create a persistent storage disk of 3G and attach it to the |
| 149 |
QEMU instance. |
| 150 |
|
| 151 |
.. code:: bash |
| 152 |
|
| 153 |
$ qemu-img create mydisk.raw 3G |
| 154 |
$ qemu -boot n -hda mydisk.raw |
| 155 |
|
| 156 |
The live system will be deployed once to the locally attached disk and |
| 157 |
will boot from it. Any subsequent boot process will not modify the local |
| 158 |
disk unless `rd.kiwi.live.reset` is passed on the kernel command line. |
| 159 |
If deployed, there is no need for the network anymore, and the |
| 160 |
system could also boot standalone. |