KhaosT / MacVM

macOS VM for Apple Silicon using Virtualization API
Apache License 2.0
1.31k stars 95 forks source link

Resource temporarily unavailable (35) #23

Closed nodeGarden closed 2 years ago

nodeGarden commented 2 years ago

I am receiving the following message inside XCode when I try to open the .macosxvm file:

2022-01-05 11:06:24.442236-0600 MacVM[61795:1484276] Error: Error Domain=VZErrorDomain Code=2 "A storage device configuration is invalid." UserInfo={NSLocalizedFailure=Invalid virtual machine configuration., NSLocalizedFailureReason=A storage device configuration is invalid., NSUnderlyingError=0x6000001c52f0 {Error Domain=VZErrorDomain Code=2 "The storage device attachment is invalid." UserInfo={NSLocalizedFailure=Invalid virtual machine configuration., NSLocalizedFailureReason=The storage device attachment is invalid.}}}
2022-01-05 11:06:26.513352-0600 MacVM[61795:1484276] [Document] Popover failed to show

Before that it was running fine until I needed to expand the drive size. I hadn't realized that maybe the right way to do it was to edit the metadata file, and instead I had tried the resize mentioned in one of the Issues on here. (https://github.com/KhaosT/MacVM/issues/19)

$ hdiutil resize -size 80g -imageonly disk.img
hdiutil: resize: failed. Resource temporarily unavailable (35)

I had shutdown the VM before that.

Essentially I can no longer use the VM, which unfortunately is my work "computer". :scream: Any thoughts on how to recover?

metadata file:

{
    "hardwareModelData": "YnBsaXN0MDDTAQIDBAUGXxAZRGF0YVJlcHJlc2VudGF0aW9uVmVyc2lvbl8QD1BsYXRmb3JtVmVyc2lvbl8QEk1pbmltdW1TdXBwb3J0ZWRPUxQAAAAAAAAAAAAAAAAAAAABEAKjBwgIEAwQAAgPKz1SY2VpawAAAAAAAAEBAAAAAAAAAAkAAAAAAAAAAAAAAAAAAABt",
    "cpuCount": 4,
    "identifier": "D94C024E-51B0-4DF8-82D3-F35F0DA84871",
    "machineIdentifierData": "YnBsaXN0MDDRAQJURUNJRBNuPkK7jq7GlQgLEAAAAAAAAAEBAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAZ",
    "diskSize": 32,
    "installed": true,
    "memorySize": 17179869184,
    "audio": true
}

I'd like to change the size to 80GB

----- Additional Info -----

$ hdiutil resize -size 80g -imageonly disk.img -verbose
DIBackingStoreInstantiatorProbe: interface  0, score      100, CBSDBackingStore
DIBackingStoreInstantiatorProbe: interface  1, score    -1000, CBundleBackingStore
DIBackingStoreInstantiatorProbe: interface  2, score    -1000, CRAMBackingStore
DIBackingStoreInstantiatorProbe: interface  3, score    -1000, CDevBackingStore
DIBackingStoreInstantiatorProbe: interface  4, score    -1000, CCURLBackingStore
DIBackingStoreInstantiatorProbe: interface  5, score    -1000, CVectoredBackingStore
hdiutil: resize: failed. Resource temporarily unavailable (35)
KhaosT commented 2 years ago

Huh I think the image is broken and I'm not sure how to fix that after a failed resize operation...

nodeGarden commented 2 years ago

Just added the -verbose log, but nothing is coming up when searching for that

John-K commented 2 years ago

Have you tried changing disksize: 32 to disksize: 80 in the metadata?

nodeGarden commented 2 years ago

Welp... I did nothing special other than tried the command 3 more times. On the 3rd try it said:

$ hdiutil resize -size 80g -imageonly disk.img -verbose
DIBackingStoreInstantiatorProbe: interface  0, score      100, CBSDBackingStore
DIBackingStoreInstantiatorProbe: interface  1, score    -1000, CBundleBackingStore
DIBackingStoreInstantiatorProbe: interface  2, score    -1000, CRAMBackingStore
DIBackingStoreInstantiatorProbe: interface  3, score    -1000, CDevBackingStore
DIBackingStoreInstantiatorProbe: interface  4, score    -1000, CCURLBackingStore
DIBackingStoreInstantiatorProbe: interface  5, score    -1000, CVectoredBackingStore
DIFileEncodingInstantiatorProbe: interface  0, score    -1000, CEncryptedEncoding
DIFileEncodingInstantiatorProbe: interface  0, score    -1000, CUDIFEncoding
DIFileEncodingInstantiatorProbe: interface  0, score    -1000, CSegmentedUDIFEncoding
DIFileEncodingInstantiatorProbe: interface  1, score    -1000, CSegmentedUDIFRawEncoding
DIDiskImageInstantiatorProbe: interface  0, score    -1000, CUDIFDiskImage
DIDiskImageInstantiatorProbe: interface  1, score        0, CSparseBundleDiskImage
DIDiskImageInstantiatorProbe: interface  2, score        0, CSparseDiskImage
nx_mount:1462:  reloading after unclean unmount, checkpoint xid 42, superblock xid 41
nx_mount:1462:  reloading after unclean unmount, checkpoint xid 42, superblock xid 41
nx_mount:1462:  reloading after unclean unmount, checkpoint xid 42, superblock xid 41
nx_mount:1462:  reloading after unclean unmount, checkpoint xid 42, superblock xid 41
DIDiskImageInstantiatorProbe: interface  3, score      100, CRawDiskImage
DIDiskImageInstantiatorProbe: interface  5, score     -100, CShadowedDiskImage
DIDiskImageInstantiatorProbe: interface  6, score     -100, CWrappedDiskImage
DIDiskImageNewWithBackingStore: CRawDiskImage
DIDiskImageNewWithBackingStore: instantiator returned 0
hdiutil: resize: completed successfully

I had just assumed I would start over, so no risk to try again.

~/Documents/mac.macosvm ⌚ 16:07:32
$ ll
total 49125800
-rw-------@ 1 mondo  staff    32M Jan  5 15:38 aux.img
-rw-r--r--@ 1 mondo  staff    80G Jan  5 16:07 disk.img
-rw-r--r--@ 1 mondo  staff   514B Jan  5 11:05 metadata

I then went and changed the metadata file to be set to 80GB, and started VM. But inside the VM it still says 30GB.

nodeGarden commented 2 years ago

I am seeing the following with diskutil list:

 % diskutil list
/dev/disk0 (internal):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         85.9 GB    disk0
   1:             Apple_APFS_ISC                         524.3 MB   disk0s1
   2:                 Apple_APFS Container disk3         28.5 GB    disk0s2
   3:        Apple_APFS_Recovery                         5.4 GB     disk0s3
                    (free space)                         51.5 GB    -

/dev/disk3 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +28.5 GB    disk3
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            15.7 GB    disk3s1
   2:              APFS Snapshot com.apple.os.update-... 15.7 GB    disk3s1s1
   3:                APFS Volume Preboot                 132.9 MB   disk3s2
   4:                APFS Volume Recovery                848.0 MB   disk3s3
   5:                APFS Volume Data                    6.9 GB     disk3s5
   6:                APFS Volume VM                      20.5 KB    disk3s6

I tried the sudo diskutil resizeContainer apfs /dev/disk0s2 ___ but it won't accept anything over 28g

nodeGarden commented 2 years ago

Tried a bunch of things and gave up. I just started a new image. Hope someone else has better luck if starting again is not option