Page 1 of 1

[Edited] Raw Disk Access Problem on Windows 7

Posted: 21. Nov 2014, 07:39
by ww9rivers
For quite a while I have enjoyed running a guest Mint Linux virtual machine on a laptop that must run Windows 7: I pulled out the PC's SATA CD/DVD drive and put a second SSD in its place. To run a VM from a raw disk, VirtualBox has to be manually configured to do that and it must be run as Administrator in Windows.

All that was well, although not without a few kinks I consider minor, until this morning. All of a sudden, I got a dialog box from VirtualBox saying that it failed to start due to permission issues. Here is a list of the messages I've copied from the log file, which should read better than the small dialog box:

Code: Select all

00:00:01.774460 VDInit finished
00:00:01.775010 AIOMgr: Endpoint for file 'D:\MEMEME\vbox\mint.vmdk' (flags 00040723) created successfully
00:00:01.775716 AIOMgr: Endpoint for file 'D:\MEMEME\vbox\mint.vmdk' (flags 00040781) created successfully
00:00:01.775867 AIOMgr: Endpoint for file '\\.\PhysicalDrive1' (flags 000c0781) created successfully
00:00:01.775885 VMSetError: D:\tinderbox\win-4.3\src\VBox\Devices\Storage\DrvVD.cpp(3061) int __cdecl drvvdConstruct(struct PDMDRVINS *,struct CFGMNODE *,unsigned int); rc=VERR_VD_IMAGE_READ_ONLY
00:00:01.775911 VMSetError: Failed to open image 'D:\MEMEME\vbox\mint.vmdk' for writing due to wrong permissions
00:00:01.775923 VD: Opening the disk took 1593453 ns
00:00:01.776149 VMSetError: D:\tinderbox\win-4.3\src\VBox\Devices\Storage\DrvBlock.cpp(1077) int __cdecl drvblockConstruct(struct PDMDRVINS *,struct CFGMNODE *,unsigned int); rc=VERR_VD_IMAGE_READ_ONLY
00:00:01.776153 VMSetError: Failed to attach driver below us! Image is read-only.
00:00:01.776169 VMSetError: D:\tinderbox\win-4.3\src\VBox\Devices\Storage\DevAHCI.cpp(8450) int __cdecl ahciR3Construct(struct PDMDEVINS *,int,struct CFGMNODE *); rc=VERR_VD_IMAGE_READ_ONLY
00:00:01.776171 VMSetError: AHCI: Failed to attach drive to Port0
00:00:01.776180 PDM: Failed to construct 'ahci'/0! VERR_VD_IMAGE_READ_ONLY (-3205) - Image is read-only.
00:00:01.910243 ERROR [COM]: aRC=E_FAIL (0x80004005) aIID={8ab7c520-2442-4b66-8d74-4ff1e195d2b6} aComponent={Console} aText={Failed to open image 'D:\MEMEME\vbox\mint.vmdk' for writing due to wrong permissions (VERR_VD_IMAGE_READ_ONLY).
00:00:01.910298 Failed to attach driver below us! Image is read-only. (VERR_VD_IMAGE_READ_ONLY).
00:00:01.910299 AHCI: Failed to attach drive to Port0 (VERR_VD_IMAGE_READ_ONLY)}, preserve=false
00:00:01.927049 Power up failed (vrc=VERR_VD_IMAGE_READ_ONLY, rc=E_FAIL (0X80004005))
00:00:02.011279 UIMachineLogicFullscreen::maybeAdjustGuestScreenSizeOpenGL Error: Render SPU: (MakeCurrent) failed to make 0xe00112d5, 0x10000 current with 0x6 error.
I have checked the permissions on the "mint.vmdk" file, both my account and the local Administrators group have full control on the file. So that can't be the file with read-only permission causing this indigestion.

I have also run DISKPART and checked that the disk is not set to READ-ONLY.

I discarded my saved image and tried to start the VM from a clean state. All to no avail.

