hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
15.06k stars 3.32k forks source link

Packer hangs at windows installation after changing the iso of the repo #6602

Closed AymanRbati closed 6 years ago

AymanRbati commented 6 years ago

I changed the windows 10 iso of the packer repository https://github.com/clong/DetectionLab to an older version : _en_windows_10_pro_10240_x64dvd and the windows installation hangs at the first step of choosing the language (because i need a release a 2015 release of windows 10 in packer or vagrant)

Here is my packer.json

{
  "builders": 
  {
    "type": "virtualbox-iso",
    "communicator": "winrm",
    "disk_size": 61440,
    "guest_os_type": "Windows10_64",
    "headless": true,
    "iso_checksum": "ECAE7684BC1E6F6A4B44B9116E9AC596",
    "iso_checksum_type": "md5",
    "iso_url": "iso/en_windows_10_pro_10240_x64_dvd.iso",
    "winrm_username": "vagrant",
    "winrm_password": "vagrant",
    "winrm_timeout": "6h",
    "winrm_insecure": true,
    "hard_drive_interface": "sata",
    "iso_interface": "sata",
    "guest_additions_mode": "upload",
    "guest_additions_path": "c:/Windows/Temp/windows.iso",
    "vboxmanage": [
        [
          "modifyvm",
          "{{.Name}}",
          "--memory",
          "3048"
        ],
        [
          "modifyvm",
          "{{.Name}}",
          "--cpus",
          "3"
        ],
    [
      "modifyvm",
      "{{.Name}}",
      "--vram",
      "32"
    ]
      ]
    }
  ],
  "provisioners": [
  {
    "type": "powershell",
    "scripts": [
      "install-guest-tools.ps1",
      "enable-rdp.ps1",
      "disable-hibernate.ps1",
      "disable-autologin.ps1",
      "enable-uac.ps1",
      "no-expiration.ps1"
    ]},
  {
    "type": "windows-restart",
    "restart_command": "powershell \"& {(Get-WmiObject win32_operatingsystem).LastBootUpTime > C:\\ProgramData\\lastboot.txt; Restart-Computer -force}\"",
    "restart_check_command": "powershell -command \"& {if ((get-content C:\\ProgramData\\lastboot.txt) -eq (Get-WmiObject win32_operatingsystem).LastBootUpTime) {Write-Output 'Sleeping for 600 seconds to wait for reboot'; start-sleep 600} else {Write-Output 'Reboot complete'}}\""
  }

],

 "post-processors": [
    {
      "type": "vagrant",
      "keep_input_artifact": false,
      "output": "{{.Provider}}_windows-10.box",
      "vagrantfile_template": "vagrantfile.template"
    }
  ]
}

and Autounattend.xml :

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="specialize">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <ComputerName>vagrant-win10</ComputerName>
            <RegisteredOrganization>Microsoft</RegisteredOrganization>
            <TimeZone>Pacific Standard Time</TimeZone>
        </component>
        <component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <SkipAutoActivation>true</SkipAutoActivation>
        </component>
    </settings>
    <settings pass="windowsPE">
        <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <ImageInstall>
                <OSImage>
                    <InstallTo>
                        <DiskID>0</DiskID>
                        <PartitionID>1</PartitionID>
                    </InstallTo>
                    <WillShowUI>OnError</WillShowUI>
                    <InstallToAvailablePartition>false</InstallToAvailablePartition>
                </OSImage>
            </ImageInstall>
            <UserData>
                <AcceptEula>true</AcceptEula>
                <FullName>Vagrant Administrator</FullName>
                <Organization>Vagrant Inc.</Organization>
            </UserData>
            <DiskConfiguration>
                <Disk wcm:action="add">
                    <CreatePartitions>
                        <CreatePartition wcm:action="add">
                            <Order>1</Order>
                            <Type>Primary</Type>
                            <Extend>true</Extend>
                        </CreatePartition>
                    </CreatePartitions>
                    <ModifyPartitions>
                        <ModifyPartition wcm:action="add">
                            <Active>true</Active>
                            <Extend>false</Extend>
                            <Format>NTFS</Format>
                            <Label></Label>
                            <Letter>C</Letter>
                            <Order>1</Order>
                            <PartitionID>1</PartitionID>
                        </ModifyPartition>
                    </ModifyPartitions>
                    <DiskID>0</DiskID>
                    <WillWipeDisk>true</WillWipeDisk>
                </Disk>
                <WillShowUI>OnError</WillShowUI>
            </DiskConfiguration>
        </component>
        <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <InputLocale>en-US</InputLocale>
            <SystemLocale>en-US</SystemLocale>
            <UILanguage>en-US</UILanguage>
            <UserLocale>en-US</UserLocale>
        </component>
    </settings>
    <settings pass="oobeSystem">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <UserAccounts>
                <LocalAccounts>
                    <LocalAccount wcm:action="add">
                        <Password>
                            <Value>dgBhAGcAcgBhAG4AdABQAGEAcwBzAHcAbwByAGQA</Value>
                            <PlainText>false</PlainText>
                        </Password>
                        <Description>Vagrant User</Description>
                        <DisplayName>vagrant</DisplayName>
                        <Group>Administrators</Group>
                        <Name>vagrant</Name>
                    </LocalAccount>
                </LocalAccounts>
            </UserAccounts>
            <AutoLogon>
                <Password>
                    <Value>dgBhAGcAcgBhAG4AdABQAGEAcwBzAHcAbwByAGQA</Value>
                    <PlainText>false</PlainText>
                </Password>
                <Enabled>true</Enabled>
                <Username>vagrant</Username>
            </AutoLogon>
            <OOBE>
                <ProtectYourPC>1</ProtectYourPC>
            </OOBE>
            <FirstLogonCommands>
                <SynchronousCommand wcm:action="add">
                    <CommandLine>powershell -NoLogo -ExecutionPolicy RemoteSigned -File a:\update-windows.ps1</CommandLine>
                    <Description>Update Windows, and when finished, run configure-winrm.ps1 to turn WinRM on so this party can get started</Description>
                    <Order>1</Order>
                </SynchronousCommand>
            </FirstLogonCommands>
        </component>
    </settings>
    <settings pass="offlineServicing">
        <component name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <EnableLUA>false</EnableLUA>
        </component>
    </settings>
    <cpi:offlineImage cpi:source="wim:c:/users/lucius/desktop/extracted/sources/install.wim#Windows 10 Enterprise Evaluation" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>
SwampDragons commented 6 years ago

Thanks for opening an issue! Unfortunately, this sounds like an issue with your answer file, not with Packer. If you need help getting your build working with an old iso, I'd suggest reaching out to the folks at DetectionLab, or looking around online for an answer file that matches your iso. Or, you can reach out to the Packer mailing list (https://groups.google.com/d/forum/packer-tool) to see if anyone's gotten Packer builds working with your specific iso. We try to keep the github issues open for bugs or feature requests, not support requests, so I'm going to close this. Thanks!

AymanRbati commented 6 years ago

Understood, thanks

Le ven. 17 août 2018 à 23:39, Megan Marsh notifications@github.com a écrit :

Closed #6602 https://github.com/hashicorp/packer/issues/6602.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hashicorp/packer/issues/6602#event-1795680142, or mute the thread https://github.com/notifications/unsubscribe-auth/AU8It-i4KpT2s6e8c997gUtG8dHMD1dVks5uR0YMgaJpZM4WCR0J .

ghost commented 4 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.