vagrant icon indicating copy to clipboard operation
vagrant copied to clipboard

'box update' with custom catalog fails to see updates

Open einsibjarni opened this issue 2 years ago • 3 comments

Debug output

https://gist.github.com/einsibjarni/e9ae1299aa29b75d84a55c07d6a22aae

Expected behavior

vagrant box update should have seen a new version of the box, 0.0.2, which is newer than the current version, 0.0.1, and added the newest version.

Actual behavior

vagrant box update fetches the metadata.json file, seems to check it, but fails to see that there is a newer version and says that the current version, 0.0.1 is the newest version, even though there is a version 0.0.2 in the file.

Reproduction information

Vagrant version

Vagrant 2.4.0

Host operating system

Pop!_OS 22.04 LTS

Guest operating system

FreeBSD 13.2-RELEASE

Steps to reproduce

  1. Create a metadata.json file, accessible by http, with one version of a box, 0.0.1.
  2. Create a Vagrantfile, with box_url pointing to metadata.json from 1.
  3. Run vagrant up
  4. Update the metadata.json file on the http host, with a new version of the box, version 0.0.2
  5. Wait 1 hour or remove ~/.vagrant.d/boxes/<NAME_OF_BOX>/0.0.1/virtualbox/box_update_check (Replace <NAME_OF_BOX> with the name of the vagrantbox and 'virtualbox' if using a different provider)
  6. Run vagrant box update

Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :
#

Vagrant.configure("2") do |config|
  config.ssh.shell = "sh"

  config.vm.define "vagrant-pot" do |pot|
    pot.vm.box_url = "http://10.0.1.80/metadata.json"
    pot.vm.box = "isnic/freebsd132"
    pot.vm.network "private_network", ip: "10.0.10.85"
  end
end

Catalog file

The metadata.json catalog file I'm using looks like this:

{
  "name": "isnic/freebsd132",
  "description": "ISNIC FreeBSD vagrant box",
  "versions": [
    {
      "version": "0.0.2",
      "providers": [
        {
          "name": "virtualbox",
          "url": "https://gitlab.isnic.is/api/v4/projects/67/packages/generic/vagrant/0.0.2/FreeBSD-13.2-RELEASE-amd64-virtualbox.box",
          "checksum": "cdd7056b82c9171159fbc263993d70eec7a18342c5ae7091cc055747f2cd6af7",
          "checksum_type": "sha256"
        },
        {
          "name": "libvirt",
          "url": "https://gitlab.isnic.is/api/v4/projects/67/packages/generic/vagrant/0.0.2/FreeBSD-13.2-RELEASE-amd64-libvirt.box",
          "checksum": "4ae944ecffa7110c44f39df63f0fe4b9dfa232f236a39be88f1113ebbbb92829",
          "checksum_type": "sha256"
        }
      ]
    },
    {
      "version": "0.0.1",
      "providers": [
        {
          "name": "virtualbox",
          "url": "https://gitlab.isnic.is/api/v4/projects/67/packages/generic/vagrant/0.0.1/FreeBSD-13.2-RELEASE-amd64-virtualbox.box",
          "checksum": "2001ad9d56d41d8004636a9780b09a8eb70a294b3aadfb934e81cbf82a55347a",
          "checksum_type": "sha256"
        },
        {
          "name": "libvirt",
          "url": "https://gitlab.isnic.is/api/v4/projects/67/packages/generic/vagrant/0.0.1/FreeBSD-13.2-RELEASE-amd64-libvirt.box",
          "checksum": "a38fea902238639a0a6a8bc226f6bd69c031a731972de57630277de609299656",
          "checksum_type": "sha256"
        }
      ]
    }
  ]
}

einsibjarni avatar Nov 03 '23 09:11 einsibjarni

Got it to work by adding "arch": "amd64"

Still seems to be a bug that vagrant up manages to do the right thing without it, while vagrant box update requires it

einsibjarni avatar Nov 08 '23 11:11 einsibjarni

Yeah, I'm seeing the same thing. When you said you added the "arch": "amd64", were you talking about the manifest file? The docs say to use "architecture": "amd64",, but adding that to my manifest didn't seem to help.

dokuhebi avatar Nov 30 '23 20:11 dokuhebi

Yeah, I'm seeing the same thing. When you said you added the "arch": "amd64", were you talking about the manifest file? The docs say to use "architecture": "amd64",, but adding that to my manifest didn't seem to help.

Sorry for the late reply. You're right, it's "architecture": "amd64".

This is in the box catalog metadata, we name it metadata.json, but it's not the metadata.json that's in the box archive. The file can be called whatever, then in the Vagrantfile we point to it with db.vm.box_url = "file://metadata.json"

einsibjarni avatar Dec 13 '23 22:12 einsibjarni