chocolatey / boxstarter

Repeatable, reboot resilient windows environment installations made easy using Chocolatey packages
https://boxstarter.org/
Apache License 2.0
1.3k stars 162 forks source link

Error from Enable-BoxstarterVM: The VHD does not contain system volume #25

Closed justSteve closed 9 years ago

justSteve commented 10 years ago

Greets - brand new to the project as well as Hyper-V in general so I'll be the one making all the noob mistakes public. To wit:

Based on @mwrock's jumpstarter at https://matt-wrock.squarespace.com/?offset=1388363760000

New-VM -Name "myVM" -MemoryStartupBytes 1GB -NewVHDPath "v:\Virtual Hard Disks\w81.vhdx" -NewVHDSizeBytes 60GB
Set-VMDvdDrive -VMName myVM -Path "v:\en_windows_8.1_professional_n_vl_with_update_x64_dvd_4065208.iso"
Start-VM "myVM"

That gives me a functioning windows install. Next I'm wanting to add Chocolatey and BoxStarter. Again from jumpstarter code:

     $cred=Get-Credential BareOS\Steve
     Enable-BoxstarterVM -VMName myVM -Credential $cred

gets me output:

Boxstarter: Configuring local PowerShell Remoting settings...
Boxstarter: Testing remoting access on BareOS...
Boxstarter: Testing WSMAN...
Boxstarter: Testing WMI...
Boxstarter: Stopping myVM
Boxstarter: VHD Dismounted
The VHD does not contain system volume
At C:\[foo]\Boxstarter\Boxstarter.HyperV\Enable-BoxstarterVHD.ps1:78 char:17
+                 throw New-Object -TypeName InvalidOperationException -ArgumentLi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], InvalidOperationException
    + FullyQualifiedErrorId : The VHD does not contain system volume

Perhaps my problem is more Hyper-V related than Boxstarter but since I'm using script that is (implicitly) presented as 'the Boxstarter Way' I'm hoping to invoke to Chocolatey Gods' Goodness.

mwrock commented 10 years ago

That means it was not able to find the windows folder on that drive. Is that your only drive and do you have windows installed on it?

Sent from my Windows Phone


From: justStevemailto:notifications@github.com Sent: ‎10/‎11/‎2014 4:46 AM To: mwrock/boxstartermailto:boxstarter@noreply.github.com Cc: Matt Wrockmailto:matt@mattwrock.com Subject: [boxstarter] Error from Enable-BoxstarterVM: The VHD does not contain system volume (#25)

Greets - brand new to the project as well as Hyper-V in general so I'll be the one making all the noob mistakes public. To wit:

Based on @mwrock's jumpstarter at https://matt-wrock.squarespace.com/?offset=1388363760000

New-VM -Name "myVM" -MemoryStartupBytes 1GB -NewVHDPath "v:\Virtual Hard Disks\w81.vhdx" -NewVHDSizeBytes 60GB
Set-VMDvdDrive -VMName myVM -Path "v:\en_windows_8.1_professional_n_vl_with_update_x64_dvd_4065208.iso"
Start-VM "myVM"

That gives me a functioning windows install. Next I'm wanting to add Chocolatey and BoxStarter. Again from jumpstarter code:

     $cred=Get-Credential BareOS\Steve
     Enable-BoxstarterVM -VMName myVM -Credential $cred

gets me output:

Boxstarter: Configuring local PowerShell Remoting settings...
Boxstarter: Testing remoting access on BareOS...
Boxstarter: Testing WSMAN...
Boxstarter: Testing WMI...
Boxstarter: Stopping myVM
Boxstarter: VHD Dismounted
The VHD does not contain system volume
At C:\[foo]\Boxstarter\Boxstarter.HyperV\Enable-BoxstarterVHD.ps1:78 char:17
+                 throw New-Object -TypeName InvalidOperationException -ArgumentLi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], InvalidOperationException
    + FullyQualifiedErrorId : The VHD does not contain system volume

