English Italian
# Setup the correct SELinux label to allow access to the config
chcon --verbose --type svirt_home_t autologin.ign
The `virt-install` command will start an instance named `fcos` from the `fedora-coreos.qcow2` image using the `autologin.ign` Ignition config. It will auto-attach the serial console of the machine so you will be able to see the image bootup messages.
And check on `zincati.service`, which communicates with our update server and tells `rpm-ostree` when to do an update and to what version to update to:
[core@tutorial ~]$ systemctl status --full zincati.service
● zincati.service - Zincati Update Agent
Loaded: loaded (/usr/lib/systemd/system/zincati.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-08-06 14:50:36 UTC; 1h 41min ago
Docs: https://github.com/coreos/zincati
Main PID: 889 (zincati)
Tasks: 2 (limit: 2288)
Memory: 14.2M
CGroup: /system.slice/zincati.service
└─889 /usr/libexec/zincati agent -v
[core@tutorial ~]$ journalctl -t ignition
...
And finally, of course we can use the `podman` (or `docker`) command to inspect the current state of containers on the system:
# Start a Fedora CoreOS virtual machine
virt-install --name=fcos --vcpus=2 --ram=2048 --os-variant=fedora-coreos-stable \
--import --network=bridge=virbr0 --graphics=none \
--qemu-commandline="-fw_cfg name=opt/com.coreos/config,file=${PWD}/autologin.ign" \
--disk=size=20,backing_store=${PWD}/fedora-coreos.qcow2
Depending on your version of `virt-install`, you may not be able to use `--os-variant=fedora-coreos-stable` and will get an error. In this case, you should pick an older Fedora variant (`--os-variant=fedora31` for example). You can find the variants that are supported by you current version of `virt-install` with `osinfo-query os | grep '^\s*fedora'`.
Ignition config files are written in JSON but are typically not user friendly. Configurations are thus written in a simpler format, the Butane config, that is then converted into an Ignition config. The tool responsible for converting Butane configs into Ignition configs is naturally called Butane.
First Ignition config via Butane
Let's create a very simple Butane config that will perform the following actions:
We can create a config file named `autologin.bu` now as:
This configuration can then be converted into an Ignition config with Butane:
$ butane --pretty --strict autologin.bu --output autologin.ign
The resulting Ignition configuration produced by Butane as `autologin.ign` has the following content:
Butane outputs valid Ignition configs. However, if you are tweaking the config after Butane, or manually creating Ignition configs, you will have to verify that the config format is valid with `ignition-validate`:
variant: fcos
version: 1.4.0
systemd:
units:
- name: serial-getty@ttyS0.service
dropins:
- name: autologin-core.conf
contents: |
[Service]
# Override Execstart in main unit
ExecStart=
# Add new Execstart with `-` prefix to ignore failure`
ExecStart=-/usr/sbin/agetty --autologin core --noclear %I $TERM
storage:
files:
- path: /etc/hostname
mode: 0644
contents:
inline: |
tutorial
- path: /etc/profile.d/systemd-pager.sh
mode: 0644
contents:
inline: |
# Tell systemd to not use a pager when printing information
export SYSTEMD_PAGER=cat
- path: /etc/sysctl.d/20-silence-audit.conf
mode: 0644
contents:
inline: |
# Raise console message logging level from DEBUG (7) to WARNING (4)
# to hide audit messages from the interactive console
kernel.printk=4