Files
pgsql-jellyfin/docs/LINUX_PATH_ISSUE_SUMMARY.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

4.3 KiB

Summary: Linux Paths Showing on Windows

Root Cause Identified

Your database is correctly storing virtual paths:

%MetadataPath%\People\D\David L.M. McIntyre\folder.jpg

However, the logs show Linux paths:

/var/lib/jellyfin/metadata/People/D/David L.M. McIntyre/folder.jpg

Why? The system.xml configuration file contains Linux paths that are used to expand the virtual %MetadataPath% placeholder.

📂 Files to Check

1. system.xml (Most likely culprit)

Location: C:\ProgramData\jellyfin\config\system.xml

Look for:

<MetadataPath>/var/lib/jellyfin/metadata</MetadataPath>

Should be:

<MetadataPath></MetadataPath>

or

<MetadataPath>C:\ProgramData\jellyfin\data\metadata</MetadataPath>

2. encoding.xml (If transcoding shows Linux paths)

Location: C:\ProgramData\jellyfin\config\encoding.xml

Look for:

<TranscodingTempPath>/var/tmp/jellyfin</TranscodingTempPath>

Should be empty or a Windows path.

3. database.xml (Less common)

Location: C:\ProgramData\jellyfin\config\database.xml

Check for any Linux paths in connection strings or options.

🔧 How to Fix

# Check what needs to be fixed (safe, no changes)
.\FixJellyfinPaths.ps1 -DryRun

# Apply fixes (with confirmation prompt)
.\FixJellyfinPaths.ps1

# Apply fixes without prompts
.\FixJellyfinPaths.ps1 -Force

# Custom paths
.\FixJellyfinPaths.ps1 -ConfigPath "D:\Jellyfin\config" -DataPath "D:\Jellyfin\data"

Option 2: Edit system.xml Manually

  1. Stop Jellyfin
  2. Open C:\ProgramData\jellyfin\config\system.xml
  3. Find <MetadataPath> and change from Linux path to empty or Windows path
  4. Save
  5. Start Jellyfin

Option 3: Via Dashboard (UI)

  1. Dashboard → Advanced → Paths
  2. Clear or update the Metadata path field
  3. Save
  4. Restart Jellyfin

🧪 How the Path Resolution Works

Database Stores:  %MetadataPath%\People\D\David L.M. McIntyre\folder.jpg
                            ↓
                  (Expand virtual path)
                            ↓
system.xml has:   /var/lib/jellyfin/metadata  ← PROBLEM!
                            ↓
                  (Combine paths)
                            ↓
Final Path:       /var/lib/jellyfin/metadata\People\D\David L.M. McIntyre\folder.jpg
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (Linux path from config!)

After Fix:

Database Stores:  %MetadataPath%\People\D\David L.M. McIntyre\folder.jpg
                            ↓
                  (Expand virtual path)
                            ↓
system.xml has:   (empty) → Use default: C:\ProgramData\jellyfin\data\metadata
                            ↓
                  (Combine paths)
                            ↓
Final Path:       C:\ProgramData\jellyfin\data\metadata\People\D\David L.M. McIntyre\folder.jpg
                  ✓ Correct Windows path!

📍 Code Locations

The path expansion happens in:

  1. ServerConfigurationManager.cs:78-84

    private void UpdateMetadataPath()
    {
        ((ServerApplicationPaths)ApplicationPaths).InternalMetadataPath = 
            string.IsNullOrWhiteSpace(Configuration.MetadataPath)
                ? ApplicationPaths.DefaultInternalMetadataPath
                : Configuration.MetadataPath;  // ← Uses system.xml value
    }
    
  2. ServerApplicationPaths.cs:63

    public string PeoplePath => Path.Combine(InternalMetadataPath, "People");
    

🔍 Verification

After applying the fix, check the logs. The error should change from:

[WRN] Image not found at "/var/lib/jellyfin/metadata/People/..."

To:

[WRN] Image not found at "C:\ProgramData\jellyfin\data\metadata\People\..."

(The file might still not exist, but at least the path will be correct!)

📝 Prevention

When migrating from Linux to Windows in the future:

  1. Don't copy system.xml directly
  2. Let Jellyfin generate a new config file
  3. Or manually edit paths before starting Jellyfin
  4. Use empty values for paths to let Jellyfin use OS-appropriate defaults

🎯 TL;DR

  • Database is correct (uses %MetadataPath%)
  • system.xml has Linux paths
  • 🔧 Fix: Clear <MetadataPath> in system.xml
  • 🔄 Restart Jellyfin