Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

any up and box add gives Error: The requested URL returned error: 403 #12390

Closed
robkorv opened this issue May 25, 2021 · 26 comments
Closed

any up and box add gives Error: The requested URL returned error: 403 #12390

robkorv opened this issue May 25, 2021 · 26 comments

Comments

@robkorv
Copy link

robkorv commented May 25, 2021

Vagrant version

Both Vagrant 2.2.16 from the ppa and de deb download

Host operating system

Fresh installation of Ubuntu 20.04.2 LTS

Guest operating system

ubuntu/bionic64
hashicorp/bionic64

Vagrantfile

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

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://vagrantcloud.com/search.
  config.vm.box = "ubuntu/bionic64"

  # Disable automatic box update checking. If you disable this, then
  # boxes will only be checked for updates when the user runs
  # `vagrant box outdated`. This is not recommended.
  # config.vm.box_check_update = false

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
  # NOTE: This will enable public access to the opened port
  # config.vm.network "forwarded_port", guest: 80, host: 8080

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine and only allow access
  # via 127.0.0.1 to disable public access
  # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  # config.vm.network "private_network", ip: "192.168.33.10"

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  # config.vm.network "public_network"

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "../data", "/vagrant_data"

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
  # config.vm.provider "virtualbox" do |vb|
  #   # Display the VirtualBox GUI when booting the machine
  #   vb.gui = true
  #
  #   # Customize the amount of memory on the VM:
  #   vb.memory = "1024"
  # end
  #
  # View the documentation for the provider you are using for more
  # information on available options.

  # Enable provisioning with a shell script. Additional provisioners such as
  # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
  # documentation for more information about their specific syntax and use.
  # config.vm.provision "shell", inline: <<-SHELL
  #   apt-get update
  #   apt-get install -y apache2
  # SHELL
end

Debug output

https://gist.github.com/robkorv/543c8d52c3292abe110ecdf19dcea768

Expected behavior

Box should be added and brought up.

Actual behavior

Got an error:

The box 'ubuntu/bionic64' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Vagrant Cloud, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:

URL: ["https://vagrantcloud.com/ubuntu/bionic64"]
Error: The requested URL returned error: 403

Steps to reproduce

  1. vagrant init ubuntu/bionic64
  2. vagrant up
  3. vagrant box add hashicorp/bionic64 <-- similar error
@dsanches81
Copy link

Same here, tried with different boxes and the output is the same.

What I noticed:

  • Vagrant login is also broken with 403
  • Downloading the .box file from a browser works.

@caiodelgadonew
Copy link

caiodelgadonew commented May 25, 2021

@dsanches81

This happens because there's no ubuntu/bionic64 for hyper-v provider

The ubuntu/bionic64 exists only for virtualbox provider

With the hashicorp/bionic64 maybe you should set the version to the correct one:

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/bionic64"
  config.vm.box_version = "1.0.282"
end

@robkorv
Copy link
Author

robkorv commented May 25, 2021

This happens because there's no ubunty/bionic64 for hyper-v provider

"Host system: Fresh installation of Ubuntu 20.04.2 LTS". So I'm using Virtualbox as provider.

@caiodelgadonew
Copy link

This happens because there's no ubunty/bionic64 for hyper-v provider

"Host system: Fresh installation of Ubuntu 20.04.2 LTS". So I'm using Virtualbox as provider.

I've updated the comment with the virtualbox thing...

try to just init a new one repo with:

vagrant init -m ubuntu/bionic64
vagrant up

and see if works, also try with images like:

centos/7
debian/buster64

and see if it works

@caiodelgadonew
Copy link

Also @robkorv maybe you have another provider not initialized into your pc... you can also start your machine with

$ vagrant up --provider virtualbox

it will enforce the provider virtualbox and will try to download the image :)

@robkorv
Copy link
Author

robkorv commented May 25, 2021

Thanks for trying to help me @caiodelgadonew. The problem is some where in the the url or handling of the response, see my debug report in the initial post. It tried everything you suggested. Same error pops up.

Do you have any other suggestions?

@Yohnah
Copy link

Yohnah commented May 25, 2021

Hi everybody, it's not only when doing a vagrant up or box add, it is going on when any kind of command for connecting to internet.

I'm using vagrant 2.2.16 on MACOS BigSur

It's not possible doing anything with vagrant without boxes already downloaded

