[Solved] Disk Image File Not Accessible

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
robtheslob
Posts: 5
Joined: 20. Jun 2017, 21:40

[Solved] Disk Image File Not Accessible

Post by robtheslob »

Hello,

This is the my first post. I've read the rules, but let me know if I fail to provide enough information to get help. I've tried searching, but that did not result in a solution for me.

I'm running VirtualBox 5.1.22 on a Mid 2012 Macbook Air (macOS Sierra, 10.12.5). Guest is Windows 10. Everything was working great until one day, I start up VirtualBox and see this error message:

Code: Select all

One or more disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.
Press Check to open the Virtual Media Manager window and see which files are inaccessible, or press Ignore to ignore this message.
When I select "Check," I'm brought to a window that identifies the hard disk as problematic; I suppose for some reason, this vmdk file is inaccessible.

If I attempt to boot anyway, I see the following error message:

Code: Select all

Failed to open a session for the virtual machine Winders10.
When I expand "Details," I see:

Code: Select all

Failed to open a session for the virtual machine Winders10.
Could not open the medium '/Users/rapmaster/win10raw.vmdk'.

VD: error VERR_ACCESS_DENIED opening image file '/Users/rapmaster/win10raw.vmdk' (VERR_ACCESS_DENIED).

Result Code: NS_ERROR_FAILURE (0x80004005)
Component: MediumWrap
Interface: IMedium {4afe423b-43e0-e9d0-82e8-ceb307940dda}
After some searching in these forums and elsewhere, I decided to attempt some basic solutions: chmod -R 777 on the vmdk file, and disabling System Integrity Protection. Both of these attempts yielded no apparent change in behavior.

Anyone know what might be going on? Thanks!
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Disk Image File Not Accessible

Post by socratis »

How big is this '/Users/rapmaster/win10raw.vmdk' file? If it's a couple of KB, then it's a text file, in which case, please open it with a text editor and post its contents.

Do you have a Bootcamp partition?
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
robtheslob
Posts: 5
Joined: 20. Jun 2017, 21:40

Re: Disk Image File Not Accessible

Post by robtheslob »

socratis wrote:How big is this '/Users/rapmaster/win10raw.vmdk' file? If it's a couple of KB, then it's a text file, in which case, please open it with a text editor and post its contents.
Thank you for the response. It is 801 bytes, and the contents are posted below:

Code: Select all

# Disk DescriptorFile
version=1
CID=6c9d849b
parentCID=ffffffff
createType="partitionedDevice"

# Extent description
RW 40 FLAT "win10raw-pt.vmdk" 0
RW 409600 FLAT "/dev/disk0s1" 0
RW 828941472 ZERO 
RW 1269544 ZERO 
RW 1040 ZERO 
RW 146483200 FLAT "/dev/disk0s4" 0
RW 131 ZERO 
RW 33 FLAT "win10raw-pt.vmdk" 40

# The disk Data Base 
#DDB

ddb.virtualHWVersion = "4"
ddb.adapterType="ide"
ddb.geometry.cylinders="16383"
ddb.geometry.heads="16"
ddb.geometry.sectors="63"
ddb.uuid.image="471d6c41-0da1-49cf-abe7-9ac0156bcb25"
ddb.uuid.parent="00000000-0000-0000-0000-000000000000"
ddb.uuid.modification="9207848d-9b8a-4fa1-a04d-98b76a28c834"
ddb.uuid.parentmodification="00000000-0000-0000-0000-000000000000"
ddb.geometry.biosCylinders="1024"
ddb.geometry.biosHeads="255"
ddb.geometry.biosSectors="63"
socratis wrote:Do you have a Bootcamp partition?
Yes. I have a Windows 10 installation on a 75 GB partition. The is the Windows installation that I would like to use in VirtualBox.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Disk Image File Not Accessible

Post by mpack »

You understand that what you have there is a raw disk image, right? You are accessing host partitions "/dev/disk0s1" and "/dev/disk0s4". You should also also have a 40 sector file "win10raw-pt.vmdk" which I assume just provides the MBR, and a tail vmdk whose purpose may simply be to pad out the disk to a round number.

If this used to work, on this host, then perhaps the MBR file has been lost, or permissions on one or both partitions have changed - or the disk layout.

Hmm. I just noticed that the first and last extents in the VMDK both refer to the same file. I've never seen that before - strikes me as a bit whiffy. That means it should be at least 73 sectors, not 40.
robtheslob
Posts: 5
Joined: 20. Jun 2017, 21:40

Re: Disk Image File Not Accessible

