The mpv service inherited Kodi's VT-grabbing block (PAMName=login + StandardInput=tty + TTYPath=/dev/tty1). Opening a "login" PAM session on tty1 hangs in systemd's pre-exec setup, so mpv was never exec'd at all -- the service sat "running" as systemd-executor with an empty (mpv) cmdline, no IPC socket, no output. Two fixes: 1. Simplify the unit. mpv doesn't need a login session or the tty: as the sole DRM client on the seat it becomes DRM master implicitly on first open, so plain video+render+audio group membership is enough. Removing the PAM/tty block lets mpv actually start, initialize the vc4 KMS display, and play (verified end-to-end: play/status/next through the Flask API, position advancing on screen). 2. install.sh now tears down any leftover Kodi before starting mpv. The real trigger this time was an in-place migration: replacing the unit files doesn't stop an already-running Kodi, which kept DRM master and the tty1 seat and blocked mpv from ever getting the display. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
39 lines
1.5 KiB
Text
39 lines
1.5 KiB
Text
[Unit]
|
|
Description=mpv video player (KMS/DRM -- the actual player)
|
|
# Needs the DRM/HDMI + sound devices present.
|
|
After=local-fs.target systemd-udev-settle.service sound.target
|
|
Wants=systemd-udev-settle.service
|
|
# Keep a login getty off the primary display so nothing else claims tty1.
|
|
Conflicts=getty@tty1.service
|
|
|
|
[Service]
|
|
User=${MEDIAPI_USER}
|
|
# mpv on KMS/DRM needs: video+render (GPU/DRM), input (remotes/keyboard), audio
|
|
# (HDMI/ALSA). It becomes DRM master simply as the first/only DRM client on the
|
|
# seat -- no PAM login session and no elevated capabilities required, provided
|
|
# nothing else is already holding the GPU. (An older Kodi-based deploy DID hold
|
|
# it; install.sh tears any leftover Kodi down before starting this.)
|
|
SupplementaryGroups=video render input audio
|
|
# Create /run/mediapi (owned by this user) for the IPC socket the app connects to.
|
|
RuntimeDirectory=mediapi
|
|
StandardInput=null
|
|
StandardOutput=journal
|
|
StandardError=journal
|
|
# --idle keeps mpv running with no file loaded (holds the playlist between clips
|
|
# and after the last one), so the service stays up and the app can always reach
|
|
# the socket. Playback renders straight on KMS.
|
|
ExecStart=/usr/bin/mpv \
|
|
--idle=yes \
|
|
--input-ipc-server=/run/mediapi/mpv.sock \
|
|
--no-terminal \
|
|
--no-input-default-bindings \
|
|
--fullscreen \
|
|
--force-window=yes \
|
|
--keep-open=no \
|
|
--vo=gpu --gpu-context=drm --hwdec=auto \
|
|
--ao=alsa --audio-device=alsa/hdmi:CARD=vc4hdmi0,DEV=0
|
|
Restart=on-failure
|
|
RestartSec=5
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|