0

I get the error

virtualbox-iso: Running post-processor: vagrant-cloud ==> virtualbox-iso (vagrant-cloud): Verifying box is accessible: redacted/ubuntu2004
Build 'virtualbox-iso' errored: 1 error(s) occurred:
* Post-processor failed: Error retrieving box: Resource not found!

This is my JSON file (pastebin link or below):

{
  "variables": {
    "cloud_token": "{{ env `VAGRANT_CLOUD_TOKEN` }}",
    "version": "4.0.0"
  },
  "provisioners": [
    {
      "type": "shell",
      "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
      "script": "scripts/ansible.sh"
    },
    {
      "type": "shell",
      "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
      "script": "scripts/setup.sh"
    },
    {
      "type": "ansible-local",
      "playbook_file": "../shared/main.yml",
      "galaxy_file": "../shared/requirements.yml"
    },
    {
      "type": "shell",
      "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
      "script": "scripts/cleanup.sh"
    }
  ],
  "builders": [
    {
      "type": "virtualbox-iso",
      "boot_command": [
        "<esc><wait>",
        "<esc><wait>",
        "<enter><wait>",
        "/install/vmlinuz",
        " auto=true",
        " url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg",
        " locale=en_US<wait>",
        " console-setup/ask_detect=false<wait>",
        " console-setup/layoutcode=us<wait>",
        " console-setup/modelcode=pc105<wait>",
        " debconf/frontend=noninteractive<wait>",
        " debian-installer=en_US<wait>",
        " fb=false<wait>",
        " initrd=/install/initrd.gz<wait>",
        " kbd-chooser/method=us<wait>",
        " keyboard-configuration/layout=USA<wait>",
        " keyboard-configuration/variant=USA<wait>",
        " netcfg/get_domain=vm<wait>",
        " netcfg/get_hostname=vagrant<wait>",
        " grub-installer/bootdev=/dev/sda<wait>",
        " noapic<wait>",
        " -- <wait>",
        "<enter><wait>"
      ],
      "boot_wait": "10s",
      "disk_size": 81920,
      "guest_os_type": "Ubuntu_64",
      "headless": false,
      "http_directory": "http",
      "iso_urls": [
        "iso/focal-legacy-server-amd64.iso",
        "http://cdimage.ubuntu.com/ubuntu-legacy-server/releases/20.04/release/ubuntu-20.04-legacy-server-amd64.iso"
      ],
      "iso_checksum_type": "sha256",
      "iso_checksum": "36f15879bd9dfd061cd588620a164a82972663fdd148cce1f70d57d314c21b73",
      "ssh_username": "vagrant",
      "ssh_password": "vagrant",
      "ssh_port": 22,
      "ssh_wait_timeout": "1800s",
      "shutdown_command": "echo 'vagrant'|sudo -S shutdown -P now",
      "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
      "virtualbox_version_file": ".vbox_version",
      "vm_name": "packer-ubuntu-20.04-amd64",
      "vboxmanage": [
        [
          "modifyvm",
          "{{.Name}}",
          "--memory",
          "2048"
        ],
        [
          "modifyvm",
          "{{.Name}}",
          "--cpus",
          "2"
        ]
      ]
    }
  ],
  "post-processors": [
    [
      {
        "type": "vagrant",
        "output": "builds/{{.Provider}}-ubuntu2004.box"

      },
      {
        "type": "vagrant-cloud",
        "box_tag": "redacted/ubuntu2004",
        "access_token": "{{user `cloud_token`}}",
        "version": "{{user `version`}}"
      }
    ]
  ]
}

1 Answer 1

0

You first have to create the box on app.vagrantup.com. Make sure the name matches what you gave in the HCL file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .