my image writer keeps popping up "Access Denied" Error 5, what can i do ?

Asked by Julio Rivera

when i write an image to my SD card a small window pops up saying "Access Denied;Error 5" what can i do ?

Revision history for this message
FallenMemories (slytherin9090) said :
#1

Normally, this would be the cause of "locked" SD cards, use the adapter that accompanied the SD card when you bought it, it has a lock switch on the side, insert the sd card, then slide the lock switch from LOCK to UNLOCK, then try the pluging your SD card again and see if it works.

Hope this helps.

Revision history for this message
simonwarren (7-contact-wozzie) said :
#2

I have the same issue.

I've reset the lock slider (locked and unlocked a couple of times), removed and re-connected my card reader on 2 different USB ports (not on a hub). I have full access to the card and have formatted, read and written to it after each change to confirm that's not an issue. I've tried a couple of images from http://downloads.raspberrypi.org/ and get the "Access denied error 5" each time. The only thing I've not been able to test is with a different memory card.

I'm running Vista32 on an HP G7000 laptop, and the Mem card's a SanDisk Ultra 16GB Class 6.

Any comments will be much appreciated.

Revision history for this message
Scott Alan Miller (dty6ux7pzvx-scott-awge2s4kjah) said :
#3

Ran into this, you are likely on Vista or Windows 7. The issue is that you need to run Win32 Disk Imager "As Administrator" when you starting it. Raw writing to a block device is an admin function so trying to run the program as a limited user will cause this error.

Revision history for this message
Don Gateley (dongateley) said :
#4

"Run as administrator" (which I am already) doesn't help with the Lock Error 5 on my Win 7. For writing the diskpart utility can be used to clean it and that releases whatever lock the OS has on it but I can find no way to read it without the Error 5. Help!

Revision history for this message
Don Gateley (dongateley) said :
#5

I should have noted that I'm trying to read from a SD removable drive that is formatted unix ext2.

Revision history for this message
Edward Hobbs (edward24hobbs) said :
#6

Hi, Don't know if you're still having this problem but I found that my music player (MusicBee, but I would assume others such as winamp and Foobar2000 will do the same) had locked my card as it wanted to sync music to it. I stopped it from trying and the image wrote fine.

Revision history for this message
BrianW (nb5r) said :
#7

In Windows 7, I had to close all instances of File Explorer to stop the Error 5, nothing else worked.

Revision history for this message
Don Gateley (dongateley) said :
#8

Thanks, BrianW, but that didn't work for me. I even tried killing explorer from the Task Manager and that didn't help. Bizarre problem. I would have bet that that would work.

Revision history for this message
AndreyM (medvedev88-a) said :
#9

Hello!
Iv'e encountered same problem but with usb device.

Solution No 1(For you): http://forum.xda-developers.com/showthread.php?t=936657&page=4

My solution: Stop all antivirus and security scanners ASAP (In my case Kaspersky security scanner)! Happiness! :D

Revision history for this message
Tobin Davis (gruemaster) said :
#10

Tobin Davis suggests this article as an answer to your question:
FAQ #2470: “Image Writer keeps popping up “Access Denied” Error 5, what can i do ?”.

Revision history for this message
Don Gateley (dongateley) said :
#11

Tobin, have you got a tip on how to determine the apps that are locking the device?

Revision history for this message
Tobin Davis (gruemaster) said :
#12

Not offhand (if I did, it would be part of the program by now). :)

I need to research this more, but my time has been completly consumed by work (both job and at home). And M$ doesn't make my life easier by changing the API with every new release.

Revision history for this message
Tobin Davis (gruemaster) said :
#13

Indeed a quick scan from google indicate that the API changed with Vista forward. Since we still build with MinGW API (XP and earlier), this is probably where our problem lies and will hopefully be resolved when we can update our build environment to a newer opensource API (mingw64?).

Revision history for this message
Don Gateley (dongateley) said :
#14

