Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Automated Anaconda Testing for bootc

Fully automated bootc Anaconda installation testing with:

  • Automated boot (1 second timeout, no media check)
  • Host container storage access via virtiofs (using podman unshare)
  • Real-time log streaming to host via virtio serial ports
  • SSH access for debugging during installation

Quick Start

# Download Anaconda ISO to ./anaconda.iso
# Customize example-kickstart.ks with your bootc image

# Run automated installation
./run-anaconda.sh

That's it! The script will:

  1. Auto-create anaconda-auto.iso (automated boot, no media check)
  2. Launch virtiofsd with podman unshare (no sudo needed)
  3. Boot VM and install automatically via kickstart
  4. Stream logs to anaconda-install.log and anaconda-program.log

Monitor Progress

Watch installation logs in real-time:

tail -f anaconda-program.log  # /tmp/program.log from installer
tail -f anaconda-install.log  # Anaconda's built-in logging

Or SSH into the installer:

ssh -p 10022 root@localhost  # Password: testcase
journalctl -f                 # Watch system logs
tail -f /tmp/program.log      # Watch installation progress

Files

  • run-anaconda.sh - Main script: Automated installation with logging
  • prepare-automated-iso.sh - Create automated boot ISO (used by run-anaconda.sh)
  • example-kickstart.ks - Kickstart template with virtiofs + storage.conf
  • enable-anaconda-debug.sh - Add inst.debug for verbose logging
  • update-iso-kickstart.sh - Manual kickstart injection utility

How It Works

1. Automated Boot ISO

prepare-automated-iso.sh modifies the base ISO:

  • Sets 1 second boot timeout (immediate start)
  • Removes rd.live.check (skips media check)
  • Removes quiet (shows boot messages)
  • Keeps inst.sshd and inst.ks for automation

2. Virtiofs Container Storage (No Sudo!)

Uses podman unshare to run virtiofsd in user namespace:

podman unshare virtiofsd \
  --socket-path ./virtiofs-hoststorage.sock \
  --shared-dir ~/.local/share/containers/storage \
  --translate-uid "host:0:0:1" \
  --translate-gid "host:0:0:1" \
  --modcaps=+dac_read_search

Why podman unshare:

  • No sudo required
  • Runs in same namespace as podman containers
  • Automatic permission mapping
  • Access to restrictive ostree repository files

In the VM:

  • Mounted at /run/virtiofs-mnt-hoststorage/
  • Configured as additionalimagestore in /etc/containers/storage.conf
  • Bootc can pull from containers-storage:localhost/image using host layers

3. Real-Time Log Streaming

Two virtio serial ports stream logs to host:

anaconda-install.log - Anaconda's built-in logging via virtio

  • Configured by Anaconda when it detects /dev/virtio-ports/org.fedoraproject.anaconda.log.0

anaconda-program.log - /tmp/program.log via systemd unit

  • Injected via SMBIOS credentials (systemd.extra-unit)
  • Runs in initramfs, streams with tail -f
  • Shows bootc installation progress

4. Kickstart Configuration

The example-kickstart.ks %pre section:

# 10GB tmpfs for fast container operations
mkdir -p /var/lib/containers
mount -t tmpfs -o size=10485760k tmpfs /var/lib/containers

# Mount host container storage
mkdir -p /run/virtiofs-mnt-hoststorage
mount -t virtiofs hoststorage /run/virtiofs-mnt-hoststorage

# Configure storage.conf for additionalimagestore
cat > /etc/containers/storage.conf << 'EOF'
[storage]
driver = "overlay"

[storage.options]
additionalimagestores = [
  "/run/virtiofs-mnt-hoststorage"
]
EOF

Then bootc installs from: containers-storage:localhost/bootc

Customization

Use Your Own bootc Image

Edit example-kickstart.ks line 31:

bootc --source-imgref=containers-storage:localhost/myimage --stateroot=default

Then build your image locally so it's in ~/.local/share/containers/storage.

Custom Kickstart

Simply edit example-kickstart.ks - the ISO is regenerated on every run.

For a different kickstart file, modify prepare-automated-iso.sh:

# Change line 10 in prepare-automated-iso.sh:
KICKSTART="${SCRIPT_DIR}/my-custom.ks"

Adjust Tmpfs Size

In kickstart %pre section, change size parameter:

mount -t tmpfs -o size=5242880k tmpfs /var/lib/containers  # 5GB instead of 10GB

Troubleshooting

No logs appearing

Check if systemd unit is running:

ssh -p 10022 root@localhost
systemctl status anaconda-program-log.service
ls -la /dev/virtio-ports/

Permission errors with virtiofs

The podman unshare + --modcaps=+dac_read_search approach should handle this. Verify virtiofsd started:

ps aux | grep virtiofsd
ls -la virtiofs-hoststorage.sock

Installation fails

SSH in and check:

ssh -p 10022 root@localhost
journalctl -u bootc-install     # Bootc service logs
cat /tmp/program.log            # Installation progress
ls -la /run/virtiofs-mnt-hoststorage/  # Verify host storage access
podman images --storage-driver overlay --storage-opt additionalimagestore=/run/virtiofs-mnt-hoststorage

virtiofsd not found

sudo dnf install virtiofsd

Advanced: Manual ISO Inspection

Extract kickstart from ISO:

isoinfo -i anaconda.iso -x /KICKSTART.KS\;1 > current.ks

List ISO contents:

osirrox -indev anaconda.iso -find / 2>/dev/null | less

Architecture Notes

Virtiofs Setup

  • memory-backend-memfd with share=on (required for virtiofs)
  • --cache never prevents fd exhaustion
  • --sandbox none for container compatibility
  • Queue size: 1024

Systemd Credential Injection

  • Uses io.systemd.credential.binary:systemd.extra-unit.* via SMBIOS
  • Unit runs in initramfs (no ConditionPathExists=!/etc/initrd-release)
  • Streams logs continuously during installation

Why podman unshare Works

  • Runs virtiofsd in the user namespace where you appear as root
  • Same namespace as rootless podman containers
  • Can read ostree objects with ---s--x--x permissions via DAC_READ_SEARCH capability
  • No actual root privileges required

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages