Running Fedora CoreOS nightly ISO and qcow2 images in libvirt

Fedora CoreOS logo

Fedora CoreOS (FCOS) is the upcoming OS which contains best of both Fedora Atomic Host and Container Linux. There is no official release yet but we do have nightly images available to try. There are various image artifacts being produced but in this blog we will focus installing and running ISO and qcow2.

Download latest nightly image

FCOS nightly images are built using Jenkins pipleine in CentOS CI . Download latest ISO or qcow2 nightly image which you like.

While writing this blog latest nightly ISO image name is fedora-coreos-30.113-installer.iso and qcow2 image name is fedora-coreos-30.113-installer.iso . I will be using these names in this blog but when you try replace it with the media name which you downloaded.

Ignition Config

Similar to Container Linux, FCOS also requires ignition config to perform initial configuration during first boot. We will create fcos.ign ignition config file which defines to create a user test with password test, authorized ssh key and adding user test to wheel group to provide sudo access.

$ cat fcos.ign
{
  "ignition": {
     "version": "3.0.0"
  },

  "passwd": {
    "users": [
      {
        "name": "test",
        "passwordHash": "$y$j9T$dahelkQ2GUy2EfzW4Qu/m/$eApizQ.vHFyGJRel.1wNbKd8PLZ5soT0vBiIp4ieBM1",
        "sshAuthorizedKeys": [
          "ssh-rsa your_public_ssh_key"
        ],
        "groups": [ "wheel" ]
      }
    ]
  }
}

 

passwordHash was created using mkpasswd . Add you public ssh key(s) which you want to add in sshAuthorizedKeys.

Running qcow2 image

qcow2 image which we download is in compressed form, let’s first extract it

gunzip fedora-coreos-30.113-qemu.qcow2.gz

This will give us qcow2 image fedora-coreos-30.113-qemu.qcow2.

qemu-system-x86_64 -accel kvm -name fcos-qcow -m 2048 -cpu host -smp 2 -nographic -netdev user,id=eth0,hostname=coreos -device virtio-net-pci,netdev=eth0 -drive file=/path/to/fedora-coreos-30.113-qemu.qcow2 -fw_cfg name=opt/com.coreos/config,file=/path/to/fcos.ign

On login prompt, enter test as user name and  test as  password as we added in the ignition config and you should be inside a FCOS system!

Installing and Running ISO image

ISO image fedora-coreos-30.113-installer.iso contains initramfs.img and vmlinuz to boot the kernel. We will also need fedora-coreos-30.113-metal-bios.raw.gz or fedora-coreos-30.113-metal-bios.raw.gz from latest nightly repo depending upon what kind of installation you want. For our example, we will download fedora-coreos-30.113-metal-bios.raw.gz image. Installer will need metal-bios image and ignition config during the install process which we will pass as kernel command args. Let’s host fedora-coreos-30.113-metal-bios.raw.gz and fcos.ign files locally.

We can use either virt-install or qemu directly:

With virt-install

virt-install --name fcos-iso --ram 4500 --vcpus 2 --disk pool=vm,size=10 --accelerate --cdrom /path/to/fedora-coreos-30.107-installer.iso --network default

With qemu:

First, create a disk image for installation  –

qemu-img create -f qcow2 fcos.qcow2 10G

Now, run –

qemu-system-x86_64 -accel kvm -name fcos-iso -m 2048 -cpu host -smp 2 -netdev user,id=eth0,hostname=coreos -device virtio-net-pci,netdev=eth0 -drive file=/path/to/fcos.qcow2,format=qcow2 -cdrom /path/to/fedora-coreos-30.113-installer.iso

 

When ISO boots, in grub menu use <TAB> to add additional args in kernel command  line . They are coreos.inst.install_dev (installation device),  coreos.inst.image_url (installer image url) and coreos.inst.ignition_url (ignition config url). It looks something like below:

fcos

Once, additional parameter is added press <ENTER> to continue the installation. Once installation completes successfully and vm reboots, it will prompt for user login which will be same as we mentioned in running qcow section.

Additional update information along with instruction for PXE boot is available in coreos-installer README

Conclusion

To remain one step ahead, you can also run latest FCOS directly from coreos-assembler whose instruction is available in its README .

FCOS is in devlopment state and new features are getting added everyday to make it better. Give a try and get a feel of how early FCOS looks like!

 

Advertisements

2 thoughts on “Running Fedora CoreOS nightly ISO and qcow2 images in libvirt

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s