Thanks.

Revision history for this message
James Lampkin (jlampkin01) said :
#15

Thought I'd share I ran into the same issue tonight and had no luck working through the error. I run a program called 'Unlocker' which will tell me the programs that are keeping my files locked. It initially found some random software locking my SD card but even after I unlocked it 'Error 5' persisted.

In the end I moved my work from my desktop to laptop which is also running Win7 Home Premium 64 bit. The Image Writer software worked perfectly on my laptop. Oddly enough I just installed a new HDD in it about a month ago and I've been working through all the OS updates. So I just confirmed its fully up to date with all the pending updates and it didn't experience an issue.

So in the end, try another computer if you have that option. Hope this helps.

James

Revision history for this message
Andrew Longdon (mamvcivm) said :
#16

I've had this problem. I now have about 5 SD cards that I use with my RPi, none allow me to read using win32 disk imager. I've tried running as administrator, even running in safe mode. Doesn't work. I then tried a new card, straight out of the packaging. This worked fine, no error 5. However, I then wrote Raspbian onto the SD and installed it in the Pi. Later, I then tried reading it again - and then I got Error 5 again....

Revision history for this message
Haihong (Mr.)Luo (luohaihong) said :
#17

Found a steady way to simulate/duplicate this problem on Windows 7 desktop.
I put a Windows 7/Embeded OS into a 4G or 8G CF card (I also tried CFast, the same;probably SD card will also be similar via SATA-SD converter)'s NTFS partitions(s).
Then if I use a USB2->SATA converter and then a SATA->CF converter, to read and write a gain, write is always failed half way. (Windows 7 detect the card as hard disk drive)

But no issue if I am using directly USB2 card reader to read/write. (Windows 7 detects the card as removable)

