access denied on raw disk

Discussions related to using VirtualBox on Windows hosts.
Post Reply
harald123
Posts: 64
Joined: 30. Oct 2020, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Linux Mint 19 Tara

access denied on raw disk

Post by harald123 »

Hi,

I had setup a raw disk to boot from usb drives which was working fine. About a month ago I upgraded Virtualbox version and now the vm is not starting anymore and shows 'not acessible' in the Gui at the raw disk file.
I start VB with admin rights and also gave full control on the raw disk file to everyone. Diisk management says the disk is healthy.
Reboot also does not solve it.
Is it possible that the update broke this setup in a way?
I read other topics with this error, but could not find a solution except the one with diskpart.

Error when trying to boot the vm:
0:00:12.740763 Power up failed (vrc=VINF_SUCCESS, rc=E_FAIL (0X80004005))
00:00:12.757506 GUI: UIMachineViewNormal::resendSizeHint: Restoring guest size-hint for screen 0 to 1896x949
00:00:12.757581 ERROR [COM]: aRC=E_ACCESSDENIED (0x80070005) aIID={4680b2de-8690-11e9-b83d-5719e53cf1de} aComponent={DisplayWrap} aText={The console is not powered up (Display::setVideoModeHint)}, preserve=false aResultDetail=0
Error when trying to setup the raw disk again with vboxmanage:
C:\Program Files\Oracle\VirtualBox>VBoxManage internalcommands createrawvmdk -filename c:\usb.vmdk -rawdisk \\.\PhysicalDrive1

The 'createrawvdk' subcommand is deprecated. The equivalent functionality is
available using the 'VBoxManage createmedium' command and should be used
instead. See 'VBoxManage help createmedium' for details.

0%...VBOX_E_FILE_ERROR
VBoxManage.exe: error: Failed to create medium
VBoxManage.exe: error: Could not create the medium storage unit 'C:\usb.vmdk'.
VBoxManage.exe: error: VMDK: Image path: 'C:\usb.vmdk'. Failed to open the raw drive '\\.\PhysicalDrive1' for reading (VERR_ACCESS_DENIED) (VERR_ACCESS_DENIED).
VBoxManage.exe: error: VMDK: could not create raw descriptor for 'C:\usb.vmdk' (VERR_ACCESS_DENIED)
VBoxManage.exe: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component MediumWrap, interface IMedium
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleCreateMedium(struct HandlerArg *)" at line 634 of file VBoxManageDisk.cpp
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: access denied on raw disk

Post by scottgus1 »

harald123 wrote:About a month ago I upgraded Virtualbox
The new Virtualbox version 7.0 has some changes for Raw Disk Access. I haven't played with it lately, so I'm not certain what to change in your setup. See https://www.virtualbox.org/manual/ch09.html#rawdisk and "VBoxManage createmedium".
harald123
Posts: 64
Joined: 30. Oct 2020, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Linux Mint 19 Tara

Re: access denied on raw disk

Post by harald123 »

ok, I tried with createmedium as well and it looks the same:

C:\Program Files\Oracle\VirtualBox>VBoxManage createmedium disk --filename c:\usb.vmdk --format=VMDK --variant RawDisk --property RawDrive=\\.\PhysicalDrive1
0%...VBOX_E_FILE_ERROR
VBoxManage.exe: error: Failed to create medium
VBoxManage.exe: error: Could not create the medium storage unit 'C:\usb.vmdk'.
VBoxManage.exe: error: VMDK: Image path: 'C:\usb.vmdk'. Failed to open the raw drive '\\.\PhysicalDrive1' for reading (VERR_ACCESS_DENIED) (VERR_ACCESS_DENIED).
VBoxManage.exe: error: VMDK: could not create raw descriptor for 'C:\usb.vmdk' (VERR_ACCESS_DENIED)
VBoxManage.exe: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component MediumWrap, interface IMedium
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleCreateMedium(struct HandlerArg *)" at line 634 of file VBoxManageDisk.cpp
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: access denied on raw disk

Post by scottgus1 »

harald123 wrote:VERR_ACCESS_DENIED
Please check that you're running this command in a Run-as-Administrator command prompt. Also:
harald123 wrote: --filename c:\usb.vmdk
Put the file in a subfolder, not the C drive root. Windows has special permissions for drive roots, especially C:\.

Also, the disk being accessed has to be off-line in the Windows host Disk Management.
harald123
Posts: 64
Joined: 30. Oct 2020, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Linux Mint 19 Tara

Re: access denied on raw disk

Post by harald123 »

ok, I ran cmd as admin and used a test folder c:\test\usb.vmdk with the same error.

I tried to make the disk offline and it says it cannot do it for removable media:

Disk 1 Online 1928 MB 0 B

DISKPART> select disk 1

Disk 1 is now the selected disk.

DISKPART> offline disk

Virtual Disk Service error:
The operation is not supported on removable media.

LE:
maybe it is a bug that can be reported to dev
Post Reply