|
| 1 | +# Anaconda Installer Container for bcvk |
| 2 | + |
| 3 | +This container provides the anaconda installer for installing bootc container |
| 4 | +images using kickstart files. It boots into `anaconda.target` and uses the |
| 5 | +upstream anaconda systemd services. |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +The container is based on `quay.io/fedora/fedora-bootc:42` with anaconda-tui |
| 10 | +installed. It boots directly into `anaconda.target` and uses the upstream |
| 11 | +`anaconda-direct.service` with a bcvk setup service that runs beforehand. |
| 12 | + |
| 13 | +## Building |
| 14 | + |
| 15 | +```bash |
| 16 | +cd containers/anaconda-bootc |
| 17 | +podman build -t localhost/anaconda-bootc:latest . |
| 18 | +``` |
| 19 | + |
| 20 | +## How It Works |
| 21 | + |
| 22 | +1. bcvk creates a target disk and generates a kickstart file |
| 23 | +2. bcvk starts the VM with: |
| 24 | + - Host container storage mounted read-only via virtiofs |
| 25 | + - Kickstart file mounted via virtiofs at `/run/virtiofs-mnt-kickstart/` |
| 26 | + - Target disk attached via virtio-blk |
| 27 | + - Kernel args: `inst.notmux inst.ks=file:///run/virtiofs-mnt-kickstart/anaconda.ks` |
| 28 | +3. The VM boots into `anaconda.target` |
| 29 | +4. `bcvk-anaconda-setup.service` runs first to: |
| 30 | + - Mount virtiofs shares for container storage and kickstart |
| 31 | + - Configure `/etc/containers/storage.conf` with additionalImageStores |
| 32 | +5. Upstream `anaconda-direct.service` runs anaconda (triggered by `inst.notmux`) |
| 33 | +6. Kickstart `poweroff` directive powers off the VM after anaconda completes |
| 34 | + |
| 35 | +## Integration with Upstream Anaconda |
| 36 | + |
| 37 | +This container leverages upstream anaconda systemd infrastructure: |
| 38 | + |
| 39 | +| Component | Source | Purpose | |
| 40 | +|-----------|--------|---------| |
| 41 | +| `anaconda.target` | Upstream | Default boot target for installation | |
| 42 | +| `anaconda-direct.service` | Upstream | Runs anaconda without tmux | |
| 43 | +| `bcvk-anaconda-setup.service` | bcvk | Sets up virtiofs mounts before anaconda (conditional on `bcvk.anaconda` kernel arg) | |
| 44 | + |
| 45 | +## Kickstart Requirements |
| 46 | + |
| 47 | +The user provides a kickstart with partitioning and locale settings. |
| 48 | +bcvk injects: |
| 49 | +- `ostreecontainer --transport=containers-storage --url=<image>` |
| 50 | +- `%post` script to repoint bootc origin to the registry (unless `--no-repoint`) |
| 51 | + |
| 52 | +**Important**: The target disk is available at `/dev/disk/by-id/virtio-output`. |
| 53 | +bcvk also attaches a swap disk, so use `ignoredisk` to target the correct disk. |
| 54 | + |
| 55 | +Example kickstart for BIOS boot: |
| 56 | +```kickstart |
| 57 | +text |
| 58 | +lang en_US.UTF-8 |
| 59 | +keyboard us |
| 60 | +timezone UTC --utc |
| 61 | +network --bootproto=dhcp --activate |
| 62 | +
|
| 63 | +# Target only the output disk |
| 64 | +ignoredisk --only-use=/dev/disk/by-id/virtio-output |
| 65 | +
|
| 66 | +zerombr |
| 67 | +clearpart --all --initlabel |
| 68 | +
|
| 69 | +# Create required boot partitions (biosboot + /boot) |
| 70 | +reqpart --add-boot |
| 71 | +part / --fstype=xfs --grow |
| 72 | +
|
| 73 | +rootpw --lock |
| 74 | +poweroff |
| 75 | +``` |
| 76 | + |
| 77 | +## Installed Packages |
| 78 | + |
| 79 | +See `packages.txt` for the full list. Key packages: |
| 80 | +- **anaconda-tui**: Text-mode anaconda installer |
| 81 | +- **pykickstart**: Kickstart file processing |
| 82 | +- **Disk tools**: parted, gdisk, lvm2, cryptsetup |
| 83 | +- **Filesystem tools**: e2fsprogs, xfsprogs, btrfs-progs |
| 84 | +- **Container tools**: skopeo (bootc is in base image) |
| 85 | + |
| 86 | +## Debugging |
| 87 | + |
| 88 | +If installation fails, check the VM console output or journal: |
| 89 | +```bash |
| 90 | +# Run with console output |
| 91 | +bcvk anaconda install --console ... |
| 92 | + |
| 93 | +# Inside VM, check logs |
| 94 | +journalctl -u bcvk-anaconda-setup |
| 95 | +journalctl -u anaconda-direct |
| 96 | +cat /tmp/anaconda.log |
| 97 | +``` |
0 commit comments