Open MadsRC opened 2 years ago
using 0.6.14 , i can not create any vm (vor example simple ubuntu cloudinit example) via terraform ( on premise server not cloud ) :
Error: error while starting the creation of CloudInit's ISO image: exec: "mkisofs": executable file not found in $PATH
│
│ with libvirt_cloudinit_disk.commoninit,
│ on main.tf line 8, in resource "libvirt_cloudinit_disk" "commoninit":
│ 8: resource "libvirt_cloudinit_disk" "commoninit" {
I've also found this issue when using a MacOS system to build from.
@MadsRC's PR starts down the right path, but the problem about Joliet and RockRidge extensions aren't supported, and I believe are required for the iso9660 image. But, with a little bit of testing, I verified that vfat
works for the localds image. Which is supported by go-diskfs
, making that approach viable.
using 0.6.14 , i can not create any vm (vor example simple ubuntu cloudinit example) via terraform ( on premise server not cloud ) :
Error: error while starting the creation of CloudInit's ISO image: exec: "mkisofs": executable file not found in $PATH │ │ with libvirt_cloudinit_disk.commoninit, │ on main.tf line 8, in resource "libvirt_cloudinit_disk" "commoninit": │ 8: resource "libvirt_cloudinit_disk" "commoninit" {
try > brew install cdrtools
Using cdrtools
doesn't solve the issue with Terraform Cloud though.
I use docker image based on Alpine for terraform running and it has been solved for me by installing mkisofs package by the following command:
apk add cdrkit
@MadsRC Did you ever get this working on Terraform Cloud?
I've been trying the workaround for the last few hours to install a genisoimage (mkisofs) binary but I keep getting a exec format error:
Error: error while starting the creation of CloudInit's ISO image: fork/exec /home/tfc-agent/.tfc-agent/component/terraform/runs/run-ceETzGaMcHNTiXrf/.local/bin/mkisofs: exec format error
I've pulled the binary from a hetzner cloud Ubuntu 20.04.6 VM:
root@ubuntu-2gb-hil-1:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
Which seems to be the same version as the runners:
+ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
Still getting exec format error
though.
I managed to get the workaround working on Terraform Cloud. From my previous message, I think I'd messed up the curl command which I copied from the Terraform docs. When I tested it locally, it created a 0 byte file. Anyway I swapped to using wget and it works now.
If anyone is interested, this is what I added to get it working:
resource "null_resource" "always_run" {
triggers = {
timestamp = timestamp()
}
}
resource "terraform_data" "cluster" {
lifecycle {
replace_triggered_by = [
null_resource.always_run
]
}
# Example PATH in a runner
# /home/tfc-agent/.tfc-agent/component/terraform/runs/run-bDb4JfFca6LSu4Jv/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/local/bin
provisioner "local-exec" {
command = <<EOH
set -x
echo PATH=$PATH
cat /etc/os-release
uname -a
pwd
mkdir -p ../.local/bin
wget https://github.com/jseparovic/ubuntu2004/raw/main/mkisofs -O ../.local/bin/mkisofs
chmod 0755 ../.local/bin/mkisofs
mkisofs -version
set +x
EOH
}
}
I ended up building genisoimage (aka: mkisofs) from source as per https://github.com/jseparovic/ubuntu2004
A note on the PATH, it seems that the runner already has a PATH entry for ./.local/bin
so all you have to do is create this folder and put any binaries in there for them to work as is.
Related #895
As mentioned in #935, probably best approach is to move to vfat
for cloud-init
For anyone else stumbling upon this:
apt install genisoimage
(you might not have to build it from source as in example mentioned before)
System Information
Linux distribution
Latest version of Ubuntu LTS as mentioned here
Terraform version
1.1.5
Provider and libvirt versions
Latest available from Hashicorps Terraform Provider registry
Checklist
[x] Is your issue/contribution related with enabling some setting/option exposed by libvirt that the plugin does not yet support, or requires changing/extending the provider terraform schema?
[x] Is it a bug or something that does not work as expected? Please make sure you fill the version information below:
Description of Issue/Question
Setup
Steps to Reproduce Issue
Attempt to create a libvirt_cloudinit_disk resource using Terraform running on Hashicorp managed Terraform Cloud runners.
Additional information:
The call to an external dependency seems to happen here.
According to Terraform Cloud, one should not install additional tools on their runners - While it is supported, it should only be as a last resort. This is documented here and here.
While this does not make the provider entirely incompatible with Terraform Cloud, it sure does make it very tiresome to work with.
See thee attached screenshot for exact error message