Files
pgsql-jellyfin/docs/FIX_SYSTEM_XML_PATHS.md
T
wjones 7eb2b445cb Postgres perf, path migration, and shutdown race fixes
- Major query performance boost: replaced correlated subqueries with DistinctBy() in BaseItemRepository, added episode deduplication index, and increased default command timeout to 120s.
- Fixed LibraryMonitor shutdown race: added disposal checks and exception handling in FileRefresher to prevent ObjectDisposedException.
- Added PowerShell and SQL utilities for fixing Linux paths in config files and database; new scripts for WebDir and path migration.
- Auto-fix for WebDir in startup.json on load; new helper scripts and docs.
- Added automated weekly DB performance monitoring scripts and reporting.
- Expanded documentation and README for all fixes, scripts, and migration steps.
- Updated SQL scripts for index creation and diagnostics; improved output handling.
- Updated db-config defaults and added new diagnostic/report files.
2026-03-05 08:56:42 -05:00

128 lines
3.5 KiB
Markdown

# Check and Fix system.xml MetadataPath on Windows
## Problem
Even though database stores `%MetadataPath%\People`, the logs show Linux paths.
This means `system.xml` has a Linux path configured for `MetadataPath`.
## Where to Check
### **1. Check your system.xml file**
**Location:** `C:\ProgramData\jellyfin\config\system.xml` (or your config directory)
Look for this line:
```xml
<MetadataPath>/var/lib/jellyfin/metadata</MetadataPath>
```
### **2. What it should be**
**Option A: Empty (Use default)**
```xml
<MetadataPath></MetadataPath>
```
or
```xml
<MetadataPath/>
```
**Option B: Windows path**
```xml
<MetadataPath>C:\ProgramData\jellyfin\data\metadata</MetadataPath>
```
## How to Fix
### **Method 1: Via Jellyfin Dashboard** (Recommended)
1. Open Jellyfin Dashboard
2. Go to **Advanced****Paths**
3. Look for **Metadata path**
4. Clear it (to use default) or set it to a Windows path
5. Save
6. Restart Jellyfin
### **Method 2: Edit system.xml Manually**
1. **Stop Jellyfin service/application**
2. Open `C:\ProgramData\jellyfin\config\system.xml` in a text editor
3. Find the `<MetadataPath>` line
4. Change from:
```xml
<MetadataPath>/var/lib/jellyfin/metadata</MetadataPath>
```
To:
```xml
<MetadataPath></MetadataPath>
```
or
```xml
<MetadataPath>C:\ProgramData\jellyfin\data\metadata</MetadataPath>
```
5. Save the file
6. Start Jellyfin
### **Method 3: PowerShell Script** (Automated)
```powershell
# Path to your Jellyfin config directory
$configPath = "C:\ProgramData\jellyfin\config\system.xml"
# Backup first
Copy-Item $configPath "$configPath.backup.$(Get-Date -Format 'yyyyMMdd_HHmmss')"
# Read the XML
[xml]$xml = Get-Content $configPath
# Check current MetadataPath
Write-Host "Current MetadataPath: $($xml.ServerConfiguration.MetadataPath)"
# Update to empty (use default) or set a Windows path
$xml.ServerConfiguration.MetadataPath = ""
# Or set to specific path:
# $xml.ServerConfiguration.MetadataPath = "C:\ProgramData\jellyfin\data\metadata"
# Save
$xml.Save($configPath)
Write-Host "Updated MetadataPath to: $($xml.ServerConfiguration.MetadataPath)"
Write-Host "Please restart Jellyfin for changes to take effect"
```
Or use the automated script:
```powershell
.\FixJellyfinPaths.ps1 -DryRun # Preview changes
.\FixJellyfinPaths.ps1 # Apply fixes
```
## Verification
After fixing, check the logs to see if the Linux paths are gone.
The error should change from:
```
[WRN] Image not found at "/var/lib/jellyfin/metadata/People/D/David L.M. McIntyre/folder.jpg"
```
To:
```
[WRN] Image not found at "C:\ProgramData\jellyfin\data\metadata\People\D\David L.M. McIntyre\folder.jpg"
```
## Why This Happens
1. Database stores: `%MetadataPath%\People\D\David L.M. McIntyre\folder.jpg`
2. Jellyfin expands `%MetadataPath%` using the value from `system.xml`
3. If `system.xml` has `/var/lib/jellyfin/metadata`, the expanded path becomes:
`/var/lib/jellyfin/metadata\People\D\David L.M. McIntyre\folder.jpg`
4. This creates a mixed Linux/Windows path that doesn't exist
## Other Files to Check
If the issue persists, also check:
1. **`encoding.xml`** - For `TranscodingTempPath`
2. **`network.xml`** - For any path configurations
3. **`database.xml`** - Though this is less likely to have path issues
## Root Cause
When you migrated from Linux to Windows, the `system.xml` configuration file was copied over with Linux paths intact. The database correctly stores virtual paths (`%MetadataPath%`), but the virtual path is expanded using the incorrect Linux path from the config file.