dmacvicar / terraform-provider-libvirt

Terraform provider to provision infrastructure with Linux's KVM using libvirt
Apache License 2.0
1.54k stars 457 forks source link

Error when defining custom arguments for kernel #997

Closed mvarchdev closed 5 months ago

mvarchdev commented 1 year ago

System Information

Linux distribution

Ubuntu

Terraform version

Terraform v1.3.6
on darwin_amd64

Error when defining custom kernel params:

libvirt_domain.domain-ubuntu: Creating...
╷
│ Error: error creating libvirt domain: internal error: process exited while connecting to monitor: 2023-01-23T16:30:06.058278Z qemu-system-x86_64: -append only allowed with -kernel option
│ 
│   with libvirt_domain.domain-ubuntu,
│   on main.tf line 44, in resource "libvirt_domain" "domain-ubuntu":
│   44: resource "libvirt_domain" "domain-ubuntu" {

Kernel params definition:

  cmdline = [{
    _ = "autoinstall"
  }]
tysonarndt commented 7 months ago

Also experiencing this...

achetronic commented 5 months ago

Same issue here:

cmdline = [{
      "talos.config" = "metal-iso"
  }]
error creating libvirt domain: internal error: process exited while connecting to monitor: 2024-01-12T14:23:37.393317Z qemu-system-x86_64: -append only allowed with -kernel option

I will try to debug deeper when being at home

achetronic commented 5 months ago

After debugging, this error happens because you can not define custom args this way without defining the kernel, so you need to include:

resource "libvirt_domain" "instance" {
    ...

    kernel = libvirt_volume.kernel.id # <======= THIS WAY

    cmdline = [{
        "talos.config" = "metal-iso"
     }]
}

# And include your kernel image for this, of course
resource "libvirt_volume" "kernel" {
  source = "https://github.com/siderolabs/talos/releases/download/v1.6.1/vmlinuz-amd64"
  name   = "kernel"
  pool   = libvirt_pool.volume_pool.name
  format = "raw"
}

Doing this, your image will boot

achetronic commented 5 months ago

/close

michaelbeaumont commented 5 months ago

Thanks for documenting this @achetronic