Examples:

https://gist.github.com/Yohnah/5a799b0bbddbaa8d526b8ccaf0a4c154

@robkorv
Copy link
Author

robkorv commented May 25, 2021

@Yohnah plz don't post logs in issues. Create a gist for it and share the link. See https://github.com/hashicorp/vagrant/blob/main/.github/ISSUE_TEMPLATE/bug-report.md#debug-output

@Yohnah
Copy link

Yohnah commented May 25, 2021

@Yohnah plz don't post logs in issues. Create a gist for it and share the link. See https://github.com/hashicorp/vagrant/blob/main/.github/ISSUE_TEMPLATE/bug-report.md#debug-output

Done

@Yohnah
Copy link

Yohnah commented May 25, 2021

This happens because there's no ubunty/bionic64 for hyper-v provider

"Host system: Fresh installation of Ubuntu 20.04.2 LTS". So I'm using Virtualbox as provider.

I've updated the comment with the virtualbox thing...

try to just init a new one repo with:

vagrant init -m ubuntu/bionic64
vagrant up

and see if works, also try with images like:

centos/7
debian/buster64

and see if it works

Does not work neather

@caiodelgadonew
Copy link

Just checked here, same problem on latest version of vagrant....

What works for me is "wgetting" the url and manually adding it:

Eg.:

$ wget https://app.vagrantup.com/ubuntu/boxes/bionic64/versions/20210521.0.0/providers/virtualbox.box
$ vagrant box add ubuntu/bionic64 virtualbox.box

@enginexon
Copy link

enginexon commented May 25, 2021

I have same issue. Windows 10.
vagrant version
Installed Version: 2.2.16
Latest Version: 2.2.16

I can not even download some of boxes from official site. For example: https://app.vagrantup.com/gusztavvargadr/boxes/windows-10

@Yohnah
Copy link

Yohnah commented May 25, 2021

Just checked here, same problem on latest version of vagrant....

What works for me is "wgetting" the url and manually adding it:

Eg.:

$ wget https://app.vagrantup.com/ubuntu/boxes/bionic64/versions/20210521.0.0/providers/virtualbox.box
$ vagrant box add ubuntu/bionic64 virtualbox.box
Even, testing with older versions it also happens (2.2.14 and 2.2.15)

But, It got a difference, when I perform a vagrant cloud search, I only get a response "request failed".

$ vagrant cloud search ubuntu                                                                                                                                                                                    
Could not complete search request
Vagrant Cloud request failed

@attrib
Copy link

attrib commented May 25, 2021

Same here with debian10
Vargrant Version: 2.2.16

Doing a vagrant up shows the mentioned 403 error.

Doing a manual curl to the addres gives me back a 302 from cloudfront.

I also just created a vagrant cloud account, because didn't use vagrant for a long time and thought maybe it requires an account now.
But vagrant cloud auth login also returns with a 403.

Did a vagrant cloud auth login --debug to see the request and did a curl -v "https://vagrantcloud.com/api/v1/authenticate" -d @test.json -H "Content-Type: application/json" -X POST

Which returns a 403 with:

This distribution is not configured to allow the HTTP request method that was used for this request. The distribution supports only cachable requests.
We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.

Are vagrant backend servers down?

@Yohnah
Copy link

Yohnah commented May 25, 2021

Hi, I think I figured out where is the issue. I think it is a DNS replication issue

If I setup Google DNS in my computer: 8.8.8.8 -> vagrant does not work

If I setup CloudFlare DNS in my computer: 1.1.1.1 -> vagrant does not work

If I setup OpenDNS DNS in my computer: 208.67.222.222 -> vagrant works!!!

So, I am using this workaround by means of the issue is being fixed.

The difference DNS responses between them:

$ dig +short vagrantcloud.com @208.67.222.222   #OpenDNS
54.144.219.72
3.228.103.136
3.229.59.32
34.195.37.70
34.202.43.88
34.235.106.23
52.71.114.62
52.204.93.39

 dig +short vagrantcloud.com @8.8.8.8    #Google DNS
52.85.187.52
52.85.187.9
52.85.187.51
52.85.187.63

dig +short vagrantcloud.com @1.1.1.1         #Cloudflare DNS
52.85.187.52
52.85.187.63
52.85.187.9
52.85.187.51

I hope it can be helpful.

@dsanches81
Copy link

Good catch!

