Skip to content

Instantly share code, notes, and snippets.

@avandrevitor
Created February 4, 2024 16:02
Show Gist options
  • Save avandrevitor/9f0285d8d38cab7c95fba02bf6744d47 to your computer and use it in GitHub Desktop.
Save avandrevitor/9f0285d8d38cab7c95fba02bf6744d47 to your computer and use it in GitHub Desktop.
How to solve the problem of "not being able to use box centos/stream 9"

How to solve the problem of "not being able to use box centos/stream 9" ?

When performing a small proof of concept (POC), I decided to use a Vagrant box with CentOS Stream 9. Unfortunately, to my surprise, I encountered the same issue reported in this thread.

`$ vagrant up
Bringing machine 'machine' up with 'virtualbox' provider...
==> machine: Box 'centos/stream9' could not be found. Attempting to find and install...
    machine: Box Provider: virtualbox
    machine: Box Version: >= 0
==> machine: Loading metadata for box 'centos/stream9'
    machine: URL: https://vagrantcloud.com/centos/stream9
==> machine: Adding box 'centos/stream9' (v20230727.1) for provider: virtualbox
    machine: Downloading: https://vagrantcloud.com/centos/boxes/stream9/versions/20230727.1/providers/virtualbox/unknown/vagrant.box
Download redirected to host: cloud.centos.org
    machine:
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

The requested URL returned error: 404`

At first, there isn't much to do until the administrator resolves this issue.

Researching a little more, I found this tip on the Centos blog, as there is no possibility of commenting on the issue in question, I decided to create these gists to help others who, like me, still want to use an official image, but don't want to have to migrate the distribution from a previous image.

So the Vagrantfile file looked like this:

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

Vagrant.configure("2") do |config|
  config.vm.box = "centos/stream9"

  config.vm.provider :virtualbox do |virtualbox, override|
      virtualbox.memory = 1024
      override.vm.box_download_checksum_type = "sha256"
      override.vm.box_download_checksum = "7a08a97ce54ea55d3294c69353c57db7414512264cdb30377b82748dc2f9f894"
      override.vm.box_url = "http://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-Vagrant-9-20230116.0.x86_64.vagrant-virtualbox.box"
    end

  config.vm.define "metallica" do |alfa|
    alfa.vm.hostname = "metallica"
    alfa.vm.network "private_network", ip: "192.168.56.100"
    alfa.vm.provider "virtualbox" do |v|
        v.memory = 2048
        v.cpus = 2
    end
  end
  
end

In the end everything seems to work fine:

$ vagrant ssh metallica
[vagrant@metallica ~]$ cat /etc/centos-release 
CentOS Stream release 9
[vagrant@metallica ~]$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment