Packer: Failed to add device 'Virtual CD/DVD Disk'.

Created on 13 Apr 2019  ·  11Comments  ·  Source: hashicorp/packer

Hi Megan,

i tried your fix regarding keep_registered but I couldn't test it, since i receive the following error:

==> hyperv-iso: PowerShell error: Hyper-V\Add-VMDvdDrive : Failed to add device 'Virtual CD/DVD Disk'.
==> hyperv-iso: Hyper-V Virtual Machine Management service Account does not have permission to open attachment.
==> hyperv-iso: 'PCo_DEMO_VM' failed to add device 'Virtual CD/DVD Disk'. (Virtual machine ID A50D4FD5-3671-4EFF-952B-D22E5EBD1292)
==> hyperv-iso: 'PCo_DEMO_VM': Hyper-V Virtual Machine Management service account does not have permission required to open attachment

I didnt had this issue before packer 1.4 and your fix.

Thank you in advance.

Kind regards

buildehyperv regression windows-host

Most helpful comment

I think this may be fixed in https://github.com/hashicorp/packer/pull/7575.

Here's a windows binary; can any of you confirm whether the problem still exists with this build of the master branch?

packer.zip

All 11 comments

@azr I think this may be related to the go-getter changes in 1.4.0.

@iEpixel what happens if you delete and re-download the iso?

@SwampDragons The iso file is pre-downloaded. Also tried with a slightly different windows version, same result. Packer can locate the iso file, but it fails to continue due the reason mentioned in the first post.

Kind regards

Hey @iEpixel could you please share your buildfile and the full log ! I'll try to help you 🙂

One important part for me is the url used to download the iso file. As it worked fine for me.

FWIW, I think I am running into the same error as well. I have downloaded an ISO for Windows Server 2016 from MSDN, and I am attempting to use the hyperv-2016.json build file from https://github.com/mwrock/packer-templates (with a modification to use "memory" instead of "ram_size" in 1.4; additionally, I'm using a SHA1 checksum instead of MD5).

==> hyperv-iso: PowerShell error: Hyper-V\Add-VMDvdDrive : Failed to add device 'Virtual CD/DVD Disk'.
==> hyperv-iso: Hyper-V Virtual Machine Management service Account does not have permission to open attachment.
==> hyperv-iso: '2016min' failed to add device 'Virtual CD/DVD Disk'. (Virtual machine ID 812ABAB3-DDE2-4CAF-A245-4979577ADF05)
==> hyperv-iso: '2016min': Hyper-V Virtual Machine Management service account does not have permission required to open attachment
==> hyperv-iso: 'C:\Users\x\source\tools\packer-templates\packer_cache\0d3a9a599b4db0cb20818a557aea696d4823edbf.iso'. Error: 'General access denied error' (0x80070005). (Virtual machine ID
==> hyperv-iso: 812ABAB3-DDE2-4CAF-A245-4979577ADF05)
==> hyperv-iso: At C:\Users\x\AppData\Local\Temp\powershell482566646.ps1:3 char:18
==> hyperv-iso: + ... ontroller = Hyper-V\Add-VMDvdDrive -VMName $vmName -path $isoPath -Pa ...
==> hyperv-iso: +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
==> hyperv-iso:     + CategoryInfo          : PermissionDenied: (:) [Add-VMDvdDrive], VirtualizationException
==> hyperv-iso:     + FullyQualifiedErrorId : AccessDenied,Microsoft.HyperV.PowerShell.Commands.AddVMDvdDrive
==> hyperv-iso: Unregistering and deleting virtual machine...

I can work around my current issue with 1.3.5, so I'm not asking for anything in particular... Just wanted to pass along that someone else was affected by this. My employer would frown on me sharing complete logs in a public forum, but if there is anything in particular you would like me to look for in logs, I'm happy to. But, if that's too much trouble, I understand.

I think this may be fixed in https://github.com/hashicorp/packer/pull/7575.

Here's a windows binary; can any of you confirm whether the problem still exists with this build of the master branch?

packer.zip

Sorry for the delay. Unfortunately, I'm still getting the same access denied error with the attached version.

Just FYI, I'm currently on this one 🙂

@nwchandler what url are you using for the ISO ?

Okay, it works for me on windows 2016, and I'm still trying to repro.
In the meantime, can someone tell me if the windows binary from here fixes the issue ?

Otherwise I think I will need a full debug output and everything asked in the https://github.com/hashicorp/packer/blob/master/.github/ISSUE_TEMPLATE.md

Ideally, a simple repro case would be the best ! 🙂

EDIT: What are kind of rights (privilege) the building user has ?

I was finally able to create a repro case for this. It turns out that it's already fixed on the master branch, probably by the PR Adrien linked above. If you're in a big rush for a fix you can use the Packer nightly build until we release 1.4.1 tomorrow-ish :)

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brettswift picture brettswift  ·  3Comments

mushon4 picture mushon4  ·  3Comments

jesse-c picture jesse-c  ·  3Comments

sourav82 picture sourav82  ·  3Comments

mwhooker picture mwhooker  ·  3Comments