I suspect that the problem is caused by one of the OS updates pushed to the laptop but I have not figured out where to look for proof. So all thoughts/insights are appreciated.
 Edit: : I wonder if this may be a clue: Both VirtualBox.exe and VBoxSVC.exe processes are running under my name -- I double checked that VirtualBox is configured with "Run this program as an administrator" which had worked till today. I don't have a direct comparison to another VirtualBox instance with the exact same configuration, but I do have another VBox setup, where all the VirtualBox related processes are running as SYSTEM.
 Edit: : VirtualBox version was 4.3.16 and upgraded to 4.3.18 in attempt to fix the problem. 
 

Re: [Edited] Raw Disk Access Problem on Windows 7

Posted: 21. Nov 2014, 12:22
by mpack
ww9rivers wrote:To run a VM from a raw disk, VirtualBox has to be manually configured to do that and it must be run as Administrator in Windows.
That would be true on an XP host, but Win7 needs more than that.

Enabling raw access to Win7 / Win2k8 disks.

Re: [Edited] Raw Disk Access Problem on Windows 7

Posted: 21. Nov 2014, 15:56
by ww9rivers
mpack wrote:
ww9rivers wrote:To run a VM from a raw disk, VirtualBox has to be manually configured to do that and it must be run as Administrator in Windows.
That would be true on an XP host, but Win7 needs more than that.

Enabling raw access to Win7 / Win2k8 disks.
I thought verifying that the disk did NOT have Read-only was enough:

Code: Select all

C:\WINDOWS\system32>diskpart

Microsoft DiskPart version 6.1.7601
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: LTDF0000

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          238 GB  1024 KB
  Disk 1    Online          223 GB      0 B
  Disk 2    Online          119 GB      0 B

DISKPART> select disk 1

Disk 1 is now the selected disk.

DISKPART> offline disk

DiskPart successfully offlined the selected disk.

DISKPART> attribute disk
Current Read-only State : No
Read-only  : No
Boot Disk  : No
Pagefile Disk  : No
Hibernation File Disk  : No
Crashdump Disk  : No
Clustered Disk  : No

DISKPART> attribute disk clear readonly

Disk attributes cleared successfully.

DISKPART> attribute disk
Current Read-only State : No
Read-only  : No
Boot Disk  : No
Pagefile Disk  : No
Hibernation File Disk  : No
Crashdump Disk  : No
Clustered Disk  : No

DISKPART>
No? Do I have to recreate my Mint Linux disk and reinstall everything? I would rather not do that.

And besides, this whole setup had been working before a forced reboot after some Windows 7 OS patches.

Re: [Edited] Raw Disk Access Problem on Windows 7

Posted: 21. Nov 2014, 16:28
by ww9rivers
@mpack:

Forgot to thank you for the reply. :-)

I read through it again and found this post viewtopic.php?f=6&t=38914#p219883 using the "Process Explorer" to find a process accessing all hard drives.

I got "procexp.exe", used the "Find Handle or DLL..." function to look for "Harddisk", and found the "CmgShieldSvc.exe" process touching all my hard drives.

I suspect that is the thing that made my second SSD read-only to VirtualBox. Time to figure out how to make it exclude a hard disk.

Re: [Edited] Raw Disk Access Problem on Windows 7

Posted: 22. Nov 2014, 04:48
by ww9rivers
ww9rivers wrote:I suspect that is the thing that made my second SSD read-only to VirtualBox. Time to figure out how to make it exclude a hard disk.
According to my enterprise Windows management guy, that process has been doing the samething to all "fixed" drives all along. So that shouldn't be the suspect unless something fundamental has changed deep inside it.

I'm back to suspecting that something changed the "Run as administrator" behavior.

Could anyone who has a guest in Windows7 please help check if the VBox processes are running as yourself or some other account?

Thanks.
 Edit:  One more test:

Code: Select all

C:\Program Files\Oracle\VirtualBox>.\VBoxManage.exe internalcommands listpartitions -rawdisk \\.\PhysicalDrive1
VBoxManage.exe: error: Cannot open the raw disk: VERR_SHARING_VIOLATION

C:\Program Files\Oracle\VirtualBox>.\VBoxManage.exe internalcommands listpartitions -rawdisk \\.\PhysicalDrive2
Number  Type   StartCHS       EndCHS      Size (MiB)  Start (Sect)
1       0x07  0   /130/3   1023/254/63        122747         8192
It seems that there is definitely an issue with accessing the raw disk #1.