@caiodelgadonew
Copy link

@soapy1 can you take a look into that? :D

@sio
Copy link

sio commented May 25, 2021

I have encountered the same issue, both with older Vagrant from Debian/Ubuntu repos and with the latest 2.2.16 from hashicorp web site.

The problem seems to be with CDN or HTTP frontend configuration.

Correct redirect sequence would be:

  • https://vagrantcloud.com/ubuntu/bionic64
  • -> https://app.vagrantup.com/ubuntu/bionic64
  • -> https://app.vagrantup.com/ubuntu/boxes/bionic64
  • -> ...

The first redirect is broken. Instead we are getting

  • https://vagrantcloud.com/ubuntu/bionic64
  • -> https://app.vagrantup.com/ - notice the missing box definition
  • -> https://app.vagrantup.com/boxes/search
  • -> ...

If I modify /etc/hosts for vagrantcloud.com to point to the same IPs as app.vagrantup.com everything turns back to normal. Some configuration on Hashicorp side is required either with vagrantcloud.com redirect or with handling of incoming headers on app.vagrantup.com


Upd:: Seems like a CDN misconfiguration. Basically any redirect from vagrantcloud.com/suburl points to the front page of app.vagrantup.com:

$ curl -si https://vagrantcloud.com/gibberish/foo/bar/baz
HTTP/2 302
content-length: 0
location: https://app.vagrantup.com/
server: CloudFront
date: Tue, 25 May 2021 12:22:06 GMT
x-cache: Miss from cloudfront
via: 1.1 618e94643d6094e9ff9adbaaa8ed3aef.cloudfront.net (CloudFront)
x-amz-cf-pop: AMS50-C1
x-amz-cf-id: 8XiUdO-he4NhMFw-CxE7UNJnBVrmyAhIuhjAVEgrwlZEK3Naff7T3Q==

@m0sh1x2
Copy link

m0sh1x2 commented May 25, 2021

If the solution of @Yohnah doesn't suit anyone you can download the boxes manually:

Temporary Solution 1

vagrant box add --name generic/ubuntu2004 https://app.vagrantup.com/generic/boxes/ubuntu2004/versions/3.2.20/providers/libvirt.box

Temporary Solution 2

Or add any of the noted Ip's in your /etc/hosts file:

34.195.37.70 vagrantcloud.com

And it just works:

image

Remember to remove it once Hashicorp Team fixes the issue.

Cheers

@Vasu1105
Copy link

Vasu1105 commented May 25, 2021

I am facing similar issues on Ubuntu 18.04
gist of logs https://gist.github.com/Vasu1105/5e0b37dddb0a40fccf33e0c84c51d2e7

@Vivian-A
Copy link

Solution 2
Or add any of the noted Ip's in your /etc/hosts file:

34.195.37.70 vagrantcloud.com
And it just works:

Legend, this worked perfectly!

@badjware
Copy link

The solution of @m0sh1x2 didn't work for me, I suspect this is because I am behind a corporate proxy.

@chrisroberts
Copy link
Member

Hi. My apologies everyone. We had a configuration update that resulted in some redirect issues which caused the 403 errors that were being encountered. This has been resolved and Vagrant Cloud is now responding correctly. As a result, box interactions from the Vagrant CLI are also working as expected. Again, my apologies for the unexpected errors and thanks for the patience while we resolved the issue.

Cheers!

@Yohnah
Copy link

Yohnah commented May 26, 2021

Hi. My apologies everyone. We had a configuration update that resulted in some redirect issues which caused the 403 errors that were being encountered. This has been resolved and Vagrant Cloud is now responding correctly. As a result, box interactions from the Vagrant CLI are also working as expected. Again, my apologies for the unexpected errors and thanks for the patience while we resolved the issue.

Cheers!

The login process by cli does not still work, I open a new thread #12393

@chuckwolber
Copy link

Having the same issue with vagrant 2.2.15 behind a firewall attempting to connect to a local instance of Gitlab also behind the firewall. No vagrant sites or external CDN are any part of this transaction. A wget of the box works perfectly, but using the same URL in Vagrantfile always gets a 403. I got it working by falling back to vagrant 2.2.14. Vagrant 2.2.16 is not (currently) an option due to the SSH key handling changes that broke a configuration controlled environment.

This gist contains the relevant bits that are failing when using vagrant 2.2.15.

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests