1a1245a2d8
Address comments on the last sr. Not tested yet OBS-URL: https://build.opensuse.org/request/show/822128 OBS-URL: https://build.opensuse.org/package/show/devel:kubic:ignition/combustion?expand=0&rev=1
66 lines
2.5 KiB
Plaintext
66 lines
2.5 KiB
Plaintext
Combustion - configure MicroOS on the first boot
|
|
================================================
|
|
|
|
Combustion is a minimal module for dracut, which runs a user provided script on
|
|
the first boot of a system.
|
|
|
|
You can use this to create additional files, install packages, set up devices
|
|
or even re-partition the hard disk. The configuration can be provided as a
|
|
shell script, loaded from an external storage media and is run during boot in a
|
|
new system snapshot. On success, the system will directly boot into that new
|
|
snapshot, so that no reboot is needed.
|
|
|
|
How to use it
|
|
-------------
|
|
|
|
To be compatible and co-installable with ignition
|
|
(https://github.com/coreos/ignition), the configuration files are copied from
|
|
a filesystem with the LABEL "ignition".
|
|
It expects a directory "combustion" at the root level of the filesystem and
|
|
a file "script" inside, which is executed inside a transactional-update shell.
|
|
|
|
Example for formatting a USB drive and adding a config, which installs the
|
|
"vim-small" package and creates a /root/welcome file:
|
|
|
|
```
|
|
mkfs.ext4 /dev/sdX
|
|
e2label /dev/sdX ignition
|
|
mount /dev/sdX /mnt
|
|
mkdir -p /mnt/combustion/
|
|
cat >/mnt/combustion/script <<EOF
|
|
#!/bin/sh
|
|
systemctl enable sshd.service
|
|
zypper --non-interactive install vim-small
|
|
cp welcome /root/welcome
|
|
EOF
|
|
echo "Hello User!" >/mnt/combustion/welcome
|
|
umount /mnt
|
|
```
|
|
|
|
You can do everything necessary for initial system configuration from this
|
|
script, including addition of ssh keys, adding users, changing passwords
|
|
or even doing partitioning changes.
|
|
|
|
How it works
|
|
------------
|
|
|
|
The ignition-dracut-grub2 package created a flag file which tells GRUB 2 that
|
|
it's the first boot of the system and so GRUB adds "ignition.firstboot" to the
|
|
kernel commandline.
|
|
|
|
If this option is found on the kernel cmdline, combustion.service's
|
|
ConditionKernelCommandLine is fulfilled and it'll be required by initrd.target.
|
|
It is started after /sysroot is mounted and network is up (if enabled). This
|
|
service tries to activate all mountpoints in the system's /etc/fstab and then
|
|
calls transactional-update chrooted.
|
|
|
|
In this transactional-update session the script is started and the exit code
|
|
recorded. If the script failed, transactional-update rollback is called and
|
|
combustion.service marked as failed.
|
|
|
|
/sysroot is unmounted and mounted again, so that the default subvolume gets
|
|
reevaluated and directly booted into.
|
|
|
|
The ignition-firstboot-complete service in the final system runs, which deletes
|
|
the flag file. This means that combustion is not run on subsequent boots.
|