# Jellyfin on Proxmox — Session-specific fix log

## Context

- Jellyfin CT: `102`
- Host: `imac-proxmox` (Proxmox VE 7.0.2-4)
- Media bind mount: `mp0: /mnt/pve/hdd-data/media,mp=/mnt/media`
- Large storage: `/mnt/pve/hdd-data` (916 GB total, 629 GB free at time of fix)
- Tailscale IP: `100.115.66.32`
- Client: Jellyfin Desktop 3.0.0-dev on macOS

## Problem 1: no audio on 9 GB HEVC HDR movie

Media info showed:

```
Video: HEVC 1920x1080 10-bit HDR10
Audio: EAC3 5.1 Dolby Digital Plus + Dolby Atmos
```

Jellyfin Mac app could direct-play video but not decode EAC3 audio.

### Fix: remux audio to AAC on host

```bash
HOST_FILE="/mnt/pve/hdd-data/media/movies/Project-Hail-Mary_(2026).mkv"
AAC_FILE="${HOST_FILE}.aac-remux.mkv"

cp -a "$HOST_FILE" "${HOST_FILE}.original-eac3"

ffmpeg -y -i "$HOST_FILE" \
  -map 0:v -c:v copy \
  -map 0:a:0 -c:a aac -b:a 384k \
  -map 0:s? -c:s copy \
  -metadata title="Project Hail Mary" \
  "$AAC_FILE"

mv "$HOST_FILE" "${HOST_FILE}.new"
mv "${HOST_FILE}.new" "$HOST_FILE"
rm -f "${HOST_FILE}.ffmpeg.log"
```

Resulting file:

```
-rw-r--r-- 1 root root 8.7G Jul  3 11:07 Project-Hail-Mary_(2026).mkv         (AAC audio)
-rw-r--r-- 1 root root 9.0G Jul  2 13:53 Project-Hail-Mary_(2026).mkv.original-eac3
```

Verification:

```bash
ffprobe -v error -show_streams -select_streams a "$HOST_FILE" | grep -E "^(codec_name|channels|sample_rate)"
# codec_name=aac
# sample_rate=48000
# channels=6
```

## Problem 2: Jellyfin failed to start after service restart

Log error:

```
System.InvalidOperationException: The path `/var/lib/jellyfin/data` has insufficient free space. Available: 1.1GiB, Required: 2GiB.
```

Root cause: 16 GB CT root disk nearly full; Jellyfin 10.11.8 refuses to start without 2 GiB free data-directory space.

First fix moved only `/var/lib/jellyfin`. Then Jellyfin crashed again with:

```
System.InvalidOperationException: The path `/var/cache/jellyfin` has insufficient free space. Available: 1.1GiB, Required: 2GiB.
```

### Fix: move both data and cache directories to bulk storage

1. Stop CT.
2. Create destinations:
   ```bash
   mkdir -p /mnt/pve/hdd-data/jellyfin-data
   mkdir -p /mnt/pve/hdd-data/jellyfin-cache
   ```
3. Mount CT root disk. Check partitioning first:
   ```bash
   losetup -fP /mnt/pve/hdd-data/images/102/vm-102-disk-0.raw
   losetup -l | grep vm-102-disk
   # /dev/loop2 shown
   fdisk -l /dev/loop2
   ```

   In this session the disk had **no partitions** (single ext4 filesystem). Mount directly:
   ```bash
   mkdir -p /mnt/jellyfin-root-temp
   mount /dev/loop2 /mnt/jellyfin-root-temp
   ```

   If the disk has a Linux partition, use `kpartx` and mount `/dev/mapper/loop2p2` instead.

4. Copy existing directories:
   ```bash
   cp -a /mnt/jellyfin-root-temp/var/lib/jellyfin/. /mnt/pve/hdd-data/jellyfin-data/
   cp -a /mnt/jellyfin-root-temp/var/cache/jellyfin/. /mnt/pve/hdd-data/jellyfin-cache/
   ```

5. Unmount and clean up:
   ```bash
   umount /mnt/jellyfin-root-temp
   kpartx -dv /dev/loop2 2>/dev/null || true
   losetup -d /dev/loop2
   rmdir /mnt/jellyfin-root-temp
   ```

6. Add bind mounts:
   ```bash
   echo "mp2: /mnt/pve/hdd-data/jellyfin-data,mp=/var/lib/jellyfin" >> /etc/pve/lxc/102.conf
   echo "mp3: /mnt/pve/hdd-data/jellyfin-cache,mp=/var/cache/jellyfin" >> /etc/pve/lxc/102.conf
   ```

7. Start CT and verify Jellyfin service:
   ```bash
   pct start 102
   pct exec 102 -- systemctl status jellyfin --no-pager
   pct exec 102 -- df -h /var/lib/jellyfin /var/cache/jellyfin
   ```

## Access/credential notes

- Started with a one-time temporary SSH key generated in-session; removed it after the remux.
- Later added a permanent SSH key (`hermes-permanent-imac-proxmox`) at the user's request, after confirming I would ask permission before each non-Hermes action.
- Did not read Jellyfin API keys or other credentials.

## Problem 3: audio stops mid-movie after remux, around 1:42:20

Audio worked early in the movie but stopped around the same timestamp where playback previously stalled. Media Info after remux:

```
Audio codec: AAC LC
Audio channels: 6
Audio bitrate: 768 kbps
Play method: Direct playing
```

File duration:

```
Current AAC file: 9382.37 s
Original backup:  9382.38 s
```

### Diagnostic steps

- Full audio decode of both files with `ffmpeg -v error -map 0:a:0 -f null -` returned **no errors** for either file.
- Extracted 60-second `-c copy` clip around 1:42:00 from both files; both clips muxed cleanly.
- Chapter boundary found near the drop point:
  ```
  Chapter 8 ends at 102.6 min  (≈1:42:36)
  Chapter 9 starts at 102.6 min
  ```
- Pending: browser test and targeted playback with other clients (Infuse, Jellyfin Media Player) to isolate a client-side decoder bug.
