boxcutter / windows

Virtual machine templates for Windows written in legacy JSON and Batch Scripting/JScript
Apache License 2.0
753 stars 266 forks source link

Windows 10 eval is failing to find disk to install to on Parallels #244

Closed dragon788 closed 3 years ago

dragon788 commented 3 years ago
make parallels/eval-win10x64-enterprise

Screen Shot 2020-07-10 at 12 23 40 PM

I verified that the Virtualbox build using the same template file and Autounattend appears to be working.

make virtualbox/eval-win10x64-enterprise

I noticed it had guest_os_type set to win-8.1 while another Packer template I've used with Parallels has win-10, but I would be surprised if that is the root cause of the failure.

I tried upgrading to the latest Packer (1.6.0), but then I was getting warnings about some outdated entries in the JSON file that they don't want/use anymore.

I'm trying out some things to narrow down the issue, but I wasn't sure if somebody had already solved this and I just missed it in an open pull request or somebody's fork.

dragon788 commented 3 years ago

To fix all the templates quickly I ran these two commands after I had updated to Packer 1.6.0.

for template in *.json; do packer fix $template > fixed-$template; done

for template in fixed*.json; do mv $template ${template/fixed-}; done

While reviewing the git diff it showed that it reordered the elements alphabetically but other than that it only removed the iso_checksum_type so I reset and ran sed -i'' -e '/iso_checksum_type/d' *.json which removes the entire line containing that string from all the templates and then Packer was happy again without having to make a huge diff due to the reordering.

dragon788 commented 3 years ago

The one downside of the above "fix" is that it appears maybe Packer internally hashes the url+checksum+checksum type and removing checksum_type lead to it downloading the ISO again even though it already had an identical one that used the exact same checksum sitting in the packer_cache directory, so I'll be filing a bug over there.

dragon788 commented 3 years ago

I had a lot of theories on what could be causing the issue, but it seemed like it might be related to the disk layout that only creates a single partition and didn't leave room for an EFI partition. I believe Parallels defaults to EFI for newer operating systems (in versions of Parallels Desktop >10 at least) while Virtualbox might still assume "legacy" MBR first, but just changing the partition layout didn't fix things.

Eventually I found this in another repo and it fixed the issue I was having with the templates here and Parallels.

      "prlctl": [
        [
          "set",
          "{{.Name}}",
          "--efi-boot",
          "off"
        ]
      ],

Then of course I found several mentions online of using that to fix various attachment/build issues with Parallels + Packer.

https://github.com/joefitzgerald/packer-windows/issues/105#issuecomment-441579558

arizvisa commented 3 years ago

Thanks a lot for your contribution btw.

As I primarily use vmware and don't have access to the osx platform, I literally have no idea what's going on with the parallels flavors of the templates and thus am forced to fix them blindly. (The original maintainers dropped support of this repo for another one).

dragon788 commented 3 years ago

I'm torn between the boxcutter templates that have been really useful for quite a while and the chef/bento repo which I think gets more eyes and has a stronger corporate backing plus it gets a lot more testing because their boxes are used to test their software as well.

tas50 commented 3 years ago

The bento boxes get built pretty frequently, but the scope is a lot more narrow than these boxes. Signed: bento maintainer.

arizvisa commented 3 years ago

I personally use a combination this repo for windows boxes (which is why I offered to help maintain this as I use scripts to de-vagrantify these), and then chef-bento for everything else.

The only reason why I don't use chef-bento's Windows templates is because I'm in infosec and having support for the older Windows platforms is pretty important.

arizvisa commented 3 years ago

@dragon788, instead of using sed, you should consider checking out jq (https://stedolan.github.io/jq/) it's pretty much xslt but for json.

Once you get the hang of its "language", doing mass changes on json templates whilst still preserving the order is pretty simple. (I use it for doing mass changes on these templates so that I can preserve the order, this way whenever I need to rebase the changes in my fork it's less miserable).

Nonetheless, feel free to request features though, as I'll try to get to them when I can. But yeah, I'm kind of like a one-man team over here.

dragon788 commented 3 years ago

I definitely like jq and there is another one that acts more like the AWS JSON filtering, but for this quick removal I didn't need to look up the syntax for sed where I would have for jq, and the ordering issue actually was caused by letting Packer try to fix it which was sad but not surprising because maintaining order is only important to humans looking at diffs, JSON doesn't care.

What would be really slick is a jsondiff tool or something that ignored order as long as items had the same hierarchy. This could be useful for xml/json/yaml/toml maybe.

There is a new one called rq I came across that looks really interesting as well.