Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs/cosa/run: Add PXE with Shim and UEFI Secure Boot example #3806

Merged
merged 1 commit into from
May 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions docs/cosa/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,52 @@ And point to it and the `core.0` binary:
```
$ cosa run -c --netboot-dir tmp/grub-netboot --netboot boot/grub2/i386-pc/core.0 -m 4096
```

### GRUB (Secure Boot)

1. Create a temporary folder
2. Download a kernel, initramfs, rootfs, shim and GRUB binary
3. Create an empty disk image (bug in kola): `touch disk.img`
4. Setup `grub.cfg`
5. Place your Ignition config
6. Start a local HTTP server using `cosa kola http-server`
7. Find and join the existing COSA container
8. Use `cosa run` to netboot the system

```
$ tree pxe
pxe
├── config.ign
├── disk.img
├── grub.cfg
├── grubx64.efi
├── rhcos-4.14.0-x86_64-live-initramfs.x86_64.img
├── rhcos-4.14.0-x86_64-live-kernel-x86_64
├── rhcos-4.14.0-x86_64-live-rootfs.x86_64.img
└── shim.efi

$ cat pxe/grub.cfg
default=0
timeout=1
menuentry "CoreOS (UEFI Secure Boot)" {
echo "Loading kernel"
linux /rhcos-4.14.0-x86_64-live-kernel-x86_64 ignition.firstboot ignition.platform.id=metal console=ttyS0 coreos.live.rootfs_url=http://10.0.2.2:8000/pxe/rhcos-4.14.0-x86_64-live-rootfs.x86_64.img ignition.config.url=http://10.0.2.2:8000/pxe/config.ign
echo "Loading initrd"
initrd rhcos-4.14.0-x86_64-live-initramfs.x86_64.img rhcos-4.14.0-x86_64-live-rootfs.x86_64.img
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should only list the initramfs here now that we're serving the rootfs over HTTP.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good point. I'll make a followup

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

$ cosa kola http-server
...
Serving HTTP on port: 8000

# In another shell
$ podman exec -it cosa bash

# Or if you removed `--name cosa` from the cosa alias command to be able to run
# multiple instances of cosa (see https://coreos.github.io/coreos-assembler/building-fcos/#running-multiple-instances)
$ podman ps | grep quay.io/coreos-assembler/coreos-assembler
7fedc84484a6 quay.io/coreos-assembler/coreos-assembler:latest kola http-server 5 minutes ago Up 5 minutes hopeful_haibt
$ podman exec -ti 7fedc84484a6 bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI there is podman exec -l to target the last created container :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds like a good idea but I'm not fully aware of the semantics thus not confident in replacing those "manual" instructions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will have to give it a try.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah 100%. Your instructions are safer here. I learned about it recently so I thought I'd share the tip


$ cosa run -c --netboot pxe/shim.efi -m 4096 --qemu-firmware uefi-secure --qemu-image pxe/disk.img
```
Loading