mirror of
https://github.com/outbackdingo/matchbox.git
synced 2026-01-27 10:19:35 +00:00
In virt-install v1.4.2, the meaning of `--pxe` changed from "allow pxe boot" to "always pxe boot." This breaks matchbox, since we expect hosts to pxe-boot only with empty hds. On hosts with v1.4.2, the VMs loop, re-installing CL over and over. The flag isn't necessary anyways, since we pass `--boot=hd,network`, which enables pxe-booting.
2.5 KiB
2.5 KiB
GRUB2 netboot
Use GRUB to network boot UEFI hardware.
Requirements
For local development, install the dependencies for libvirt with UEFI.
Ensure that you've gone through the matchbox with rkt and matchbox guides and understand the basics.
Containers
Run matchbox with rkt, but mount the grub group example.
Network
On Fedora, add the metal0 interface to the trusted zone in your firewall configuration.
$ sudo firewall-cmd --add-interface=metal0 --zone=trusted
Run the quay.io/coreos/dnsmasq container image with rkt or docker.
sudo rkt run --net=metal0:IP=172.18.0.3 quay.io/coreos/dnsmasq \
--caps-retain=CAP_NET_ADMIN,CAP_NET_BIND_SERVICE,CAP_SETGID,CAP_SETUID,CAP_NET_RAW \
-- -d -q \
--dhcp-range=172.18.0.50,172.18.0.99 \
--enable-tftp \
--tftp-root=/var/lib/tftpboot \
--dhcp-match=set:efi-bc,option:client-arch,7 \
--dhcp-boot=tag:efi-bc,grub.efi \
--dhcp-userclass=set:grub,GRUB2 \
--dhcp-boot=tag:grub,"(http;matchbox.example.com:8080)/grub","172.18.0.2" \
--log-queries \
--log-dhcp \
--dhcp-userclass=set:ipxe,iPXE \
--dhcp-boot=tag:pxe,undionly.kpxe \
--dhcp-boot=tag:ipxe,http://matchbox.example.com:8080/boot.ipxe \
--address=/matchbox.foo/172.18.0.2
Client VM
Create UEFI VM nodes which have known hardware attributes.
$ sudo ./scripts/libvirt create-uefi
Docker
If you use Docker, run matchbox according to matchbox with Docker, but mount the grub group example. Then start the coreos/dnsmasq Docker image, which bundles a grub.efi.
$ sudo docker run --rm --cap-add=NET_ADMIN quay.io/coreos/dnsmasq -d -q --dhcp-range=172.17.0.43,172.17.0.99 --enable-tftp --tftp-root=/var/lib/tftpboot --dhcp-match=set:efi-bc,option:client-arch,7 --dhcp-boot=tag:efi-bc,grub.efi --dhcp-userclass=set:grub,GRUB2 --dhcp-boot=tag:grub,"(http;matchbox.foo:8080)/grub","172.17.0.2" --log-queries --log-dhcp --dhcp-option=3,172.17.0.1 --dhcp-userclass=set:ipxe,iPXE --dhcp-boot=tag:pxe,undionly.kpxe --dhcp-boot=tag:ipxe,http://matchbox.foo:8080/boot.ipxe --address=/matchbox.foo/172.17.0.2
Create a VM to verify the machine network boots.
$ sudo virt-install --name uefi-test --boot=uefi,network --disk pool=default,size=4 --network=bridge=docker0,model=e1000 --memory=1024 --vcpus=1 --os-type=linux --noautoconsole