clong / DetectionLab

Automate the creation of a lab environment complete with security tooling and logging best practices
MIT License
4.59k stars 979 forks source link

dc - stdout: Error: The VMware Tools are not running in the virtual machine #853

Closed bcheevers123 closed 1 year ago

bcheevers123 commented 1 year ago

Building from master branch

Description of the issue:

While building the domain controller (dc), I'm running into the following error message that causes the build to stop:

I am using this command to build the domain controller.

vagrant up dc --provider vmware_desktop --provision

Note this issue also occurs when doing the sequential vagrant up

dc: Enabling and configuring shared folders...
An error occurred while executing `vmrun`, a utility for controlling
VMware machines. The command and output are below:

Command: ["enableSharedFolders", "D:\\Detection Lab\\Vagrant\\.vagrant\\machines\\dc\\vmware_desktop\\2866e893-a83e-4d26-870c-658b65fa2bf9\\WindowsServer2016.vmx", {:notify=>[:stdout, :stderr]}]

Stdout: Error: The VMware Tools are not running in the virtual machine: D:\Detection Lab\Vagrant\.vagrant\machines\dc\vmware_desktop\2866e893-a83e-4d26-870c-658b65fa2bf9\WindowsServer2016.vmx

Stderr:

Powershell log

PS D:\Detection Lab\Vagrant> vagrant up dc --provider vmware_desktop --provision
Bringing machine 'dc' up with 'vmware_desktop' provider...
==> dc: Checking if box 'detectionlab/win2016' version '1.9' is up to date...
==> dc: Verifying vmnet devices are healthy...
==> dc: Preparing network adapters...
WARNING: The VMX file for this box contains a setting that is automatically overwritten by Vagrant
WARNING: when started. Vagrant will stop overwriting this setting in an upcoming release which may
WARNING: prevent proper networking setup. Below is the detected VMX setting:
WARNING:
WARNING:   ethernet1.pcislotnumber = "33"
WARNING:
WARNING: If networking fails to properly configure, it may require this VMX setting. It can be manually
WARNING: applied via the Vagrantfile:
WARNING:
WARNING:   Vagrant.configure(2) do |config|
WARNING:     config.vm.provider :vmware_desktop do |vmware|
WARNING:       vmware.vmx["ethernet1.pcislotnumber"] = "33"
WARNING:     end
WARNING:   end
WARNING:
WARNING: For more information: https://www.vagrantup.com/docs/vmware/boxes.html#vmx-allowlisting
==> dc: Fixed port collision for 22 => 2222. Now on port 2200.
==> dc: Starting the VMware VM...
==> dc: Waiting for the VM to receive an address...
==> dc: Forwarding ports...
    dc: -- 5985 => 55985
    dc: -- 5986 => 55986
    dc: -- 22 => 2200
==> dc: Waiting for machine to boot. This may take a few minutes...
    dc: WinRM address: 127.0.0.1:55985
    dc: WinRM username: vagrant
    dc: WinRM execution_time_limit: PT2H
    dc: WinRM transport: plaintext
==> dc: Machine booted and ready!
==> dc: Setting hostname...
==> dc: Configuring network adapters within the VM...
==> dc: Configuring secondary network adapters through VMware
==> dc: on Windows is not yet supported. You will need to manually
==> dc: configure the network adapter.
==> dc: Enabling and configuring shared folders...
An error occurred while executing `vmrun`, a utility for controlling
VMware machines. The command and output are below:

Command: ["enableSharedFolders", "D:\\Detection Lab\\Vagrant\\.vagrant\\machines\\dc\\vmware_desktop\\2866e893-a83e-4d26-870c-658b65fa2bf9\\WindowsServer2016.vmx", {:notify=>[:stdout, :stderr]}]

Stdout: Error: The VMware Tools are not running in the virtual machine: D:\Detection Lab\Vagrant\.vagrant\machines\dc\vmware_desktop\2866e893-a83e-4d26-870c-658b65fa2bf9\WindowsServer2016.vmx

Stderr:
PS D:\Detection Lab\Vagrant>

Do I have to manually install VMWare Tools? Should vagrant not do this?

clong commented 1 year ago

Dupe of https://github.com/clong/DetectionLab/issues/720