Post by robtheslob »

mpack wrote:You understand that what you have there is a raw disk image, right? You are accessing host partitions "/dev/disk0s1" and "/dev/disk0s4". You should also also have a 40 sector file "win10raw-pt.vmdk" which I assume just provides the MBR, and a tail vmdk whose purpose may simply be to pad out the disk to a round number.
Thank you for your response. I do not know what the implications of this being a raw disk image are, but to a layman like myself, it sounds like what I want; I want to boot from the existing Windows 10 installation on one of my host machine's partitions. disk0s1 is the EFI partition, and disk0s4 is the Bootcamp partition. Does this sound correct?
mpack wrote:If this used to work, on this host, then perhaps the MBR file has been lost, or permissions on one or both partitions have changed - or the disk layout.
The file "win10raw-pt.vmdk" exists in the same directory as "win10raw.vmdk" (my home directory). I wasn't sure how to parse your comment here, so I've run chmod -R 777 on the file. The behavior has not changed. This file is much larger than "win10raw.vmdk", and opening it with a text editor did not appear to work very well. Nonetheless, I've pasted the text output below:

Code: Select all

3¿é–º|é¿éÿæ|øπ¸Û§PhÀ˚πΩæÄ~|ÖÉ≈‚ÒÕàVU∆F∆F¥Aª™UÕ]rÅ˚U™u	˜¡t˛Ff`Ä~t&fhfˇvhh|hh¥BäVãÙÕüɃûÎ∏ª|äVäväNänÕfas˛NuÄ~ÄÑä≤ÄÎÑU2‰äVÕ]ÎûÅ>˛}U™unˇvËçu˙∞—ÊdËÉ∞flÊ`Ë|∞ˇÊdËu˚∏ªÕf#¿u;fÅ˚TCPAu2Å˘r,fhªfhfhfSfSfUfhfh|fahÕZ2ˆÍ|Õ†∑Ά∂Άµ2‰ã¨<t	ª¥ÕÎÚÙν+…‰dÎ$‡¯$√Invalid partition tableError loading operating systemMissing operating systemc{ö0R
˛ˇˇÓ˛ˇˇ'@˛ˇˇØ˛ˇˇ(@†§h1˛ˇˇ´˛ˇˇ»‰n1(_IJˇˇ˛ˇˇHÇ1(ªU™EFI PART\”Èb£p=:"Çp=:ı◊ë±èBè=™i’÷ÄÄôÜ´(s*¡¯“∫K†…>…;ĴุÁíCé)~§hÒ('@EFI System PartitionSFH™™0eCϨÑ1ΩÙ∏rEé˝æßu(@«‰n1Macintosh HDtooB™™0eCϨ¿»“ÛvOãfiá›VüX«»‰n1ÔCÇ1Recovery HD¢†–ÎÂπ3Dá¿h∂∑&ô«‡˜Ê•˝BÖlˇÌ++_HÇ1ˇo=:BOOTCAMP(s*¡¯“∫K†…>…;ĴุÁíCé)~§hÒ('@EFI System PartitionSFH™™0eCϨÑ1ΩÙ∏rEé˝æßu(@«‰n1Macintosh HDtooB™™0eCϨ¿»“ÛvOãfiá›VüX«»‰n1ÔCÇ1Recovery HD¢†–ÎÂπ3Dá¿h∂∑&ô«‡˜Ê•˝BÖlˇÌ++_HÇ1ˇo=:BOOTCAMPEFI PART\ÒI◊Z£p=:"Çp=:ı◊ë±èBè=™i’÷Ép=:ÄÄôÜ´
mpack wrote:Hmm. I just noticed that the first and last extents in the VMDK both refer to the same file. I've never seen that before - strikes me as a bit whiffy. That means it should be at least 73 sectors, not 40.
Again, I am not sure how to parse this. What steps should I take, considering this observation? Perhaps it's worth noting that I did very little legwork to get VirtualBox to work in the way I desire; moving through the GUI setup process worked flawlessly. This sudden change in behavior did not appear to occur after any major updates in the OS or in VirtualBox. Unfortunately, I have no conception of the troubleshooting flow for this software. If there is something I can provide that will help in this process, please let me know.
ChipMcK
Volunteer
Posts: 1095
Joined: 20. May 2009, 02:17
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Windows, OSX
Location: U S of A

Re: Disk Image File Not Accessible

Post by ChipMcK »

robtheslob
Posts: 5
Joined: 20. Jun 2017, 21:40

Re: Disk Image File Not Accessible

Post by robtheslob »

ChipMcK wrote:take look at this tutorial How to Use a MacOS Bootcamp Partition as a VirtualBox Guest
Thank you for your reply. My issue has been resolved, and I will post my solution here for posterity. It appears that I forgot a simple step before starting VirtualBox. I really don't recall ever doing it, but I must have, as everything works now. ChipMcK's answer lead me down a rabbit hole of hyperlinks until I stumbled upon this page, which is the resource I used to setup VirtualBox in the first place.

I remembered to unmount the Bootcamp partition, but I forgot to set the proper permissions on the partitions of interest. People visiting this page to resolve problems should click on the URL that I provided, but the relevant commands to run before firing up VirtualBox are:

Code: Select all

diskutil unmount /Volumes/BOOTCAMP

sudo chmod 777 /dev/disk0s1

sudo chmod 777 /dev/disk0s4
...assuming disk0s1 is your EFI partition, and disk0s4 is your Bootcamp partition. Run "diskutil list" to determine which is which for you. This information is also provided somewhere on the page linked by ChipMck, although it's just a bit more buried.

Thank you to all who took the time to post a reply.
Last edited by robtheslob on 23. Jun 2017, 21:09, edited 1 time in total.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Disk Image File Not Accessible

Post by mpack »

I could respond to some of the questions you had about the troubleshooting process, but there appears to be no need, since you've already solved the problem. Well done by the way. So it was a permissions problem, pretty much as indicated early on. The only trick was to observe that this was a raw disk scenario and therefore that the permissions problem was with access to the partitions, and not a permission problem with the .vmdk descriptor file.
robtheslob
Posts: 5
Joined: 20. Jun 2017, 21:40

Re: Disk Image File Not Accessible

Post by robtheslob »

mpack wrote:I could respond to some of the questions you had about the troubleshooting process, but there appears to be no need, since you've already solved the problem. Well done by the way. So it was a permissions problem, pretty much as indicated early on. The only trick was to observe that this was a raw disk scenario and therefore that the permissions problem was with access to the partitions, and not a permission problem with the .vmdk descriptor file.
Agreed. As you said, part of the issue is that the error about permissions seemed to suggest that the .vmdk descriptor file was the problem, but that was not the case. If I knew a bit more about the troubleshooting process (or VirtualBox in general), then perhaps this would have been more obvious, as you implied.

The other part of the issue, of course, was that I forgot about steps I took before I launched VirtualBox in the past. In order to avoid forgetting them again (and to make the use of VirtualBox more convenient) I wrote some AppleScript that takes care of all of the preliminary steps before booting Windows 10; it is very similar to the script that can be found using the URL that ChipMck provided. I think it might be useful for others to see the script, so here it is:

Code: Select all

do shell script "sudo chmod 777 /dev/disk0s1;sudo chmod 777 /dev/disk0s4" with administrator privileges

tell application "Finder"
	
	if exists "BOOTCAMP" then
		
		-- Eject BOOTCAMP volume if mounted
		
		do shell script "sudo unmount -f /Volumes/Bootcamp"
		
	end if
	
end tell

-- Launch virtual machine

do shell script "/usr/local/bin/VBoxManage startvm Win10" -- Use your VM name here!
Note that there may be a more elegant solution for allowing the user to enter their password; I opted for running the sudo commands using a shell with administrator privileges. If someone has a better suggestion (that could perhaps make use of the Keychain) then I'd love to hear it. Otherwise, this appears to work quite well for me.
Martin
Volunteer
Posts: 2561
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: [Solved] Disk Image File Not Accessible

Post by Martin »

'chmod 777' is not a very safe way to get access to the disks as it opens the full access rights to everyone.
A cleaner way would be adding your user account to the group owning the disk devices (operator? I don't knw Macs...) and enabling write access for the group with 'chmod g+w'
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: [Solved] Disk Image File Not Accessible

Post by socratis »

Martin wrote:'chmod 777' is not a very safe way to get access to the disks as it opens the full access rights to everyone.
Remember, you're talking about raw disk access. The permissions are the least of your problems...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Martin
Volunteer
Posts: 2561
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: [Solved] Disk Image File Not Accessible

Post by Martin »

Well, you need to get access to the partitions as the first step. ;)
What you do after that to destroy your data on the disk is another step... :twisted:
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: [Solved] Disk Image File Not Accessible

Post by socratis »

Martin wrote:destroy your data on the disk is another step...
:lol:

Reminds me of that old Apple iMac commercial:
  • Step 1: Get permissions right.
    Step 2: Destroy your disk.
    Step 3: Ha!... there's no step 3...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply