hashicorp / vagrant

Vagrant is a tool for building and distributing development environments.
https://www.vagrantup.com
Other
26.05k stars 4.42k forks source link

Windows machine fails to start: cmd hostname Digest initialization failed: initialization error #13229

Open pbrezina opened 1 year ago

pbrezina commented 1 year ago

Debug output

https://gist.github.com/pbrezina/a58b158dc8fe62b7b19c13222f955068

Expected behavior

Guest starts.

Actual behavior

Error:

...
==> ad: Waiting for machine to boot. This may take a few minutes...
    ad: WinRM address: [192.168.121.97:5985](http://192.168.121.97:5985/)
    ad: WinRM username: Administrator
    ad: WinRM execution_time_limit: PT2H
    ad: WinRM transport: negotiate
==> ad: Removing domain...
==> ad: Deleting the machine folder
An error occurred executing a remote WinRM command.

Shell: Cmd
Command: hostname
Message: Digest initialization failed: initialization error

Reproduction information

Vagrant version

Vagrant 2.3.7

Host operating system

Host Fedora, running vagrant from container, Containerfile

Run as:

function vagrant {
dir="${VAGRANT_HOME:-$HOME/.vagrant.d}"
mkdir -p "$dir/"{boxes,data,tmp}

podman run -it --rm \
    -e LIBVIRT_DEFAULT_URI \
    -v /var/run/libvirt/:/var/run/libvirt/ \
    -v "$dir/boxes:/vagrant/boxes" \
    -v "$dir/data:/vagrant/data" \
    -v "$dir/tmp:/vagrant/tmp" \
    -v $(realpath "${PWD}"):${PWD} \
    -w $(realpath "${PWD}") \
    --network host \
    --security-opt label=disable \
    quay.io/sssd/vagrant:latest \
    vagrant $@
}

Guest operating system

peru/windows-server-2022-standard-x64-eval

Steps to reproduce

  1. vagrant up

Vagrantfile

Vagrant.configure("2") do |config|
    config.vm.define "ad" do |this|
        this.vm.box = "peru/windows-server-2022-standard-x64-eval"
        this.vm.hostname = "dc"
        this.vm.guest = :windows
        this.vm.communicator = "winrm"
        this.winrm.username = "Administrator"
        this.vm.network "private_network",
            :ip => "172.16.200.10",
            :libvirt__dhcp_enabled => false,
            :libvirt__network_address => '172.16.200.0/24',
            :libvirt__forward_mode => 'route'

        this.vm.provider :libvirt do |libvirt|
            libvirt.memory = 4092

            if defined?(libvirt.qemu_use_session)
                libvirt.qemu_use_session = false
            end
        end

        this.vm.provision "ansible" do |ansible|
            ansible.inventory_path = "./ansible/inventory.yml"
            ansible.playbook = "./ansible/playbook_vagrant.yml"
            ansible.config_file = "./ansible/ansible.cfg"
        end
    end
end
pansfy commented 1 year ago

I also encountered the same situation, after troubleshooting the lower Vagrant version, we can solve this phenomenon. Test passed version: Vagrant 2.2.19, VirtualBox 6.1.44

mmguero commented 9 months ago

For me this is fixed in v2.4.0.

==> vagrant-windows-10-enterprise-x64-eval: Starting domain.
==> vagrant-windows-10-enterprise-x64-eval: Waiting for domain to get an IP address...
==> vagrant-windows-10-enterprise-x64-eval: Waiting for machine to boot. This may take a few minutes...
    vagrant-windows-10-enterprise-x64-eval: WinRM address: 192.168.121.95:5985
    vagrant-windows-10-enterprise-x64-eval: WinRM username: vagrant
    vagrant-windows-10-enterprise-x64-eval: WinRM execution_time_limit: PT2H
    vagrant-windows-10-enterprise-x64-eval: WinRM transport: negotiate
==> vagrant-windows-10-enterprise-x64-eval: Machine booted and ready!
==> vagrant-windows-10-enterprise-x64-eval: Forwarding ports...
==> vagrant-windows-10-enterprise-x64-eval: 3389 (guest) => 3389 (host) (adapter eth0)
==> vagrant-windows-10-enterprise-x64-eval: 5986 (guest) => 5986 (host) (adapter eth0)
==> vagrant-windows-10-enterprise-x64-eval: 5985 (guest) => 5985 (host) (adapter eth0)
==> vagrant-windows-10-enterprise-x64-eval: Running provisioner: shell...
    vagrant-windows-10-enterprise-x64-eval: Running: inline PowerShell script
    vagrant-windows-10-enterprise-x64-eval: The operation completed successfully.
DziubanMaciej commented 5 months ago

Still visible on Vagrant 2.4.1, although workaround mentioned in https://github.com/gusztavvargadr/packer/issues/420 helps.