My theory is
1. I sense that MS Windows 7 is constantly meddling with NTFS hard disk drive, even if there is no explorer window/instance open.
2. much less meddling if it's NTFS partition on removable media (but not hard disk, as detected by OS)
3. maybe current way of identify card by drive letter list is a bad idea (must have a letter assigned, but once doing so, windows 7 start to fool around with the card's NTFS journals non-stop; but we totally can strip off the assigned letter by "Manage" tool from "My Computer" right click menu)
4. there was a WinXP tool before called "SelfImage", which uses disk ID and partition ID to identify the drive and partition, which means we totally can just take away assigned the drive letter, but shield off Windows from meddling with card, even via interfacing SATA converter tool in between (man! SATA Cfast converter HW are way much cheaper than USB Cfast reader!) . Can we have something similar to the "SelfImage" way?

Revision history for this message
Haihong (Mr.)Luo (luohaihong) said :
#18

Just some points missed out during my previous submit:
(Point 3. more:) Even if it's detected as hard disk (via SATA converter), if there is no letter assigned, Windows 7 seems to refrain from touching the NTFS partitions. Maybe an easy way to simulate is just to use a USB2->2.5" notebook SATA drive, but the content in the SATA drive has a windows 7 on it. Try to backup/read and restore/write on a different PC/desktop, using Win Imager32.

Revision history for this message
Don Gateley (dongateley) said :
#19

I think you sent this to the wrong guy.

On Wed, Mar 26, 2014 at 2:06 AM, Haihong (Mr.)Luo <
<email address hidden>> wrote:

> Question #205161 on Image Writer changed:
> https://answers.launchpad.net/win32-image-writer/+question/205161
>
> Haihong (Mr.)Luo posted a new comment:
> Just some points missed out during my previous submit:
> (Point 3. more:) Even if it's detected as hard disk (via SATA converter),
> if there is no letter assigned, Windows 7 seems to refrain from touching
> the NTFS partitions. Maybe an easy way to simulate is just to use a
> USB2->2.5" notebook SATA drive, but the content in the SATA drive has a
> windows 7 on it. Try to backup/read and restore/write on a different
> PC/desktop, using Win Imager32.
>
> --
> You received this question notification because you are a direct
> subscriber of the question.
>

Revision history for this message
Alexandros (alexgr) said :
#20

I formated the USB memory stick and the format application informed me that the USB stick was used by another application and if I wanted to continue. I confirmed to continue and once the formating was complete I tried again using the Disk imager and it worked. That is how it worked for me with Error 5!

Revision history for this message
brian beuning (bbeuning) said :
#21

The Process Explorer tool from www.sysinternals.com has an option under "Find / Find Handle or DLL".
Then enter the drive letter (in my case it was i:) and it will show all processes with your SD drive open.
In my case it was process recordingmanager.exe from Real Networks.
Kill the processes and the write will go smoothly.

Revision history for this message
Alex (alex-cave) said :
#22

There is one easy way around this.
1. Format the USB/Media device using the windows format tool in explorer.
2. Then copy the image to the media.
If any processes are using the partition the format tool will close them after prompting.

Revision history for this message
Bujez (vedran-janic) said :
#23

Hi guys,

I just had the same problem with external HDD. It might not work with SD drive but worth try.

I had to use CMD and DISKPART to format the drive, after which I was able to write the image to the HDD. You just need to follow the CMD steps in this video https://www.youtube.com/watch?v=hmKKKfBYsmU Basically I made my external HDD bootable.

hope it work for you as did for me.

cheers

Revision history for this message
Dave (lammyjam) said :
#24

Hello,

Possible solution, apologies if this is a repeat: I had the same Access Denied Error 5 message when trying to burn to a 16GB USB drive . When I gave up and tried to eject my USB, windows claimed it was in use by another program.

Once I closed all explorer windows, Win32 Disk Imager allowed the burn.

Revision history for this message
Nate (natodd) said :
#25

Had this same issue on Windows 7, turned out it was my Antivirus. Once I disabled that it was no longer able to grab a lock on the SD Card, and was able to write to it fine.

Revision history for this message
Cabji (catfish-j) said :
#26

Found Google Music Manager was the culprit for me.

Revision history for this message
Joe Martin (spannah) said :
#27

Here is a possible work around...

The first few sectors written to the the device are likely to contain the partition information. Apps, either OS or 3rd party, scanning for drives for whatever reason are able to read that as soon as it is written so they try to get an handle on the partition / device, effectively blocking the writing process.

Skip the first chunk of data (first 1024 sectors?) and write everything else. This will be meaningless data to the OS. Finally, after the write loop is done, go back and write the first chunk of data.

Something like (sorry not to good with C code)
(line 501)
for (i = 1024ul; i < numsectors && status == STATUS_WRITING; i += 1024ul)
{...}
i = 0;
sectorData = readSectorDataFromHandle(hFile, i, (numsectors - i >= 1024ul) ? 1024ul:(numsectors - i), sectorsize);
...
writeSectorDataToHandle(hRawDisk, sectorData, i, (numsectors - i >= 1024ul) ? 1024ul:(numsectors - i), sectorsize);
...

Hope this helps!

Revision history for this message
Tobin Davis (gruemaster) said :
#28

This should no longer be an issue with the 1.0 release, as we now take total control of the device, and deny any access while we are doing a write operation.

Revision history for this message
Toryberra (toryberra) said :
#29

For anyone still experiencing this open CMD as admin and run these commands:

diskpart
list disk
select disk <#> (select the sdcard)
clean
create partition primary
format fs=fat32 quick
assign

re-launch win32diskimager

Revision history for this message
Daniel (dw83) said :
#30

To fix this problem use the program SD card formatter. Then write the image file with Win32 disk imager.

I had the same issue when formatting with windows 10 right click format. SD card formatter fixed the issue.

Revision history for this message
Jan veliky (mastercs999) said :
#31

Turning off the antivirus solved my problem.

Can you help with this problem?

Provide an answer of your own, or ask Julio Rivera for more information if necessary.

To post a message you must log in.