PLEX32 is the **dedicated Plex Media Server** for the KingDezigns network.
It replaced Plex on NAS08, migrating the service to a more capable x86 machine that supports advanced Plex Pass features including **Sonic Radio** — an AI-driven music playlist and discovery feature that requires CPU capabilities not available on Raspberry Pi hardware.
All media files remain stored on NAS08 and are accessed via NFS mounts. PLEX32 handles only transcoding and Plex server logic — it does not store media locally.
This device is the **single Plex Media Server** for the KingDezigns network and is publicly accessible via `plex.kingdezigns.com` through NPM on HAS.
> Note: Plex config and transcode directories are stored **locally** on the external SSD at `/mnt/external_ssd/plex/` — offloading storage write cycles from the internal eMMC. The NFS config mount (`/mnt/plex/config`) is used as the backup destination by `plex32_backup.sh`. Only the media library is actively used by the container via NFS.
> **devices + group_add:** Required for Intel Quick Sync hardware transcoding. The container needs `/dev/dri` device access plus supplementary group membership for `video` (GID 44) and `render` (GID 993). Without `group_add`, Plex silently falls back to software transcoding even with hardware acceleration enabled in settings.
### **Key Docker Commands**
```bash
# Start all services
cd ~/docker/plex && docker compose up -d
# Stop all services
cd ~/docker/plex && docker compose down
# Update Plex
cd ~/docker/plex && docker compose pull && docker compose up -d
# View Plex logs
docker logs plex --tail 50
# View Tautulli logs
docker logs tautulli --tail 50
# Check container status
docker ps
```
---
## 🎬 Hardware Transcoding — Intel Quick Sync
The J4105 supports Intel Quick Sync via `/dev/dri`. Both decode and encode are offloaded to the GPU.
### **Verification**
Check GPU access from inside the container:
```bash
docker exec -it plex id
# Should show groups 44 (video) and 993 (render/group01b4) in output
docker exec -it plex ls -la /dev/dri
# Should show card0 and renderD128
```
Verify during active transcode — Plex Dashboard should show:
```
4K (HEVC Main 10) (hw)
SD (HEVC) — Transcode (hw)
```
The `(hw)` suffix on both lines confirms Quick Sync is handling decode and encode.
> The USB SSD uses `nofail` and `x-systemd.device-timeout=5s`. If the external drive fails or is physically disconnected, the host system will still boot cleanly within 5 seconds without locking up or becoming inoperable.
sudo smbios-token-ctl --dump-tokens | grep -i -A2 "AC Power Recovery"
```
> Note: `smbios-token-ctl --dump-tokens` throws a harmless `StopIteration` traceback after printing all tokens (hits a malformed token entry near the end of the table) — this does not affect the accuracy of the data already printed, including the AC Power Recovery tokens.
**Result:** PLEX32 will now power back on automatically as soon as AC power is restored after an outage — no physical power button press required. (HAS already had equivalent behavior configured.)
---
## 🗂️ Shared Permissions
PLEX32 uses the same `ncshare` group as NAS08 and NAS16 for consistency across the network.
| Item | Value |
|------|-------|
| Group name | `ncshare` |
| GID | `1001` |
| Members | `rufusking` |
Verify with:
```bash
getent group ncshare
```
---
## 💾 Config Backup
Plex and Tautulli configs are backed up to NAS08 every 3 days via `plex32_backup.sh`.
The daily update check was intermittently reporting `Plex Media Server = Check failed — could not reach registry` even though `lscr.io` was reachable and disk space was healthy (8.6GB free of 26GB).
**Root cause:** The script's `docker pull` step runs under root's cron environment, which uses a minimal default `PATH` that didn't reliably match the interactive `rufusking` shell environment. The script also silently discarded the actual `docker pull` error output, so the true failure reason was never visible in the log or email — every failure was mislabeled with the same generic "could not reach registry" text regardless of cause.
**Fix applied:**
- Added an explicit `export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin` at the top of the script so behavior is consistent under cron regardless of invoking user/environment.
- The script now logs the full `docker pull` output/exit code to `/var/log/plex32-updates/` on failure, and includes it as a red error block in the email report, instead of showing a generic message.
Resolved — manual `sudo` run completed cleanly after the fix, and the failure message no longer appears.
The daily update check intermittently failed with `error from registry: unauthorized` on the final step of the Plex image pull — every layer showed `Pull complete`/`Download complete`, then the pull failed right at the end. This occurred twice.
**Root cause:** A known transient issue with `lscr.io` (LinuxServer's registry) on large multi-layer images — the manifest-verification token occasionally expires or gets rate-limited at the very last step of the pull, even though `lscr.io` does not require authentication for public pulls. Not a credentials problem; the script had no retry logic, so any single transient failure was reported as a full check failure.
**Fix applied:**
- The `docker pull` step is now wrapped in a retry loop — up to 3 attempts, 30 seconds apart — before being treated as a genuine failure.
- Also discovered during this fix: the `export PATH=...` line from the 2026-07-12 fix (below) was missing from the deployed script despite being documented as applied. Re-added at the top of the script.
- If a retry succeeds, the email now notes `(succeeded on retry, attempt N)` next to the update-available status, so successful retries stay visible instead of looking identical to a clean first-attempt pull.
- Only a failure across all 3 attempts still produces the red `CHECK FAILED` error block with full `docker pull` output, as before.
Resolved — verified with a live production run; the script now correctly reports "Update available" with ready-to-run commands instead of a registry error.
### **plex32_health_report.sh — Issues List Word-Wrapping Fix (2026-07-12)**
The "⚠ Issues Detected" block in the daily health report email was rendering each word of an issue message on its own line (e.g. "WARNING: NAS08 — Plex Config is getting full" appeared as one word per line) instead of as a single readable sentence.
**Root cause:** The script joined multiple issue messages into one string and then split them back apart using `IFS='. ' read -ra ISSUE_LIST`. This does not split on the two-character sequence `". "` as intended — `IFS` treats every character it contains as its own independent delimiter, so both `.` and every space in the text were treated as separate breaks, shattering each sentence into individual words.
**Fix applied:**
- Issue messages are now joined with actual newline characters instead of `". "` when assembled into `ALL_ISSUES`.
- The splitting logic was replaced with a `while IFS= read -r issue; do ... done <<< "$ALL_ISSUES"` loop, which reads one full issue line at a time instead of relying on ambiguous multi-character `IFS` splitting.
Resolved — verified with a manual run; each issue now renders as one complete sentence in the "Issues Detected" section of the email.
### **Email Reports**
| Report | Trigger Colors | Content |
|--------|---------------|---------|
| Update Check | 🟢 Green (current) / 🔵 Blue (updates available) / 🟠 Orange (check failed) | Component versions, available updates, ready-to-run commands |
| Health Report | 🟢 Green (healthy) / 🟠 Orange (warning) / 🔴 Red (critical) | Disk usage, NFS mount status, memory, CPU load, container status, Fail2Ban, reboot flag |
- **External USB SSD Mounted safely at `/mnt/external_ssd`** using `nofail,x-systemd.device-timeout=5s` — holds local Plex config (`/mnt/external_ssd/plex/config`) and transcode scratch space (`/mnt/external_ssd/plex/transcode`). Prevents eMMC wear and expanded root drive space to ~19GB free.
- **Intel Quick Sync hardware transcoding active** — requires `/dev/dri` device passthrough and `group_add: ["44","993"]` in compose. Without group_add, Plex silently falls back to software transcoding.
- **Lifetime Plex Pass** active — Sonic Radio, hardware transcoding, all Plex Pass features enabled.
- Media library mounted from NAS08 via NFS at `/mnt/plex/media`.
-`/mnt/plex/config` NFS mount used as backup destination only — not by Plex container.
- Library is ~75% HEVC Main 10, ~25% H.264, 100% AAC audio — audio never transcodes.
- Roku TV (Hisense 55R8BX) Direct Streams video, converts AAC→AC3 for audio (lightweight, expected).
- Subtitle Mode set to Manually Selected — prevents accidental PGS burn-in transcode.
- Publicly accessible via `plex.kingdezigns.com` — proxied through NPM on HAS.
- Port 32400 forwarded on UCG Max for direct Plex remote access.
- Tautulli on port 8181 — Plex down/up email alerts active.
- Fail2Ban active — VLAN 50 subnet whitelisted in ignoreip.
- sudo NOPASSWD configured for apt-get update, fail2ban-client, and reboot — required by automated and remote reboot scripts.
- **System timezone:** `America/New_York (EDT, -0400)` — corrected from `Etc/UTC` on 2026-06-21. UTC default causes cron jobs to fire 4 hours early. Always verify after fresh installs.
- SSH key from PLEX32 → NAS08 configured — required for backup script disk stats.
- **NAS08 root → PLEX32 SSH key configured** — required for remote reboot script (`plex32_reboot.sh` on NAS08).
- **AC Power Recovery set to "On"** (2026-06-30) via SMBIOS token `0x00a3` using `smbios-token-ctl` — PLEX32 now auto powers-on after AC power is restored following an outage. Configured remotely via SSH, no BIOS access required. Tool: `libsmbios-bin` / `smbios-utils`.
- Config backup runs every 3 days at 2AM — tar + NFS copy, 3 copies retained, HTML email report.
-`ncshare` group (GID 1001) configured for network-wide permission consistency.
- eMMC has no SMART support — health monitored via daily health report email.
- No swap configured — 7.6GB RAM, consistently low utilization.
- Plex on NAS08 is **permanently disabled** (restart: no in compose).
- Migrated from NAS08 on 2026-06-18 — full library, watch history, and playlists preserved.
- **`plex32_update_check.sh` fixed 2026-07-12** — added explicit `PATH` export to fix intermittent `docker pull` failures under root's cron environment; script now logs real `docker pull` error output on failure instead of a generic "could not reach registry" message. All three PLEX32 scheduled jobs run under root's crontab.
- **`plex32_update_check.sh` fixed again 2026-08-04** — added a 3-attempt retry loop (30s apart) around `docker pull` to handle `lscr.io`'s transient `error from registry: unauthorized` failure (all layers pull successfully, then the final manifest step fails — a known registry-side token/rate-limit issue, not a credentials problem). Also re-added the `PATH` export from the 2026-07-12 fix, which had gone missing from the deployed script. Only a failure across all 3 attempts is now reported as `CHECK FAILED`; a retry success is noted inline in the email instead of being silently indistinguishable from a clean pull.
- **`plex32_health_report.sh` fixed 2026-07-12** — fixed the "Issues Detected" email block rendering each word on its own line, caused by a multi-character `IFS='. '` split; issues are now newline-delimited and read back with a `while read` loop.
- **`plex32_update_check.sh` updated 2026-08-18** — replaced heavy `docker pull` layer downloads with `skopeo inspect` for fast manifest digest comparisons. Adjusted Step 5 logic to prioritize "Updates Available" blue banner over non-fatal script check warnings.
- **Systemd override for Docker added 2026-08-19** — added `/etc/systemd/system/docker.service.d/override.conf` with `After=network-online.target remote-fs.target` and `Wants=network-online.target remote-fs.target` so Docker waits for NFS mounts on boot before starting containers.