ERROR_LOCK_VIOLATION: 11 Best Fixes
9 min. read
Published on
Read our disclosure page to find out how can you help Windows Report sustain the editorial team Read more
Do you keep seeing ERROR_LOCK_VIOLATION when trying to access a file?
The Windows file system uses a robust caching system to address multitasking. However, due to a bug in the early editions of Windows 7, Windows Vista, Windows Server 2008, and Windows Server 2008 R2, you might get the following error:
- ERROR_LOCK_VIOLATION: 33 (0x21) The process cannot access the file because another process has locked a portion of the file.
Occasionally, there are reports of the same issue in modern versions, like Windows 10 and 11.
How To Fix ERROR_LOCK_VIOLATION
To help you resolve this pressing issue, I’ve listed the tried and tested methods below starting with the easiest ones:
Basic Troubleshooting
- Restart the system: A simple reboot or force restart might also fix the issue.
- Make a copy of the source file: Create a copy of the source file in a different directory. Then, try to access the file using the relevant software.
- Close all open applications: Use the Windows Task Manager to close all open apps to rule out any software conflict. Third-party apps will show up below the Apps section of Processes Name.
- Check for background processes: Also, go through the Background processes section and find if any third-party apps are running except for Windows processes.
- Briefly disable the antivirus: Deactivate real-time monitoring tools or the built-in Windows Security. For the built-in antivirus, go to Settings > Update & Security > Windows Security > Virus & threat protection > Manage settings > Turn off Real-time protection. Don’t forget to enable it again when testing is over.
Update Windows OS to Its Latest Edition
For Windows 10 and 11 PCs, follow these steps:
- Press Windows + I to open Settings.
- Click on the Update & Security menu on the left-side panel.
- Now, go to Windows Update and hit Check for updates or Resume updates.
For older Windows PCs, try these steps instead:
- Hit the Start menu button and select the All Programs option.
- Then, click on the Windows Update menu.
- Click on the Check for updates button in the left-side panel.
- Select View available updates and check if the Service Pack for Microsoft‌ Windows update is available.
- Click on the Install button if visible.
- Follow onscreen instructions to complete updating to the latest Service Pack edition.
If you don’t see the above update option, you can manually download the appropriate Service Pack for your Windows OS from the Microsoft Download Center. Since Microsoft has stopped supporting older versions, you might have to install Service Packs manually.
You can also check out the Microsoft Update Catalog portal for more updates.
Use the Sysinternals Process Explorer Tool
Sometimes, Windows Task Manager can’t completely stop conflicting apps. Hence, ERROR_LOCK_VIOLATION will still show up even if you’ve closed a few of them.
You can use the Sysinternals Process Explorer instead. Here’s how:
- Download Process Explorer from the official Microsoft website.
- Unzip the content in a dedicated folder.
- Run the procexp EXE file if your PC is a 32-bit system.
- If it’s a 64-bit machine, run the procexp64 EXE file.
- Press Ctrl + F and type in the complete file name with the extension and hit Enter.
- You should see a list of conflicting processes.
- If you don’t see anything as shown in the below screenshot, press Ctrl + Shift + F.
- This will launch the Process Explorer Search dialog box.
- In the Handle or DLL substring field, again type in the problematic file name.
- Hit Search. Wait up to a minute for the table to populate.
- You’ll now see the list of conflicting apps.
- Close those from the home screen of Process Explorer. Right-click on the target and select Kill Process.
Run a Disk Error Check
- Press Windows + E to open the File Explorer.
- Click on This PC in the left-side navigation panel.
- Select the first drive, like C: and right-click.
- Choose Properties from the context menu.
- Navigate to the Tools tab in the Properties dialog box.
- Click on the Check button below the Error checking section.
- The Error Checking dialog box will show along with a progress bar.
- Allow the process to complete.
- Now, repeat these steps for the rest of the drives on your PC.
Scan for Malware in Offline Mode
- Open the Windows Settings app by pressing the Windows key and the I key simultaneously.
- Click on Update & Security at the bottom.
- Now, select Windows Security from the list of options in the left-side navigation pane.
- Click on Virus & threat protection on the right side.
- Select the Scan options button below Quick scan.
- Then, scroll down to the Advanced options and click on it.
- Select the Microsoft Defender Offline scan option, and click on the Scan now button below it.
- Windows Defender will now perform a thorough malware scan while your computer is in offline mode.
Change File Security Permissions
Are you seeing the ERROR_LOCK_VIOLATION error in a Workgroup/ Homegroup network, shared drive, or non-administrator Windows account? Try allowing access to the file for all collaborators or reducing the security policies by following these steps:
- Navigate to the problematic file, select it, and right-click.
- Select Properties from the context menu.
- Go to the Security tab of the Properties dialog box.
- You’ll see the users in the Group or user name list.
- Select the target user and hit the Edit button.
- Again choose the same user name in the Permissions for dialog box.
- Checkmark all the boxes below the Allow section.
- Click Apply and OK on all the dialog boxes to make the changes effective.
Fix Hardware, Driver, and Firmware Issues
It might be possible that the disk drive isn’t installed appropriately or it’s facing connectivity issues. So, shut down the PC and open the PC case. Unplug the power and data cable from the HDD or SSD. If it’s an NVMe M.2 SSD chip, remove it from its PCIe slot.
Snuggly connect the cables back to the hard disk or solid-state drive. For the NVMe chip, reseat it appropriately. Power on the PC and check if the issue resurfaces again or not.
Also, ensure that the SATA HDD drivers of the Windows PC are updated by performing these steps:
- Right-click on the Start menu flag and click on Device Manager from the context menu.
- On Device Manager, extend the Disk drives tree and right-click on a disk drive.
- Select Update driver from the context menu.
- Choose Search automatically for driver in the next dialog box that shows up.
- Wait for Windows to update the drivers either from Microsoft’s database or other official online sources.
- Ensure that the device is connected to the internet the whole time.
If the internal storage is an SSD or NVMe SSD chip, you can install the manufacturer’s SSD management software. For example, I’m using NVMe M.2 drive from Crucial so I’ve installed and tested the method using the Crucial Storage Executive app.
Check if there are any updates available for the hardware firmware.
Apply the update and restart the PC.
Run the SFC and DSM Scans to Fix the Windows File System
If the Windows file system is compromised, the following scans will reveal and fix that:
Running an SFC Scan
- Open the Power User menu by right-clicking on the Start menu button.
- Select Terminal (Admin) to open Windows PowerShell with administrator privileges.
- Enter
sfc /scannow
in the console and hit Enter.
- You don’t need to do anything if you see any of the following outcomes:
- No integrity violations found.
- Integrity violations found and repaired.
- However, if you see the following message in the terminal, move on to the DISM scanning step:
- Integrity violations found but some could not be repaired.
Executing the DSM Scan
- Open the Windows PowerShell terminal with admin rights.
- Copy and paste the following command inside the console:
dism /online /cleanup-image /restorehealth
- Hit Enter to execute the script.
- Allow DISM scan to fix the Windows file system with the latest reference image file from Microsoft.
Perform a Clean Boot
- Type System in the Start menu and click on the System Configuration tool below the Best match section.
- Go to the Services tab and checkmark the box for the Hide all Microsoft Services option.
- Hit the Disable all button.
- Click on the Startup tab and select Open Task Manager.
- The link will take you directly to the Startup tab of Task Manager.
- Disable all active startup processes except for drivers, like Bluetooth, Realtek HD Audio, etc.
- Go back to the Services tab of System Configuration.
- Hit the Apply button.
- Restart your PC.
Now, test if the issue goes away. Whatever the outcome is, don’t forget to reboot into normal mode by enabling all third-party services again.
Use Windows System Restore
Did the ERROR_LOCK_VIOLATION start appearing after a major change to the PC? You might try rolling back the changes by following these steps:
- Open the About window of Windows Settings by pressing the Windows and Pause Break keys together.
- Scroll down to the bottom of the About screen and click on System protection.
- The System Properties dialog box will open taking you directly into the System Protection tab.
- Click on the System Restore button.
- The System Restore dialog box will open. Click Next.
- Select a restore point from the table and click Next.
- Click Finish to start the System Restore process.
- Follow the onscreen instructions.
Contact Microsoft Consumer Support for a Hotfix
If you’re using any of the following Windows PC or Server systems and none of the above fixes are working, you should contact the technical support team:
- Windows Server 2008
- Windows Server 2008 R2
- Windows Server 2008 Service Pack 2 (SP2)
- Windows Server 2008 R2 Service Pack 1 (SP1)
- Windows 7
- Windows 7 Service Pack 1 (SP1)
- Windows Vista Service Pack 2 (SP2).
Visit the Contact us page and select the Windows OS logo. On the Windows overlay box, hit the Get Business Support button if you’re coming from a business organization. Alternatively, if you’re an individual user, click on the Get Home Support option.
You’ll have to sign in with a Microsoft 365 or Microsoft Live account to contact a premium support specialist.
Summary
So, these are the methods you can follow to fix the Windows file system error ERROR_LOCK_VIOLATION in various OS editions.
Did these solutions work for you? Do you know a better fix? Comment below to share your thoughts. Additionally, learn how to deal with a similar problem, ASSIGN_DRIVE_LETTERS_FAILED.
User forum
0 messages