| 1 |
|
| 2 |
Debian-Installer NetBoot Assistant |
| 3 |
==================================== |
| 4 |
|
| 5 |
Overview |
| 6 |
-------- |
| 7 |
'di-netboot-assistant' is a tool to simplify the preparation of |
| 8 |
files for TFTP net booting: It downloads and extracts all the |
| 9 |
files needed and takes care of organizing them. |
| 10 |
In addition, it prepares a top level menu, which allows to choose |
| 11 |
from all installed netboot images. |
| 12 |
It supports completely automatic installations by preseeding the |
| 13 |
installer. For details consult the 'README.preseed'. |
| 14 |
|
| 15 |
|
| 16 |
QuickStart |
| 17 |
---------- |
| 18 |
1. Install the 'di-netboot-assistant' package and a TFTP |
| 19 |
server, for example 'dnsmasq' configured with |
| 20 |
'enable-tftp' [2]. |
| 21 |
2. Run 'di-netboot-assistant install stable' or similar. |
| 22 |
'di-netboot-assistant install' returns a list of netboot images |
| 23 |
available for download and installation. |
| 24 |
3. Configure a DHCP server, as explained in [1]. For further |
| 25 |
information, read the 'architecture specific notes' below and |
| 26 |
the example configuration samples [2]. |
| 27 |
|
| 28 |
For a more detailed example consult the 'README.installbox'. |
| 29 |
|
| 30 |
|
| 31 |
Packaged Debian-Installer Images |
| 32 |
-------------------------------- |
| 33 |
You can also use the images provided by the |
| 34 |
debian-installer-*-netboot-* packages. |
| 35 |
|
| 36 |
1. Install the needed debian-installer-*-netboot-* packages. |
| 37 |
2. Bind mount (use 'ro' only if no firmware is needed) or copy |
| 38 |
'/usr/lib/debian-installer/' to your tftp root directory: |
| 39 |
|
| 40 |
mount -o bind,ro /usr/lib/debian-installer/ $TFTP_ROOT/d-i/n-pkg/ |
| 41 |
|
| 42 |
To make this persistent, add the following line to '/etc/fstab': |
| 43 |
|
| 44 |
/usr/lib/debian-installer/ $TFTP_ROOT/d-i/n-pkg/ none bind,ro 0 0 |
| 45 |
|
| 46 |
3. Add the corresponding menu entries to the boot menu by running: |
| 47 |
|
| 48 |
di-netboot-assistant -v rebuild-menu |
| 49 |
|
| 50 |
|
| 51 |
Debian Live ISO Images |
| 52 |
---------------------- |
| 53 |
Finally, you can also provide Debian Live ISO images. |
| 54 |
|
| 55 |
1. Download the ISO image of interest. |
| 56 |
2. Mount the ISO image within your tftp root directory |
| 57 |
below '$TFTP_ROOT/d-i/n-live/': |
| 58 |
|
| 59 |
mount -o loop,ro /PATH/TO/IMAGE.iso $TFTP_ROOT/d-i/n-live/ISO_NAME |
| 60 |
|
| 61 |
To make this persistent, add the following line to '/etc/fstab': |
| 62 |
|
| 63 |
/PATH/TO/IMAGE.iso $TFTP_ROOT/d-i/n-live/ISO_NAME iso9660 loop,ro 0 0 |
| 64 |
|
| 65 |
3. Add the corresponding menu entries to the boot menu by running: |
| 66 |
|
| 67 |
di-netboot-assistant -v rebuild-menu |
| 68 |
|
| 69 |
NOTE: In case you prefer to provide filesystem.squashfs by faster means |
| 70 |
than the TFTP server, use the variable $ISO_NAME in SQUASHIMG=…, |
| 71 |
c.f. '/etc/di-netboot-assistant/di-netboot-assistant.conf'. |
| 72 |
|
| 73 |
|
| 74 |
TFTP server |
| 75 |
----------- |
| 76 |
Depending on the TFTP server you use, adjust either 'TFTP_ROOT=' |
| 77 |
in '/etc/di-netboot-assistant/di-netboot-assistant.conf' or the |
| 78 |
root directory of the TFTP server. |
| 79 |
|
| 80 |
|
| 81 |
DHCP server |
| 82 |
----------- |
| 83 |
There are two typical scenarios: |
| 84 |
┌────────┐ |
| 85 |
__ │ Switch │ ┌───────────────────┐ |
| 86 |
__/ \__ └─┬──┬─┬─┘ │ This host │ |
| 87 |
/ \ ┌──────────────┐ │ │ │ │ is the only │ |
| 88 |
( Internet )───┤ (DSL) Modem ├────┘ │ └────┤ DHCP server │ |
| 89 |
\__ __/ │ or router │ │ └───────────────────┘ |
| 90 |
\__/ └──────────────┘ │ ┌───────────────────┐ |
| 91 |
└────┤ A client computer │ |
| 92 |
└───────────────────┘ |
| 93 |
|
| 94 |
First case: The TFTP server also provides DHCP for the local |
| 95 |
network. This is the most simple and recommended |
| 96 |
configuration. You simply have to add some options |
| 97 |
to enable netbooting (typically, the filename to |
| 98 |
boot, and the tftp server's address). Read [1], |
| 99 |
examples [2] and architecture specific notes. |
| 100 |
|
| 101 |
┌────────┐ |
| 102 |
__ │ Switch │ |
| 103 |
__/ \__ ┌───────────────┐ └─┬──┬─┬─┘ |
| 104 |
/ \ │ (DSL) Modem │ │ │ │ ┌───────────────────┐ |
| 105 |
( Internet )───┤ with ├────┘ │ └────┤ This host │ |
| 106 |
\__ __/ │ build─in DHCP │ │ └───────────────────┘ |
| 107 |
\__/ └───────────────┘ │ ┌───────────────────┐ |
| 108 |
└────┤ A client computer │ |
| 109 |
└───────────────────┘ |
| 110 |
|
| 111 |
Second case: A DHCP already exists, but you can't/don't want to use it |
| 112 |
for netbooting. This isn't the recommended configuration, |
| 113 |
but it was successfully tested for netbooting PXE clients |
| 114 |
(i386, amd64 and ia64) on network where the existing DHCP |
| 115 |
server didn't provide netboot informations. |
| 116 |
!!!! Do not setup rogue dhcp servers in your company !!!! |
| 117 |
|
| 118 |
In this situation, you have to divide your DHCP subnet in |
| 119 |
two ranges of IP address. The first range will still be |
| 120 |
served by the existing DHCP server. |
| 121 |
The second part will be served by "this host". It will only |
| 122 |
reply to DHCP request sent during PXE netboot step. This is |
| 123 |
possible because client computers (actually, their PXE agent |
| 124 |
in the NIC's ROM) sends an option like this during PXE boot: |
| 125 |
vendor-class-id= "PXEClient:Arch:00000:UNDI:002001" |
| 126 |
Both dhcpd and dnsmasq can be instructed to provide answer |
| 127 |
depending on such strings. |
| 128 |
|
| 129 |
Note: For easy _home_ setup, you can choose not to reduce the |
| 130 |
range of IP served by the existing DHCP server, and just |
| 131 |
declare a *small* range of addresses on *both* DHCP (some |
| 132 |
addresses that are unlikely to be used on the first one) |
| 133 |
That's ugly, but it can work ! (as long your existing DHCP |
| 134 |
don't allocate some of those IP ;-) |
| 135 |
|
| 136 |
|
| 137 |
Using 'dnsmasq' |
| 138 |
--------------- |
| 139 |
'dnsmasq' is a simple all-in-one (DNS, DHCP and TFTP) server. |
| 140 |
|
| 141 |
QuickStart : |
| 142 |
Install the package 'dnsmasq': |
| 143 |
apt install dnsmasq |
| 144 |
|
| 145 |
Create the TFTP server's root directory: |
| 146 |
mkdir /var/lib/tftpboot |
| 147 |
|
| 148 |
Configure 'dnsmasq': |
| 149 |
cp /usr/share/doc/di-netboot-assistant/examples/dnsmasq.conf.simple \ |
| 150 |
/etc/dnsmasq.d/netboot-installer |
| 151 |
systemctl restart dnsmasq |
| 152 |
|
| 153 |
Install the netboot images: |
| 154 |
di-netboot-assistant install stable |
| 155 |
|
| 156 |
|
| 157 |
Running as non-root |
| 158 |
------------------- |
| 159 |
It is possible to run di-netboot-assistant as non root. There are |
| 160 |
actually two ways to achieve that: |
| 161 |
|
| 162 |
• Delegate to a group (that manage the system wide netboot images) |
| 163 |
|
| 164 |
In this case, we want to delegate the management of netboot files |
| 165 |
to one or more people that don't have access to root account. |
| 166 |
|
| 167 |
Create a group and add those user to the group |
| 168 |
addgroup dina-admin |
| 169 |
adduser johndoe dina-admin |
| 170 |
|
| 171 |
Purge the package (and existing files that are owned by root !). |
| 172 |
# Note : you will loose existing configuration file! |
| 173 |
apt-get purge di-netboot-assistant |
| 174 |
|
| 175 |
Allow that group to modify the files |
| 176 |
# note: the four lines below are on single command. |
| 177 |
for dir in /var/cache/di-netboot-assistant \ |
| 178 |
/var/lib/di-netboot-assistant \ |
| 179 |
/var/lib/tftpboot/; do |
| 180 |
dpkg-statoverride --update --add root dina-admin 2775 $dir |
| 181 |
done |
| 182 |
|
| 183 |
# add the following line in di-netboot-assistant.conf, so |
| 184 |
# so new file are writable by other members of the group. |
| 185 |
umask 0002 |
| 186 |
|
| 187 |
# Do not grant write permission on di-netboot-assistant.conf to |
| 188 |
# anybody but root. This would lead to privilege escalation since |
| 189 |
# the configuration file are executed (sourced) by the script. |
| 190 |
|
| 191 |
Reinstall the package |
| 192 |
apt-get install di-netboot-assistant |
| 193 |
|
| 194 |
• Per-user tftpboot |
| 195 |
It is possible to have per user configuration files and repositories. |
| 196 |
The user just have to create a configuration file in |
| 197 |
~/.di-netboot-assistant/di-netboot-assistant.conf |
| 198 |
and configure it. A sample file is provided in |
| 199 |
/usr/share/doc/di-netboot-assistant/examples/peruser.di-netboot-assistant.conf |
| 200 |
|
| 201 |
• Sudo |
| 202 |
Do *NOT* expect the restriction of a sudo user to only run di-netboot-assistant |
| 203 |
to be a restriction at all: It allows one to become root (because the sudoer |
| 204 |
can edit ~/.di-netboot-assistant/*). |
| 205 |
|
| 206 |
|
| 207 |
Testing |
| 208 |
------- |
| 209 |
qemu/kvm can emulate a TFTP server, so it's easy to test netboot: |
| 210 |
|
| 211 |
TFTP_ROOT="/var/lib/tftpboot/" |
| 212 |
|
| 213 |
qemu-system-x86_64 -enable-kvm -m 1024 -boot n -net nic \ |
| 214 |
-net user,tftp=$TFTP_ROOT,bootfile=/d-i/n-a/pxelinux.0 |
| 215 |
|
| 216 |
or with 'Open Virtual Machine Firmware' (ovmf) installed: |
| 217 |
|
| 218 |
qemu-system-x86_64 -enable-kvm -m 1024 -boot n -net nic -bios /usr/share/OVMF/OVMF_CODE.fd \ |
| 219 |
-net user,tftp=$TFTP_ROOT,bootfile=/d-i/n-a/bootnetx64.efi |
| 220 |
|
| 221 |
qemu-system-x86_64 -enable-kvm -m 1024 -boot order=n \ |
| 222 |
-net nic,netdev=net0 \ |
| 223 |
-bios /usr/share/OVMF/OVMF_CODE.fd \ |
| 224 |
-netdev user,id=net0,tftp=$TFTP_ROOT,bootfile=/d-i/n-a/bootnetx64.efi \ |
| 225 |
-object filter-dump,id=net0,netdev=net0,file=/tmp/neboot.pcap |
| 226 |
|
| 227 |
qemu-system-aarch64 -machine virt -m 1024 -cpu cortex-a57 -boot order=n \ |
| 228 |
-device virtio-net-device,netdev=net0 \ |
| 229 |
-bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd \ |
| 230 |
-netdev user,id=net0,tftp=$TFTP_ROOT,bootfile=/d-i/n-a/bootnetaa64.efi \ |
| 231 |
-object filter-dump,id=net0,netdev=net0,file=/tmp/neboot.pcap |
| 232 |
|
| 233 |
Mirrors |
| 234 |
------- |
| 235 |
The file 'di-sources.list' contains the canonical URLs for |
| 236 |
repositories of netboot image. |
| 237 |
You can set the variable 'MIRROR_REGEXPS' to rewrite the URLs to |
| 238 |
your preferred mirror (you can specify multiple space-separated |
| 239 |
regexp). |
| 240 |
|
| 241 |
For example, if you want to search "://ftp.debian.org/" and |
| 242 |
replace it with "://ftp.fr.debian.org/debian/", then you declare |
| 243 |
MIRROR_REGEXPS="s=://ftp.debian.org/=://ftp.fr.debian.org/debian/=" |
| 244 |
in '/etc/di-netboot-assistant/di-netboot-assistant.conf'. |
| 245 |
|
| 246 |
|
| 247 |
Architecture specific notes |
| 248 |
--------------------------- |
| 249 |
The notes in this section might not be up to date, as different Debian releases |
| 250 |
support different architectures and systematic testing of 'di-netboot-assistant' |
| 251 |
for exotic ones does not happen. Do not hesitate to get in contact with the |
| 252 |
maintainers if you would like to add additional support or further suggestions. |
| 253 |
|
| 254 |
• i386 / amd64 |
| 255 |
The Debian-Installer uses Syslinux's PXElinux[3] for BIOS |
| 256 |
platforms. Syslinux is a boot-loader that provide a menu system |
| 257 |
to select the kernel you want to boot. |
| 258 |
For systems with EFI, grub-efi and the grub menu system is used. |
| 259 |
Make sure you have the grub-efi-amd64-bin package installed for |
| 260 |
building the grub-efi netboot image. Secure boot is supported and |
| 261 |
available with 'grub-efi-amd64-signed' and 'shim-signed' installed. |
| 262 |
Run 'di-netboot-assistant rebuild-grub' to use the signed images. |
| 263 |
|
| 264 |
Absolute filenames in PXElinux: |
| 265 |
TFTP filenames inside PXElinux configuration files |
| 266 |
('pxelinux.HEAD', 'default', …) must be prefixed with '::/'. |
| 267 |
PXElinux then treats them as absolute filenames (starting from |
| 268 |
the root of the TFTP server). Paths starting with a slash ('/') |
| 269 |
are relative to the directory of 'pxelinux.0'. |
| 270 |
|
| 271 |
Configure DHCP: |
| 272 |
|
| 273 |
- In /etc/dhcp/dhcpd.conf (for isc-dhcp-server), configure the |
| 274 |
TFTP server's IP address: |
| 275 |
|
| 276 |
next-server 192.168.0.10; |
| 277 |
|
| 278 |
- Provide netboot/pxelinux information: |
| 279 |
|
| 280 |
filename "d-i/n-a/pxelinux.0"; |
| 281 |
|
| 282 |
and/or: |
| 283 |
|
| 284 |
filename "d-i/n-a/bootnetx64.efi"; |
| 285 |
|
| 286 |
for the grub EFI image. Consult the examples [2] on how to |
| 287 |
configure the DHCP server to send the correct file automatically. |
| 288 |
|
| 289 |
If you prefer to boot a specific installer, make it the default |
| 290 |
in the top level menu and automatically boot it (perhaps after |
| 291 |
some timeout). |
| 292 |
|
| 293 |
The architectures below are rarely tested and the information might |
| 294 |
be out of date. Help in providing support for them is highly |
| 295 |
appreciated. |
| 296 |
|
| 297 |
• iPXE |
| 298 |
A iPXE script is provided to chainload 'pxelinux.0' or |
| 299 |
'bootnetx64.efi'. Check the examples [2] on how to configure the |
| 300 |
DHCP server to send the boot.ipxe script to the client. |
| 301 |
|
| 302 |
• ia64 |
| 303 |
Support for ia64 was available in older versions of |
| 304 |
'di-netboot-assistant', but has been removed due to insufficient |
| 305 |
developer support. |
| 306 |
|
| 307 |
• alpha |
| 308 |
• hppa |
| 309 |
• sparc |
| 310 |
Those architectures netboot using BOOTP (some can use RARP or |
| 311 |
DHCP). They don't have a boot-loader that would present a menu at |
| 312 |
boot-time. This means that you must configure the DHCP server to |
| 313 |
provide one given kernel. (The DHCP server can of course provide |
| 314 |
different kernel images, based on the MAC and/or IP address). |
| 315 |
|
| 316 |
You can declare a kernel filename for all hosts in |
| 317 |
'/etc/dhcpd3/dhcpd.conf': |
| 318 |
|
| 319 |
subnet 192.168.0.0 netmask 255.255.255.0 { |
| 320 |
filename "d-i/n-a/stable/sparc/boot.img" |
| 321 |
} |
| 322 |
|
| 323 |
or declare a single host: |
| 324 |
|
| 325 |
host myhost1 { |
| 326 |
hardware ethernet 00:40:63:d8:02:2c; |
| 327 |
filename "d-i/n-a/stable/sparc/boot.img" |
| 328 |
} |
| 329 |
|
| 330 |
• arm, armel, armhf, arm64 |
| 331 |
Start u-boot, stop autoboot and enter at the prompt: |
| 332 |
=> dhcp |
| 333 |
=> pxe get |
| 334 |
=> pxe boot |
| 335 |
Then choose an entry from the installer boot menu. |
| 336 |
|
| 337 |
• mips,mipsel,mips64el |
| 338 |
Those architectures can do netbooting, but are not supported by |
| 339 |
this tool at the moment (because there is no '.tar.gz' archive). |
| 340 |
|
| 341 |
• m68k |
| 342 |
• ppc64el |
| 343 |
• s390, s390x |
| 344 |
|
| 345 |
|
| 346 |
See also |
| 347 |
-------- |
| 348 |
http://wiki.debian.org/DebianInstaller/NetbootAssistant |
| 349 |
http://www.debian.org/releases/stable/debian-installer/ |
| 350 |
|
| 351 |
-------------------------------------------------------------------------- |
| 352 |
[1] "Installation Guide", especially the sections |
| 353 |
"4.6 Preparing Files for TFTP Net Booting" |
| 354 |
and "5.1.5 Booting with TFTP" |
| 355 |
http://www.debian.org/releases/stable/installmanual |
| 356 |
|
| 357 |
[2] Sample DHCP configuration files: |
| 358 |
/usr/share/doc/di-netboot-assistant/examples/dnsmasq.conf.simple |
| 359 |
/usr/share/doc/di-netboot-assistant/examples/dnsmasq.conf.multiarch |
| 360 |
/usr/share/doc/di-netboot-assistant/examples/dhcpd.conf.simple |
| 361 |
/usr/share/doc/di-netboot-assistant/examples/dhcpd.conf.multiarch |
| 362 |
|
| 363 |
[3] PXElinux homepage. |
| 364 |
http://syslinux.zytor.com/wiki/index.php/PXELINUX |
| 365 |
|
| 366 |
[ ] Preboot Execution Environment (PXE) Specification |
| 367 |
http://www.intel.com/design/archives/wfm/downloads/pxespec.htm |
| 368 |
|
| 369 |
[ ] Extensible Firmware Interface (EFI) |
| 370 |
http://developer.intel.com/technology/efi/index.htm |
| 371 |
|
| 372 |
-- Franklin PIAT, Andreas B. Mundt |