vagrant icon indicating copy to clipboard operation
vagrant copied to clipboard

Port forward doesn't work if a provision requires reboot

Open RiedleroD opened this issue 2 years ago β€’ 1 comments

Vagrant version

2.2.19

Host operating system

Arch Linux 5.17.7 with newest packages as of date

Guest operating system

Debian Stretch x64

Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "debian/stretch64"
  config.vm.provision "shell", inline: "echo", run: "always", reboot: true
  config.vm.network "forwarded_port", guest: 80, host: 8080
end

note: my provider is libvirt via QEMU/KVM

Debug output

https://pastebin.com/1TQcghSP

Expected behavior

port forward should redirect requests from localhost:8080 to :80

Actual behavior

It doesn't forward the port (and/or does other stuff I'm not seeing)

Steps to reproduce

  1. do vagrant up with the provided vagranfile
  2. install and start e.g. a webserver inside the vm to confirm the port forwarding
  3. check if the port gets forwarded via e.g. curl
  4. check if the webserver is up via the ip address of the VM.

RiedleroD avatar May 20 '22 07:05 RiedleroD

it took me so fckn long to debug this btw, I had no clue what was causing the broken port forward until I disabled the reboot in the config 😫 …it was definitely not the first thing I thought could cause this. 😞

RiedleroD avatar May 20 '22 07:05 RiedleroD

I'm not able to reproduce this problem. It's likely that this issue has been resolved with a new version of Vagrant, so I'm going to go ahead and close this issue. Happy to re-open and look into it again if that's wrong πŸ¦‘

soapy1 avatar Jan 14 '23 00:01 soapy1