Please try out the instructions in this comment and let me know if that resolves it: https://github.com/clong/DetectionLab/issues/720#issuecomment-1250618857

bcheevers123 commented 1 year ago

@clong I get this output, which still states missing VMWare Tools.

PS D:\Detection Lab\Vagrant> vagrant up dc --provider vmware_desktop --provisionupt.
Bringing machine 'dc' up with 'vmware_desktop' provider...
==> dc: Cloning VMware VM: 'detectionlab/win2016'. This can take some time...
==> dc: Checking if box 'detectionlab/win2016' version '1.9' is up to date...
==> dc: Verifying vmnet devices are healthy...
==> dc: Preparing network adapters...
WARNING: The VMX file for this box contains a setting that is automatically overwritten by Vagrant
WARNING: when started. Vagrant will stop overwriting this setting in an upcoming release which may
WARNING: prevent proper networking setup. Below is the detected VMX setting:
WARNING:
WARNING:   ethernet0.pcislotnumber = "33"
WARNING:
WARNING: If networking fails to properly configure, it may require this VMX setting. It can be manually
WARNING: applied via the Vagrantfile:
WARNING:
WARNING:   Vagrant.configure(2) do |config|
WARNING:     config.vm.provider :vmware_desktop do |vmware|
WARNING:       vmware.vmx["ethernet0.pcislotnumber"] = "33"
WARNING:     end
WARNING:   end
WARNING:
WARNING: For more information: https://www.vagrantup.com/docs/vmware/boxes.html#vmx-allowlisting
==> dc: Fixed port collision for 22 => 2222. Now on port 2200.
==> dc: Starting the VMware VM...
==> dc: Waiting for the VM to receive an address...
==> dc: Forwarding ports...
    dc: -- 5985 => 55985
    dc: -- 5986 => 55986
    dc: -- 22 => 2200
==> dc: Waiting for machine to boot. This may take a few minutes...
    dc: WinRM address: 127.0.0.1:55985
    dc: WinRM username: vagrant
    dc: WinRM execution_time_limit: PT2H
    dc: WinRM transport: plaintext
==> dc: Machine booted and ready!
==> dc: Setting hostname...
==> dc: Waiting for machine to reboot...
==> dc: Configuring network adapters within the VM...
==> dc: Configuring secondary network adapters through VMware
==> dc: on Windows is not yet supported. You will need to manually
==> dc: configure the network adapter.
==> dc: Running provisioner: shell...
    dc: Running: scripts/fix-second-network.ps1 as C:\tmp\vagrant-shell.ps1
    dc: [09:16] Running fix-second-network.ps1...
    dc: [09:16] No VirtIO adapters, moving on...
    dc: [09:16] VMware Tools not found, no need to continue. Exiting.
