8. Network Booting with Cobbler

Cobbler controls the PXE network boot of each system. When a system is added, it will generate the necessary TFTP and PXELINUX configuration files during the next cobbler sync. By default, netbooting is enabled. You can verify this by looking at the output of cobbler system report.

[root@master ~]# cobbler system report --name=c01 | grep Netboot
Netboot Enabled                : True

Each system has two interfaces, one for the management network (IPMI) and the cluster network (for SSH access). The cluster network (hpc domain) will be used for provisioning.

Cobbler generates the necessary PXELINUX configuration file using the MAC address of each interface. In our example, the file we’re interested in for c01 is /var/lib/tftpboot/pxelinux.cfg/01-f0-4d-a2-06-80-71. It has the following contents:

default linux
prompt 0
timeout 1
label linux
        kernel /images/centos7-x86_64/vmlinuz
        ipappend 2
        append initrd=/images/centos7-x86_64/initrd.img ksdevice=bootif lang=  kssendmac text  ks=http://192.168.16.1/cblr/svc/op/ks/system/c01

While the kernel options are slightly different to what we used in exercise 2, the general idea is still the same. Boot into a Linux kernel, use this initrd.img file and launch the following kickstart file served using HTTP.

Because remote management becomes easier with Serial Console enabled, we want to add some kernel options to these generated files. You can do this at different levels.

You either specify kernel options for each system you add. Or you can specify them for an entire group using a profile. Let’s do the profile version first. There are two types of kernel options you can specify.

  • Kernel Options during Installation

  • Kernel Options after Installation (Post)

All our systems right now use the centos7-x86_64 profile. If you look at the report, you will see both types of kernel options are empty.

[root@master ~]# cobbler profile report --name=centos7-x86_64
Name                           : centos7-x86_64
...
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
...

Add our serial console options as follows:

[root@master ~]# cobbler profile edit --name=centos7-x86_64 --kopts="console=tty0 console=ttyS1,115200n8" --kopts-post="console=tty0 console=ttyS1,115200n8"

And verify the change:

[root@master ~]# cobbler profile report --name=centos7-x86_64
Name                           : centos7-x86_64
...
Kernel Options                 : {'console': ['tty0', 'ttyS1,115200n8']}
Kernel Options (Post Install)  : {'console': ['tty0', 'ttyS1,115200n8']}
...

Changes like this will not propagate automatically since it affects multiple machines. You will need to run cobbler sync to see a change in the PXELINUX files.

default linux
prompt 0
timeout 1
label linux
        kernel /images/centos7-x86_64/vmlinuz
        ipappend 2
        append initrd=/images/centos7-x86_64/initrd.img ksdevice=bootif lang=  console=tty0 console=ttyS1,115200n8 kssendmac text  ks=http://192.168.16.1/cblr/svc/op/ks/system/c01

As you can see, each system that uses the centos7-x86_64 profile inherits these kernel options. You can also add more kernel options for each individual system by using cobbler system edit.

# this will let you boot into a rescue mode instead of the installation
# this is an example, NOT a mandatory step!
[root@master ~]# cobbler system edit --name=c01 --kopts=inst.rescue

These changes are instantly reflected in the PXELINUX files:

default linux
prompt 0
timeout 1
label linux
        kernel /images/centos7-x86_64/vmlinuz
        ipappend 2
        append initrd=/images/centos7-x86_64/initrd.img ksdevice=bootif lang=  console=tty0 console=ttyS1,115200n8 inst.rescue text kssendmac  ks=http://192.168.16.1/cblr/svc/op/ks/system/c01

Warning

Do not add the inst.rescue option if you don’t need it! This will prevent your installation to proceed.

This is a case where cobbler does a soft sync. This only happens when a single system is affected by a change. You do not need to run cobbler sync in these cases.

8.1. Controlling network boot

Controlling network boot itself is a soft synced action.

Try doing this now manually by editing the system:

[root@master ~]# cobbler system edit --name=c01 --netboot=0

You can verify this change by looking at the system report:

[root@master ~]# cobbler system report --name=c01 | grep Netboot
Netboot Enabled                : False

If you take a look at the PXELINUX file, you will now see that it has changed:

DEFAULT local
PROMPT 0
TIMEOUT 0
TOTALTIMEOUT 0
ONTIMEOUT local

LABEL local
        LOCALBOOT -1

What this means is that if Netboot is disabled, PXELINUX will boot from local disk. So whatever the installation has left on the system will boot next.

Another way to see this is, if anything goes wrong on a system, or let’s say you have to replace the hard drive, all you have to do is set Netboot to True and cobbler will reinstall the system at the next boot. We call this reprovisioning or reimaging.

Cobbler can also be configured so that installations automatically disable network booting after completion. It then changes Netboot to False before reboot. Edit /etc/cobbler/settings and enable pxe_just_once.

pxe_just_once: 1

Warning

Everytime you change the cobbler settings file you need to restart the cobblerd daemon!

The following summarizes the cobbler installation process we’ve now set up.

Cobbler Installation Process

Cobbler Installation Process