Add essential initramfs integration for composefs support
Some checks failed
Test bootc Documentation / test-base-image (push) Failing after 24s
Test bootc Documentation / test-documentation (push) Failing after 30s

- Add initramfs integration files based on debian-bootc project
- Include bootc-initramfs-setup.service for systemd integration
- Add dracut module-setup.sh for initramfs generation
- Include prepare-root.conf for OSTree composefs configuration
- Update Containerfile examples to include initramfs files
- Fix systemctl calls to use symlinks instead of systemctl commands
- Add comprehensive initramfs-integration.md documentation
- Update README to reference new initramfs documentation

Based on files from https://github.com/bootcrew/debian-bootc:
- bootc-initramfs-setup.service
- module-setup.sh
- prepare-root.conf

These files are essential for proper composefs support and boot
functionality in Debian bootc images.
This commit is contained in:
robojerk 2025-09-15 14:48:24 -07:00
parent bd4c3e746f
commit d204c35734
4 changed files with 333 additions and 4 deletions

View file

@ -971,6 +971,86 @@ rm -rf "${TEMP_DIR}"
echo "✅ Installation completed with systemd-nspawn!"
```
## Essential Initramfs Integration
For proper composefs support and boot functionality, you need to include initramfs integration files in your base image. These files are essential for Debian bootc images:
### Required Files
**1. `bootc-initramfs-setup.service`** - Systemd service for initramfs:
```ini
# Copyright (C) 2013 Colin Walters <walters@verbum.org>
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
[Unit]
DefaultDependencies=no
ConditionKernelCommandLine=composefs
ConditionPathExists=/etc/initrd-release
After=sysroot.mount
Requires=sysroot.mount
Before=initrd-root-fs.target
Before=initrd-switch-root.target
OnFailure=emergency.target
OnFailureJobMode=isolate
[Service]
Type=oneshot
ExecStart=/usr/bin/bootc-initramfs-setup
StandardInput=null
StandardOutput=journal
StandardError=journal+console
RemainAfterExit=yes
```
**2. `module-setup.sh`** - Dracut module for initramfs:
```bash
#!/usr/bin/bash
check() {
return 0
}
depends() {
return 0
}
install() {
inst \
"${moddir}/bootc-initramfs-setup" /bin/bootc-initramfs-setup
inst \
"${moddir}/bootc-initramfs-setup.service" \
"${systemdsystemunitdir}/bootc-initramfs-setup.service"
$SYSTEMCTL -q --root "${initdir}" add-wants \
'initrd-root-fs.target' 'bootc-initramfs-setup.service'
}
```
**3. `prepare-root.conf`** - Composefs configuration:
```ini
[composefs]
enabled = yes
[sysroot]
readonly = true
```
### Integration in Containerfile
Add these files to your base image:
```dockerfile
# Copy initramfs integration files
COPY files/37composefs/bootc-initramfs-setup.service /usr/lib/systemd/system/
COPY files/37composefs/module-setup.sh /usr/lib/dracut/modules.d/37composefs/
COPY files/ostree/prepare-root.conf /usr/lib/ostree-boot/prepare-root.conf
# Enable the service
RUN ln -sf /usr/lib/systemd/system/bootc-initramfs-setup.service \
/etc/systemd/system/multi-user.target.wants/bootc-initramfs-setup.service
```
## Adding Application Layers (Example: nginx)
### Method 1: Building on Base Image