==> dc: Running provisioner: shell...
    dc: Running: scripts/provision.ps1 as C:\tmp\vagrant-shell.ps1
    dc: [09:16] Setting timezone to UTC...
    dc: [09:16] Checking if Windows evaluation is expiring soon or expired...
    dc: powershell.exe : . : The term 'c:\vagrant\scripts\fix-windows-expiration.ps1' is not recognized as the name of a
    dc:     + CategoryInfo          : NotSpecified: (. : The term 'c... the name of a :String) [], RemoteException
    dc:     + FullyQualifiedErrorId : NativeCommandError
    dc: cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
    dc: was included, verify that the path is correct and try again.
    dc: At C:\tmp\vagrant-shell.ps1:12 char:3
    dc: + . c:\vagrant\scripts\fix-windows-expiration.ps1
    dc: +   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    dc:     + CategoryInfo          : ObjectNotFound: (c:\vagrant\scri...-expiration.ps1:String) [], Comm
    dc:    andNotFoundException
    dc:     + FullyQualifiedErrorId : CommandNotFoundException
    dc:
    dc: [09:16] Disabling the Invoke-WebRequest download progress bar globally for speed improvements.
    dc: [09:16] See https://github.com/PowerShell/PowerShell/issues/2138 for more info
    dc: Unable to connect to ping.detectionlab.network
    dc: [09:16] Disabling IPv6 on all network adatpers...
    dc:
    dc: Name                           DisplayName                                        ComponentID
    dc: ----                           -----------                                        -----------
    dc: Ethernet1                      Internet Protocol Version 6 (TCP/IPv6)             ms_tcpip6
    dc: Ethernet0 2                    Internet Protocol Version 6 (TCP/IPv6)             ms_tcpip6
    dc: The operation completed successfully.
    dc:
    dc: [09:16] Current domain is set to 'workgroup'. Time to join the domain!
    dc: [09:16] Installing bginfo...
    dc: . : The term 'c:\vagrant\scripts\install-bginfo.ps1' is not recognized as the name of a cmdlet,
    dc: function, script file, or operable program. Check the spelling of the name, or if a path was
    dc: included, verify that the path is correct and try again.
    dc: At C:\tmp\vagrant-shell.ps1:49 char:7
    dc: +     . c:\vagrant\scripts\install-bginfo.ps1
    dc: +       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    dc:     + CategoryInfo          : ObjectNotFound: (c:\vagrant\scripts\install-bginfo.ps1:String) [],
    dc:    CommandNotFoundException
    dc:     + FullyQualifiedErrorId : CommandNotFoundException
    dc:
    dc: [09:16] My hostname is DC
    dc: . : The term 'c:\vagrant\scripts\create-domain.ps1' is not recognized as the name of a cmdlet,
    dc: function, script file, or operable program. Check the spelling of the name, or if a path was
    dc: included, verify that the path is correct and try again.
    dc: At C:\tmp\vagrant-shell.ps1:59 char:7
    dc: +     . c:\vagrant\scripts\create-domain.ps1 192.168.56.102
    dc: +       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    dc:     + CategoryInfo          : ObjectNotFound: (c:\vagrant\scripts\create-domain.ps1:String) [], C
    dc:    ommandNotFoundException
    dc:     + FullyQualifiedErrorId : CommandNotFoundException
    dc:
    dc:
    dc:
The following WinRM command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

powershell -ExecutionPolicy Bypass -OutputFormat Text -file "C:\tmp\vagrant-shell.ps1"

Stdout from the command:

[09:16] Setting timezone to UTC...
[09:16] Checking if Windows evaluation is expiring soon or expired...
[09:16] Disabling the Invoke-WebRequest download progress bar globally for speed improvements.
[09:16] See https://github.com/PowerShell/PowerShell/issues/2138 for more info
Unable to connect to ping.detectionlab.network
[09:16] Disabling IPv6 on all network adatpers...

Name                           DisplayName                                        ComponentID
----                           -----------                                        -----------
Ethernet1                      Internet Protocol Version 6 (TCP/IPv6)             ms_tcpip6
Ethernet0 2                    Internet Protocol Version 6 (TCP/IPv6)             ms_tcpip6
The operation completed successfully.

[09:16] Current domain is set to 'workgroup'. Time to join the domain!
[09:16] Installing bginfo...
[09:16] My hostname is DC

Stderr from the command:

powershell.exe : . : The term 'c:\vagrant\scripts\fix-windows-expiration.ps1' is not recognized as the name of a
    + CategoryInfo          : NotSpecified: (. : The term 'c... the name of a :String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At C:\tmp\vagrant-shell.ps1:12 char:3
+ . c:\vagrant\scripts\fix-windows-expiration.ps1
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (c:\vagrant\scri...-expiration.ps1:String) [], Comm
   andNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

. : The term 'c:\vagrant\scripts\install-bginfo.ps1' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At C:\tmp\vagrant-shell.ps1:49 char:7
+     . c:\vagrant\scripts\install-bginfo.ps1
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (c:\vagrant\scripts\install-bginfo.ps1:String) [],
   CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

. : The term 'c:\vagrant\scripts\create-domain.ps1' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At C:\tmp\vagrant-shell.ps1:59 char:7
+     . c:\vagrant\scripts\create-domain.ps1 192.168.56.102
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (c:\vagrant\scripts\create-domain.ps1:String) [], C
   ommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS D:\Detection Lab\Vagrant>
clong commented 1 year ago

Oh, wow, yeah, derp, shared folders are required 🤦🏻‍♂️

Well, unfortunately it's back to the race condition outlined here: https://github.com/clong/DetectionLab/issues/720#issuecomment-945208625

clong commented 1 year ago

Closing as this is tracked in #720