joefitzgerald / packer-windows

Windows Packer Templates
MIT License
1.63k stars 1.12k forks source link

windows 7 build using virtualbox provider hangs #141

Closed cplerch closed 8 years ago

cplerch commented 9 years ago

Tryed to build a Windows 7 system with the provided windows_7.json but the build hangs at the "Waiting for SSH to become available..." step forever. It looks like that the build never enters the unattended setup mode and keeps waiting for some keyboard/mouse input on the first setup screen, regardless if I set headless to true or false.

bigwave commented 9 years ago

What's the first setup screen asking about? I know that if you have invalid entries in the Autounattend.xml, I tried to change the timezone, and spelled it wrong and the installation paused asking for a timezone.

If you you need to review what happens before the hang, without having to sit glued to the screen you can record a video of the session by setting "headless": true, Add then ,[ "modifyvm", "{{.Name}}", "--vcpfile", "windows_7.webm" ] to the end of the "vboxmanage" section

You can then view it, I use VLC.

cplerch commented 9 years ago

The setup process already hangs at the very first setup screen: the langauge/localization settings and I didn't change anything in the autounattended.xml except the windows update section, which I have switched from WITH to WITHOUT updates (by moving the comment brackets). BTW: The very same setup works very well for windows_2008_r2_core.json

bigwave commented 9 years ago

Are you using the Windows 7 Enterprise trial download link in the script, or are you using your own ISO (possibly a non-US version)?

cplerch commented 9 years ago

I have used the one from the link, but I have downloaded it manually and modified the link to point to the local file (on Windows NTFS). I didn't change the ISO checksum and template validation is OK.

StefanScherer commented 9 years ago

I have started a build with a fresh clone from master branch and started packer build --only=virtualbox-iso windows_7.json - seems to do it. I only set the headless to false to watch its progress.

My Setup: MBP Yosemite 10.10.2, VirtualBox 4.3.22, packer 0.7.5, unaltered download link to trial ISO.

A halt on the first setup screen is normally a problem inside the autounattend.xml or a mismatch in the InstallFrom configuration.

So please check your XML file.

bigwave commented 9 years ago

And you don't need to download a copy and amend the link in the xml as packer caches the iso and reuses it.

cplerch commented 9 years ago

Didn't know about the --only switch; will try that next. Thanks!

On Mon, Feb 23, 2015 at 10:16 PM, Stefan Scherer notifications@github.com wrote:

I have started a build with a fresh clone from master branch and started packer build --only=virtualbox-iso windows_7.json - seems to do it. I only set the headless to false to watch its progress.

My Setup: MBP Yosemite 10.10.2, VirtualBox 4.3.22, packer 0.7.5, unaltered download link to trial ISO.

A halt on the first setup screen is normally a problem inside the autounattend.xml or a mismatch in the InstallFrom configuration.

So please check your XML file.

— Reply to this email directly or view it on GitHub https://github.com/joefitzgerald/packer-windows/issues/141#issuecomment-75635307 .

VaughanJ commented 9 years ago

I too am getting the same issue. I get it with windows 2012 r2 and windows 7 (not tried other images) When I watch the virtualbox boot up (headless = false) I can see that it gets as far as needing interaction with the box and nothing happens. Packer can't communicate. At no point have I adjusted the json file, other than to set headless = false. Have I missed an install step that allows SSH to work ? Do I need to install on my host machine an SSH server ? How can I get more debug information, as -debug isn't getting me to the root of the problem.

details : host - win 7 home premium sp1 virtualbox : 4.3.24-98716 packer : 0.75 Vargrant : 1.7.2

icnocop commented 9 years ago

Packer currently requires that an SSH server is installed and running in the guest OS (virtual machine).

Edit Autounattend.xml and comment out or add the command that installs OpenSSH. Make sure it's the last command and that the Order is correct.

VaughanJ commented 9 years ago

I think the problem has been solved. Patience and enabling the SSH in the answers file.

I have a feeling that I left the command line with waiting for ssh connection for 15 minutes and assumed no connection could be made and therefore it was doing nothing. Whereas it was probably running windows updates. I would then terminate the command line.

Once SSH was enabled, I set headless to be false and sat it out. The box eventually appeared after about 45 mins.

VaughanJ commented 9 years ago

A related question.

When I use my own MSDN ISO the very first screen is the language / keyboard selection. But the previous examples from this repo that are now working don't have this screen, they start straight into unpacking, installing, updates etc. Some point towards the end of this process the SSH server is installed.

If the SSH server is needed for communication, how can Packer instruct my first screen to select the correct language setup before any SSH server is installed ?

I ask this question,as when I try to use my own ISO of windows 2012 r2 with update ; https://msdn.microsoft.com/en-gb/subscriptions/downloads/#FileId=62611

It just hangs on the first screen. Command line says waiting for SSH and the screen doesn't progress on.

Does this mean I can only use ISO images that install with minimal interaction ?

icnocop commented 9 years ago

You have to include and specify the language settings in Autounattend.xml.

Have you included Autounattend.xml in floppy_files in your packer template?

kensykora commented 9 years ago

@VaughanJ If you're using your own ISO, you need to ensure the product key section of your Autounattend.xml file matches a valid product key that you were given from Microsoft. Otherwise, you will need to go through the process of entering a valid product key which is UI driven and doesn't allow the automation to proceed

In terms of the "how long do I wait" question -- it's easiest to monitor progress (especially useful with windows updates), turning the VM UI on during build will help you monitor it's progress. Windows updates can potentially take hours to complete. Builds like Windows 2008R2 I usually let run overnight

floradu88 commented 9 years ago

I've had the same issue, sometimes it is easier to reverse the order of the open ssh scripts to be installed first.

sneal commented 8 years ago

It appears the issue was a common complaint for new Packer-Windows users. Windows updates taking forever making users think the process has hung.

This will get better as the docs and process change.

floradu88 commented 8 years ago

This happened without windows updates event being enabled.

sneal commented 8 years ago

@floradu88 That's good to know. There's seems to be quite a few issues with the Win7 build hanging with varying reasons. I'm running a Win7 build myself now to see what happens.

floradu88 commented 8 years ago

@sneal will submit a pull request with the changes when I am done with it