Perhaps my problem is more Hyper-V related than Boxstarter but since I'm using script that is (implicitly) presented as 'the Boxstarter Way' I'm hoping to invoke to Chocolatey Gods' Goodness.


Reply to this email directly or view it on GitHub: https://github.com/mwrock/boxstarter/issues/25

justSteve commented 9 years ago

Both host and guest are conventional installs - all OS-related paths would be unchanged. As a bit of possibly relevant background, this is error is another of _'this powershell cmtlet/syntax should work but isn't' problems I've been experiencing on my workstation. In fact, my intro to Boxstarter is precisely because because I'm re-paving the current install partly due to these sorts of problems.

Happy to keep troubleshooting anything that you think would benefit your project but otherwise I've worked around this particular problem.

thx

mwrock commented 9 years ago

What boxtarter does here is it finds the VHD assigned to the Hyper-V VM you are targeting. It then mounts that vhd locally (you could do this just by doiublclicking it in file explorer. Then it iterates the drive volumes in that VHD (usually there is just one) and finds the one that has a:

[drive letter]:\windows\system32\config

It would throw this error if it cant find that.

The fact the it cant find it definitely does indicate that something is likely fundamentally wrong.

Could you try mounting it and see if it lacks that directory? and we can take it from there?

justSteve commented 9 years ago

Sorry for that bit of delay - Double clicking the vhdx gets: Couldn't Mount File: The disk image isn't initialized... mmc

and the MMC: mountfile

It looks as though the jumpstarter code is creating the VHD but not formatting/initializing - (i mentioned that noob thing, right?)

thx

justSteve commented 9 years ago

swapped images

mwrock commented 9 years ago

Thanks. This actually explains the issues Boxstarter is having with this image. If you cant mount the disk in File Explorer, that means there is something fudamentally wrong with the disk. Boxstarter can only work with a functional vhd. Is the VM that this disk is attached to functional?

justSteve commented 9 years ago

all functions correctly so far but i haven't pushed it - I'm booting into it and have scaffolded it with a chocolatey package.

Looking back to re-running the jumpstarter code: ``` New-VM -Name "myVM" -MemoryStartupBytes 1GB -NewVHDPath "v:\foo.vhdx" -NewVHDSizeBytes 60GB ``` after re-running, at the os install, I was forced into the format/partition screen. Didn't see that first time (which would explain the disk state) - so noob lesson learned is 're-run the scripts - they don't get tired.'. OTOH, seems reasonable to expect to be able to script that reliably too. Checking back to your post: > You need to create an empty VHD file which represents a system with no OS installed. Wanted that so i mounted the dvd before executing the script (repeated). ``` New-VM -Name "myVM" -MemoryStartupBytes 1GB -NewVHDPath "D:\VHDs\w81.vhdx" -NewVHDSizeBytes 60GB Set-VMDvdDrive -VMName myVM -Path "C:\ISOs\EVAL_EN-US-IRM_CENA_X64FREE_EN-US_DV5.iso" Start-VM "myVM ``` perhaps an explicit vhd creation cmd with partitioning and formatting?
mwrock commented 9 years ago

Here's a snippet I use to create fresh VHDs for testing:

        $v = new-vhd -Path $testRoot\test.vhdx -SizeBytes 200MB | 
          Mount-VHD -PassThru | 
          Initialize-Disk -PartitionStyle mbr -Confirm:$false -PassThru | 
          New-Partition -UseMaximumSize -AssignDriveLetter -MbrType IFS | 
          Format-Volume -NewFileSystemLabel "VHD" -Confirm:$false

In fact this is taken from the unit tests of Enable-BoxstarterVM https://github.com/mwrock/boxstarter/blob/master/tests/HyperV/Enable-BoxstarterVHD.Tests.ps1

mwrock commented 9 years ago

I'm closing this since it appears to be an issue with the VM and not Boxstarter.