{"record":{"id":"159e18015f93d10d","repo":"hashicorp/vagrant","slug":"failed-to-build-iso-image-the-following-command-r","errorCode":null,"errorMessage":"Failed to build iso image. The following command returned an error:\n\n%{cmd}\n\nStdout from the command:\n\n%{stdout}\n\nStderr from the command:\n\n%{stderr}","messagePattern":"Failed to build iso image\\. The following command returned an error:\n\n%(.+?)\n\nStdout from the command:\n\n%(.+?)\n\nStderr from the command:\n\n%(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::ISOBuildFailed","httpStatus":null,"severity":"error","filePath":"lib/vagrant/util/caps.rb","lineNumber":25,"sourceCode":"require \"vagrant/util/directory\"\nrequire \"vagrant/util/subprocess\"\n\nmodule Vagrant\n  module Util\n    module Caps\n      module BuildISO\n\n        # Builds an iso given a compatible iso_command\n        #\n        # @param [List<String>] command to build iso\n        # @param [Pathname] input directory for iso build\n        # @param [Pathname] output file for iso build\n        def build_iso(iso_command, source_directory, file_destination)\n          FileUtils.mkdir_p(file_destination.dirname)\n          if !file_destination.exist? || Vagrant::Util::Directory.directory_changed?(source_directory, file_destination.mtime)\n            result = Vagrant::Util::Subprocess.execute(*iso_command)\n            if result.exit_code != 0\n              raise Vagrant::Errors::ISOBuildFailed, cmd: iso_command.join(\" \"), stdout: result.stdout, stderr: result.stderr\n            end\n          end\n        end\n\n        protected\n\n        def ensure_output_iso(file_destination)\n          if file_destination.nil?\n            tmpfile = Tempfile.new([\"vagrant\", \".iso\"])\n            file_destination = Pathname.new(tmpfile.path)\n            tmpfile.close\n            tmpfile.unlink\n          else\n            file_destination = Pathname.new(file_destination.to_s)\n            # If the file destination path is a folder, target the output to a randomly named\n            # file in that dir\n            if file_destination.extname != \".iso\"\n              file_destination = file_destination.join(\"#{SecureRandom.hex(3)}_vagrant.iso\")","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/lib/vagrant/util/caps.rb#L7-L43","documentation":"Raised by Vagrant::Util::Caps::BuildISO#build_iso when the host ISO tool chosen by host capability (genisoimage/mkisofs/xorriso) exits non-zero while building an ISO (typically the cloud-init NoCloud seed). The message embeds the exact command (%{cmd}) plus its stdout and stderr, so the underlying tool failure is fully visible.","triggerScenarios":"Cloud-init provisioning triggering build_iso when the ISO tool is installed but fails: missing boot images (isolinux.bin / efiboot.img) for EFI-bootable options, unreadable or empty source_directory, no space left on the output device, or a capability-detect that picked flags the installed tool version does not support.","commonSituations":"`vagrant up` with cloud-init on distros shipping xorriso without syslinux files; EFI image options on hosts lacking the boot files; full /tmp or destination directory since output goes through Tempfile/mkdir_p paths.","solutions":["Read the %{stderr} in the message first — it names the real tool error (e.g. 'unable to open .../isolinux.bin')","Install the missing pieces: `apt-get install genisoimage isolinux` / `dnf install genisoimage syslinux` (or xorriso)","Verify source_directory exists and is readable, and check free space on the destination with df -h","If the capability chose the wrong iso_command for your tool version, adjust the installed ISO tool version or report the host capability"],"exampleFix":"# before: host lacks isolinux boot image, ISO tool exits non-zero\n$ vagrant up   # ISOBuildFailed (stderr: unable to open /usr/share/isolinux/isolinux.bin)\n\n# after: install the ISO toolchain and re-run\n$ sudo apt-get install -y genisoimage isolinux\n$ vagrant up","handlingStrategy":"try-catch","validationCode":"require 'vagrant/util/which'\n\ntool = %w[genisoimage mkisofs xorriso].find { |t| Vagrant::Util::Which.which(t) }\nraise 'Install genisoimage/mkisofs/xorriso first' unless tool","typeGuard":null,"tryCatchPattern":"begin\n  Vagrant::Util::Caps::BuildISO.build_iso(cmd, src_dir, dest)\nrescue Vagrant::Errors::ISOBuildFailed => e\n  $stderr.puts e.message # contains cmd + tool stdout/stderr\n  abort 'ISO tool failed; see output above'\nend","preventionTips":["Install genisoimage/mkisofs/xorriso on hosts that build cloud-init seeds","Keep the cloud-init source directory populated and readable","Monitor free space in TMPDIR where the ISO is staged"],"tags":["iso","cloud-init","subprocess","build","genisoimage"],"backgroundTag":"subprocess-build-failed","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}