You may be unable to install or update Store apps. Also, when you run the Get-AppxPackage command, the following error may appear:
Get-AppxPackage : The database disk image is malformed The database disk image is malformed At line:1 char:1 + Get-AppxPackage + ~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Get-AppxPackage], Exception + FullyQualifiedErrorId : System.Exception,Microsoft.Windows.Appx.PackageManager.Commands.GetAppxPackageCommand
Cause
The “The database disk image is malformed” occurs if the State Repository database is corrupt. This database stores information about every Store app installed on the computer. The database file names are below:
- StateRepository-Deployment.srd
- StateRepository-Deployment.srd-shm
- StateRepository-Deployment.srd-wal
- StateRepository-Machine.srd
- StateRepository-Machine.srd-shm
- StateRepository-Machine.srd-wal
Unfortunately, a repair installation using an in-place upgrade using the ISO may not resolve the issue.
However, resetting the StateRepository databases manually should fix the issue.
Resolution
To fix the error “The database disk image is malformed”, rebuild the State Repository database.
Important: Following the procedure below, you will lose all your installed Store apps, but you can reinstall them again.
Rebuilding the State Repository database
- Download AdvancedRun from Nirsoft.net.
- Using AdvancedRun, open a TrustedInstaller Command Prompt. See the screenshot below.
- After the Command Prompt window opens, close the AdvancedRun utility.
- In the TrustedInstaller Command Prompt, run the following commands:
cd /d C:\ProgramData\Microsoft\Windows\AppRepository net stop StateRepository md C:\SRBackup move StateRepository-* C:\SRBackup
The above procedure moves the existing State Repository database files to a folder for backup purposes.
Restart Windows. Or, click the Start button or an item in your notification area. This starts the State Repository service automatically and rebuilds the databases. A fresh set of StateRespository-* databases will be created. The newly built database will not contain information about your previously installed Store apps.
This resolves the error “The database disk image is malformed” when running Get-AppxPackage and allows you to install the Store apps.
One small request: If you liked this post, please share this?
One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:- Pin it!
- Share it to your favorite blog + Facebook, Reddit
- Tweet it!