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.09k stars 3.33k forks source link

Hyper-V: Virtual hard disk files must be uncompressed and unencrypted and must not be sparse. (0xC03A001A) #9922

Closed lovilak closed 3 years ago

lovilak commented 4 years ago

Hyper-V: Virtual hard disk files must be uncompressed and unencrypted and must not be sparse. (0xC03A001A)

With packer Hyperv-iso when i create a new VM which crash during the building with the above error.

Step to reproduce :

nywilken commented 4 years ago

Thanks for opening an issue -- In order for us to best help could you provide the things requested in the issue template; including the simplest Packer configuration and scripts needed to reproduce the bug.

Full debug log output from PACKER_LOG=1 packer build template.json. Please paste this in a gist https://gist.github.com The simplest complete example template and scripts needed to reproduce the bug. Include these in your gist https://gist.github.com

Is the host running with ReFS with a compressed disk? If compressed, if you try building from a volume that is not compressed does it work differently?

With that said, this error seems to becoming from Hyper-V and not Packer itself per-say. I found an old issue on Vagrant that might help https://github.com/hashicorp/vagrant/issues/11118. I also found an issue on technet https://social.technet.microsoft.com/Forums/en-US/757c76ba-a772-4dde-8baa-4db6de1016ce/vhd-must-be-uncompressed-and-unencrypted?forum=winserverhyperv

lovilak commented 4 years ago

With some logs : error: ==> hyperv-iso: Error starting vm: PowerShell error: Hyper-V\Start-VM : echec du demarrage de 'new_vm.mydomain'. ==> hyperv-iso: Synthetic SCSI Controller (ID d'instance D0026033-B374-463E-A646-032FD72EB9F2): echec de la mise sous tension avec ==> hyperv-iso: l'erreur Impossible d'effectuer l'operation demandee en raison d'une limitation du systeme de disque virtuel. Les ==> hyperv-iso: fichiers de disque dur virtuel doivent etre non compresses et non chiffres, et ne doivent pas etre fragmentes.¯. ==> hyperv-iso: Impossible d'ouvrir la connexion \\mydomain\share\win2016.iso en ==> hyperv-iso: raison de l'erreur suivante: Impossible d'effectuer l'operation demandee en raison d'une limitation du systeme de ==> hyperv-iso: disque virtuel. Les fichiers de disque dur virtuel doivent etre non compresses et non chiffres, et ne doivent pas etre ==> hyperv-iso: fragmentes.. ==> hyperv-iso: echec du demarrage de new_vm.mydomain¯. (ID d'ordinateur virtuel ==> hyperv-iso: 1FC0B495-AB11-4F7F-A49E-F54D19482DD8) ==> hyperv-iso: ®new_vm.mydomain¯ Synthetic SCSI Controller (ID d'instance ==> hyperv-iso: D0026033-B374-463E-A646-032FD72EB9F2): echec de la mise sous tension avec l'erreur ®Impossible d'effectuer l'operation ==> hyperv-iso: demand‚e en raison d'une limitation du systeme de disque virtuel. Les fichiers de disque dur virtuel doivent etre non ==> hyperv-iso: compress‚s et non chiffres, et ne doivent pas etre fragment‚s.¯ (0xC03A001A). (ID d'ordinateur virtuel ==> hyperv-iso: 1FC0B495-AB11-4F7F-A49E-F54D19482DD8) ==> hyperv-iso: new_vm.mydomain: impossible d'ouvrir la connexion ==> hyperv-iso: \\mydomain\share\win2016.iso en raison de l'erreur suivante: ==> hyperv-iso: Impossible d'effectuer l'operation demandee en raison d'une limitation du systeme de disque virtuel. Les fichiers de ==> hyperv-iso: disque dur virtuel doivent etre non compresses et non chiffres, et ne doivent pas etre fragment‚s. (0xC03A001A). (ID ==> hyperv-iso: d'ordinateur virtuel 1FC0B495-AB11-4F7F-A49E-F54D19482DD8)

I've other hosts in win2016 with Refs for storage and I dont have any trouble.

There is maybe a different config on this host that I dont know about. I Firstly thought it was about this https://helocheckblog.wordpress.com/2015/10/15/refs-disable-integrity-bit/ but its not : my files have no integrity flags enabled.

nywilken commented 4 years ago

Hi @lovilak thanks for the logs. I was hoping to see some addition Packer information that would hint at a Packer config related issue. But the provided logs, along with your comment about not having trouble on other host running running ReFS, seem to confirm that this is a hyper-v issue and not a Packer issue. So I'm not sure if I can reproduce without setting up similar environment.

I think checking for differences between the host is good way to go.

I recommend reaching out to the mailing list or community forum. Issues opened here on the Packer issue tracker are only viewed by a small handful of developers who work on the tool, and we don't always have the most depth or experience when it comes to custom issues with particular build configurations.

I'll keep this open for now in case someone else can provide some guidance. Cheers!

lovilak commented 4 years ago

Hello, After some new tests it seems that it wasn't a vhdx file disk file pb, but the \\mydomain\share\win2016.iso file which pass the cksum step but I noticed that the packer_cache folder is empty on nodes where I have failure and not empty where the build succeed. So There is maybe a missconf on my side that I havn't found yet, or an issue between packer and the network share.

nywilken commented 3 years ago

Hi there, @lovilak I'm going to close this issue, because it looks more like a Hyper-V bug than a Packer bug. If I've made a mistake and you have more evidence that this a Packer issue please reach out with the new details and we will gladly reopen.

ghost commented 3 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.