Install fcos on KVM - LVM

Sorry I have read many different ways of installing coreos on KVM, but I can’t decide which is more correct.
I have KVM on a large server all virtual machines are on the LVM partition.
So which image is better to use ? Maybe just take raw and do dd if=raw of=/dev/vg1/lvm1 ?
or iso ?

Use the qemu image.

If you have libvirt you can follow Provisioning Fedora CoreOS on libvirt.

If you don’t have libvirt you can just use plain QEMU commands: Provisioning Fedora CoreOS on QEMU.

I’m sorry, I must be translating it wrong.
I read this documentation, all my virtual machines use LVM as drives. And I want to do the same with FCOS. I don’t need the extra burden of a file drive.

env LANG=C ./fcos-install-iso.sh
ERROR Only one install method can be used (–location URL, --cdrom CD/ISO, --pxe, --import, --boot hd|cdrom|…)
./fcos-install-iso.sh: line 15: --qemu-commandline=-fw_cfg name=opt/com.coreos/config,file=/var/lib/libvirt/images/ignition/fcos-test-01.ign: No such file or directory

ls /var/lib/libvirt/images/ignition/fcos-test-01.ign
/var/lib/libvirt/images/ignition/fcos-test-01.ign

#!/bin/sh

IGNITION_CONFIG="/var/lib/libvirt/images/ignition/fcos-test-01.ign"
IMAGE="/var/lib/libvirt/images/fedora-coreos-33.20201201.3.0-live.x86_64.iso"
VM_NAME=“fcos-test-01”
VCPUS=“2”
RAM_MB=“2048”
OS_VARIANT=“fedora 32” #(osinfo-query os | grep “fedora[2-3][0-9]”)

virt-install --name="{VM_NAME}" \ --vcpus="{VCPUS}" --memory="{RAM_MB}" --network=bridge=br1 \ --os-variant="fedora32" --import --graphics="none" \ --disk="path=/dev/vg2/fcos-test" \ --cdrom="{IMAGE}"
–qemu-commandline="-fw_cfg name=opt/com.coreos/config,file=${IGNITION_CONFIG}"

I tried installing coreos according to the classic recommendation and nothing worked either.

process exited while connecting to monitor: qemu-kvm: -fw_cfg: invalid option

/usr/libexec/qemu-kvm -version
QEMU emulator version 1.5.3 (qemu-kvm-1.5.3-175.el7_9.1), Copyright © 2003-2008 Fabrice Bellard

cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)

Install ERROR:
Displaying logs from failed units: ●

Invalid unit name “●” escaped as “\xe2\x97\x8f” (maybe you should use systemd-escape?).
– Logs begin at Wed 2020-12-30 07:31:51 UTC, end at Wed 2020-12-30 07:31:52 UTC. –
– No entries –
Invalid unit name “●” escaped as “\xe2\x97\x8f” (maybe you should use systemd-escape?).
– Logs begin at Wed 2020-12-30 07:31:51 UTC, end at Wed 2020-12-30 07:31:52 UTC. –
– No entries –

What architecture are you on? Using -fw_cfg only works on x86 and arm64.

If you want to install FCOS onto LVM LVs on the host, I’d recommend running coreos-installer install on the host, perhaps from a container. Be sure to pass --platform qemu. For example:

coreos-installer install /dev/vg1/lvm1 --platform qemu --ignition-file /path/to/config.ign

The -fw_cfg option is unrecognized because qemu first gained that option in version 2.4.0. RHEL 8 has it, but RHEL 7 doesn’t. However, if you use --ignition-file (or --ignition-url) with coreos-installer install, you don’t need to pass the Ignition config via fw_cfg.

The “invalid unit name” error was fixed by this PR. You can manually use systemctl --failed to see the failed units, and journalctl -u <unit-name> to see a unit’s logs.

Thank you very much for your reply. Yes I am using CentOS 7x as I did not find this restriction on the documentation page.
I don’t quite understand how you can install on a lvm partition from a container, isn’t it safe ?
I successfully installed FCOS just with ISO, but I can’t slip it a settings file :frowning:

To run coreos-installer from a container, see the instructions I linked above. You have to execute the container with additional privileges.

