Closed MattLud closed 9 years ago
Hello. Thanks for the output logs. Next run, in addition to PACKER_LOG=1
would you also kick it off with WINRMCP_DEBUG=1
? You can see where we are doing the copy in winrmcp/cp.go.
Maybe a red herring, but I think it's interesting there's no complete path for the iso file, just its name, as illustrated in your output.
Sure - will rerun it soon. Thanks for all the work you are doing!
I believe this is related to #25. I experience it on virtualbox-windows-iso provisioning 2008R2. How is packer uploading the iso trough winrm? using multiple chunks? Maybe its related to the session limit.
Confirmed it was set....
G:\packer-windows-master>set snip NUMBER_OF_PROCESSORS=8 OS=Windows_NT PACKER_LOG=1 PACKER_LOG_PATH=G:\packer_log.txt snip WINRMCP_DEBUG=1
New logs - https://gist.github.com/Seakip18/b4d93436d107fa474405
New relevant debug lines - https://gist.github.com/Seakip18/b4d93436d107fa474405#file-packer_log-L248-L249
Thanks. It seems like there's a problem with this .vbox_version
file. Usually I should see a full path to the destination in the "Moving file from" message, as in this example:
$ echo "blah" > .blah_file
$ WINRMCP_DEBUG=1 bin/winrmcp ./.blah_file C:/Windows/Temp/.blah_file
2015/05/28 11:46:24 Copying file to $env:TEMP\winrmcp-55676280-479b-4af1-8d56-545f5acee7da.tmp
2015/05/28 11:46:24 Moving file from $env:TEMP\winrmcp-55676280-479b-4af1-8d56-545f5acee7da.tmp to C:\Windows\Temp\.blah_file
2015/05/28 11:46:25 Removing temporary file $env:TEMP\winrmcp-55676280-479b-4af1-8d56-545f5acee7da.tmp
The problem seems to be in this project and not in winrmcp
.
I was having a similar issue using the packer-windows Autounattend files for 2008 R2. I increased the maximum winrm connections and that seems to have helped me quite a bit, YMMV:
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c winrm set winrm/config/Service @{MaxConcurrentOperationsPerUser="1000"}</CommandLine>
<Description>Win RM Max Connections per User</Description>
<Order>6</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
In addition, I ended up increasing the MaxMemoryPerShellMB to 1000 as I sometimes received OOM messages from WinRM as well.
You will need to renumber your command order to accommodate it. It should be run before the winrm service is restarted.
I think I spoke a bit too soon. It seems like every time I think I've fixed something, something else takes its place. Does this sporadic behavior happen in other versions of Windows or just 2008R2? Mine works maybe 1/10 times; I just got lucky on the comment above.
It's a real challenge. I can reproduce the failure quite often now and even watch it happen in perfmon with 2008. I'd like to put a retry on it but winrm just flat out stops working correctly when in gets in this state. I haven't reproduced this in 2012.
As a workaround im installing using mount and a slight modification of an install script found on another git:
Powershell install:
function virtualbox {
# There needs to be Oracle CA (Certificate Authority) certificates installed in order
# to prevent user intervention popups which will undermine a silent installation.
& cmd /c certutil -addstore -f "TrustedPublisher" A:\oracle-cert.cer
#move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp
#& "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox
#& C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
& E:\VBoxWindowsAdditions.exe /S
}
Packer config:
"builders": [
{
"type": "virtualbox-windows-iso",
"vm_name": "{{user `W2K8SP1_BASE_NAME`}}",
"iso_url": "{{user `SOURCE_URL`}}/Windows Server/en_windows_server_2008_r2_standard_enterprise_datacenter_and_web_x64_dvd_x15-59754.iso",
"iso_checksum_type": "md5",
"iso_checksum": "0207EF392C60EFDDA92071B0559CA0F9",
"headless": false,
"boot_wait": "50s",
"guest_additions_mode": "attach",
"winrm_username": "vagrant",
"winrm_password": "vagrant",
"winrm_wait_timeout": "100m",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"guest_os_type": "Windows2008_64",
"disk_size": 61440,
"format": "ovf",
"floppy_files": [
"./answer_files/W2K8R2/Autounattend.xml",
"./scripts/init.bat",
"./scripts/oracle-cert.cer",
"./scripts/enable-winrm.ps1"
],
"output_directory": "{{user `OUTPUT_DIRECTORY`}}/{{user `W2K8SP1_BASE_NAME`}}",
"vboxmanage": [
[
"modifyvm", "{{.Name}}", "--memory", "2048"
],
[
"modifyvm", "{{.Name}}", "--cpus", "2"
]
]
}
],
@pecigonzalo, this was an IMMENSE help! I had no idea packer would let you attach the virtualbox iso as a drive.
Heres the magic line:
"guest_additions_mode": "attach",
Yes that is correct, i just wanted to give some context on how im doing it just in case.
Closing as duplicate of #25. Some great discussions on here though, nice one @pecigonzalo!
During machine setup, I've had the winrm fail to upload guest additions sporadically. Sometimes it'll work, other times not. I've seen this on both Server 2008r2 and Server 2012r2.
Gist to json and log: https://gist.github.com/Seakip18/38595ed4502a67f66a23