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

make guest tools last so pre-reqs are in place #358

Merged
merged 1 commit into from Jan 18, 2019

Conversation

jmartin-tech
Copy link
Contributor

fixes #216

VMware tools requires the vcredist2008 installed and a reboot occur before installation on windows 2008r2. This moves guest tools to install last just before cleanup.

Thanks to @jschulist for the report and @usmcfiredog for the additional validation that this issue persists.

@usmcfiredog
Copy link
Contributor

This still didn't work for me. I didn't even see the Vmware tools folder in C:\windows\temp folder either. I will keep looking into this and try to report back some more useful information

@usmcfiredog
Copy link
Contributor

So I moved up the vm tools to the top of the section where you had it. It is not sensing that it was a Vmware install and doesn't go to the command to install. Bellow is the output for the vm tools bat.

==> vmware-iso: Provisioning with shell script: /Users/nicholaskasprinski/Documents/metasploitable3-vmt/metasploitable3/packer/templates/../../scripts/installs/vm-guest-tools.bat
vmware-iso:
vmware-iso: C:\Users\vagrant>if not exist "C:\Windows\Temp\7zInstaller-x64.msi" (powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z1604-x64.msi', 'C:\Windows\Temp\7zInstaller-x64.msi')" 0<NUL )
vmware-iso:
vmware-iso: C:\Users\vagrant>msiexec /qb /i C:\Windows\Temp\7zInstaller-x64.msi
vmware-iso:
vmware-iso: C:\Users\vagrant>if "" EQU "vmware-iso" goto :vmware
vmware-iso:
vmware-iso: C:\Users\vagrant>if "" EQU "virtualbox-iso" goto :virtualbox
vmware-iso:
vmware-iso: C:\Users\vagrant>if "" EQU "parallels-iso" goto :parallels
vmware-iso:
vmware-iso: C:\Users\vagrant>goto :done
vmware-iso:
vmware-iso: C:\Users\vagrant>msiexec /qb /x C:\Windows\Temp\7zInstaller-x64.msi

@usmcfiredog
Copy link
Contributor

ok so I find that the bat file loses all formatting and in such doesn't execute properly.

@jmartin-tech
Copy link
Contributor Author

@usmcfiredog thanks for the recheck, looks like there may be a bug in packer as the ENV is not getting set as defined. Looking closer.

@usmcfiredog
Copy link
Contributor

@jmartin-r7 The other thing I did notice is that when I removed all of the conditionals and just had it for VMware the install seemed to just hang. When checking task manager it shows the setup running but not cpu usage or anything

@jmartin-tech
Copy link
Contributor Author

Looks like the env vars are not set by packer for window-shell in this instance, looking into why.

@usmcfiredog
Copy link
Contributor

still "freezing" up on the install of the vm tools. The vm is still functioning just the setup process isn't using any cpu or anything.

@usmcfiredog
Copy link
Contributor

I think it might be failing to install a runtime dll. When I ran the setup from the command line manually it states that the Microsoft Runtime DLL installer failed to complete installation.

@jmartin-tech
Copy link
Contributor Author

Now branch should address the hang during install, this was due to fusion supplying 10.3.x versions of vmware tools which required vcredist2017 and depends on a KB that is intentionally not applied to metasploitable3. See https://kb.vmware.com/s/article/55798

@usmcfiredog
Copy link
Contributor

Works good

* make guest tools last so pre-reqs are in place

Packer 1.3.x and possibly more does not inject enviornment
variables as expected into `windows-shell` provisioners, moving
script that requires these into a `shell` provisioner.

* do not trust default uploaded windows.iso

Packer in some cases will upload windows.iso from the host
building the VM, since server 2008 needs a specific older
version of tools this can cause problems.

Example issue:
VMware Fusion 11 on macOS Mojave will supply 10.3.x in windows.iso
and will hit https://kb.vmware.com/s/article/55798 due the patch level
expectaions that are intentionally not met for Windows 2008r2.
@jmartin-tech jmartin-tech merged commit a4ecd26 into rapid7:master Jan 18, 2019
@jmartin-tech jmartin-tech deleted the fix_vmware_tools branch January 18, 2019 03:35
usmcfiredog added a commit to usmcfiredog/metasploitable3 that referenced this pull request Sep 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VMware Tools fails to install
2 participants