0

I'm trying to setup a vagrantbox with Hyper-V on my local windows-10 mashine. My Workstation is running behind a proxy, but I configured a local cntlm proxy to get around these limitations. Proxy settings work fine since I was able to install a vagrant plugin and downloan a box image.

But now my guest linux does not start up and I am running out of ideas.

My vagrant file

Vagrant.configure("2") do |config|

    config.vm.box = "bento/ubuntu-18.04" # ubuntu 18.04 image with support for virtual box and Hyper-V
    config.vm.hostname = "skywalker"

    config.vm.provider "virtualbox" do |vb|
        vb.memory = "2048"
    end

    config.vm.provider "hyperv" do |hv|
        hv.memory = "2048"
    end

    config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'" # prevent tty errors

    # install the vagrant plugin "vagrant-cachier" to cache downloaded artifacts
    if Vagrant.has_plugin?("vagrant-cachier")
        config.cache.scope = :box
    end

    # vagrant behing local cntlm proxy if plugin exists (= provinzial win10 workstation)
    if !Vagrant.has_plugin?("vagrant-proxyconf")
        config.proxy.http     = "http://localhost:3128/"
        config.proxy.https    = "http://localhost:3128/"
        config.proxy.no_proxy = "localhost, 127.0.0.1"
    end

    # --------------------------------------------------------------------------

    # provision virtual mashine (basic setup) and install applications in VM
    #config.vm.provision "shell", path: "scripts/install-ansible.sh"
    config.vm.provision "shell", path: "scripts/install-ncdu.sh"
    config.vm.provision "shell", path: "scripts/install-git.sh"
    config.vm.provision "shell", path: "scripts/install-openjdk-11.sh"
    config.vm.provision "shell", path: "scripts/install-maven.sh"
    config.vm.provision "shell", path: "scripts/install-node-npm.sh"
    config.vm.provision "shell", path: "scripts/install-docker.sh"
    config.vm.provision "shell", path: "scripts/install-docker-compose.sh"

    # npm webserver
    config.vm.provision "shell", path: "apps/install-npm-apps.sh"
    config.vm.network "forwarded_port", guest: 8000, host: 8000

    # artifactory setup (start artifactory after vm startup)
    config.vm.network "forwarded_port", guest: 8081, host: 8081 # artifactory from docker
    config.vm.network "forwarded_port", guest: 8082, host: 8082 # artifactory from docker
    # See README.md for Artifactory in Docker

end

Starting the box with this settings results in

C:\home\work\workspace\vagrant-boxes\skywalker (master -> origin)
λ vagrant up
Bringing machine 'default' up with 'hyperv' provider...
==> default: Verifying Hyper-V is enabled...
==> default: Verifying Hyper-V is accessible...
==> default: Importing a Hyper-V instance
    default: Creating and registering the VM...
    default: Successfully imported VM
    default: Configuring the VM...
==> default: Starting the machine...
==> default: Waiting for the machine to report its IP address...
    default: Timeout: 120 seconds
    default: IP: fe80::215:5dff:fe02:8b01
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: fe80::215:5dff:fe02:8b01:22
    default: SSH username: vagrant
    default: SSH auth method: private key
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

On a different mashine with VirtualBox as VM provider this Vagrantfile works fine. Sadly I cannot use any VM provider other than Hyper-V on my windows mashine due to limitations which are out of my control ...

I set up Hyper-V using Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All.

Any ideas? Thanks in advance and best regards. Sebastian

1 Answer 1

1

Vagrant up of your box reports an IPv6 address. Normally the VM's network initialization involves sending a DHCP request and an IPv4 address is returned. I suspect your VM did that but the request timed out and it only had the default IPv6 one to report.

The remaining steps in the 'vagrant up' sequence are done by ssh-ing into the reported address but that doesn't work as far as I know with IPv6 and so in reported a failure to boot properly.

If you see it running in the Hyper-V manager and can connect to the console, I suggest your problem is caused by either a change in firewall between your VM and Windows host or a change in the configuration of the ethernet adapter disabling the DHCP server.

You can run 'tcpdump -i any port 67' using the Hyper-V console into the VM to see the packets sent / received within the VM and use what ever tool you have on the host to see packets on the host.

1
  • It's a link-local address, though. Fine for guest to host communication (although Vagrant seems to be unaware of how to handle them) but useless for accessing the Internet. Jul 2, 2020 at 20:39

You must log in to answer this question.

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