When installing from ISO, you can pass an Ignition config via coreos.inst.ignition_url on the kernel command line (if you’re using coreos.inst.install_dev), or via --ignition-url on the coreos-installer command line. Also, it’s a good idea to set the platform ID to qemu via coreos.inst.platform_id or --platform respectively.

Yes, I did those options:
–location ‘/var/lib/libvirt/images/fedora-coreos-33.20201201.3.0-live.x86_64.iso’
–extra-args=“coreos.inst.install_dev=/dev/vda coreos.inst.ignition_url=${IGN} console=ttyS0,115200n8 serial”

last year, and I got an error:
Install ERROR:
Displaying logs from failed units: ●

Invalid unit name “●” escaped as “\xe2\x97\x8f” (maybe you should use systemd-escape?).
– Logs begin at Wed 2020-12-30 07:31:51 UTC, end at Wed 2020-12-30 07:31:52 UTC. –
– No entries –
Invalid unit name “●” escaped as “\xe2\x97\x8f” (maybe you should use systemd-escape?).
– Logs begin at Wed 2020-12-30 07:31:51 UTC, end at Wed 2020-12-30 07:31:52 UTC. –
– No entries –

The only thing I didn’t specify was the option
coreos.inst.platform_id
Since I did not understand what you need to specify for it, metal ?

Hmm.
That was the year I tried the image: fedora-coreos-33.20201201.3.0-live.x86_64.iso
Now I downloaded a new image (fedora-coreos-33.20201214.3.1-live.x86_64.iso) and tried it and got this:
Displaying logs from failed units: sysroot.mount
coreos-livepxe-rootfs.service
– Logs begin at Mon 2021-01-11 06:17:44 UTC, end at Mon 2021-01-11 06:17:45 UTC. –
Jan 11 06:17:45 systemd[1]: Mounting /sysroot…
Jan 11 06:17:45 mount[485]: mount: /sysroot: failed to setup loop device for /root.squashfs.
Jan 11 06:17:45 systemd[1]: sysroot.mount: Mount process exited, code=exited, status=32/n/a
Jan 11 06:17:45 systemd[1]: sysroot.mount: Failed with result ‘exit-code’.
Jan 11 06:17:45 systemd[1]: Failed to mount /sysroot.
– Logs begin at Mon 2021-01-11 06:17:44 UTC, end at Mon 2021-01-11 06:17:45 UTC. –
Jan 11 06:17:44 systemd[1]: Starting Acquire live PXE rootfs image…
Jan 11 06:17:44 coreos-livepxe-rootfs[467]: No rootfs image found. Modify your PXE configuration to add the rootfs
Jan 11 06:17:44 systemd[1]: coreos-livepxe-rootfs.service: Main process exited, code=exited, status=1/FAILURE
Jan 11 06:17:44 coreos-livepxe-rootfs[467]: image as a second initrd, or use the coreos.live.rootfs_url= kernel parameter
Jan 11 06:17:44 coreos-livepxe-rootfs[467]: to specify an HTTP or HTTPS URL to the rootfs.
Jan 11 06:17:44 systemd[1]: coreos-livepxe-rootfs.service: Failed with result ‘exit-code’.
Jan 11 06:17:44 systemd[1]: Failed to start Acquire live PXE rootfs image.
Jan 11 06:17:44 systemd[1]: coreos-livepxe-rootfs.service: Triggering OnFailure= dependencies.

virt-install --location doesn’t actually attach the ISO image to the VM. Instead, it tries to extract a kernel and initrd from the ISO and boot those directly, which doesn’t work for FCOS. --cdrom might work better for you.

The default platform ID is metal but you’re running in a qemu VM, so you should specify qemu.

If you can, I’d still recommend running coreos-installer directly on the host. The bare-metal install flow can be used inside VMs but it’s not the recommended approach.

Thanks for the answers.

  1. As far as I know the option : extra-args is not compatible with cdrom
  2. this is just my opinion but I think VMs are more isolated and safer than containers, so I will try to install it.

Ah, yes, you’re right. You can’t use --extra-args with --cdrom.

We’re rolling out a new coreos-installer iso kargs subcommand which will allow modifying the kernel arguments embedded in the ISO. This functionality should work with the stable ISO released in a couple weeks.

1 Like