fix(bazarr): update script now migrates old service files to use venv Python (#10459)

- Separates venv creation from service file migration logic
- Always checks and fixes service file if it uses /usr/bin/python3
- Fixes installations created before October 28, 2025 that upgraded to Debian 13
- Ensures all users running update script get automatic migration
- Idempotent: safe to run multiple times

Resolves issue where Bazarr fails to start on Debian 13 with 'externally-managed-environment' error for installations created before the October 28, 2025 fix (commit 909dbc20c).

Related: #7332
This commit is contained in:
Gabriel David Pragin
2026-01-01 10:09:19 -08:00
committed by GitHub
parent 1f5191c071
commit 53a2635240

View File

@@ -38,8 +38,13 @@ function update_script() {
msg_info "Setup Bazarr"
mkdir -p /var/lib/bazarr/
chmod 775 /opt/bazarr /var/lib/bazarr/
# Always ensure venv exists
if [[ ! -d /opt/bazarr/venv/ ]]; then
$STD uv venv /opt/bazarr/venv --python 3.12
fi
# Always check and fix service file if needed
if [[ -f /etc/systemd/system/bazarr.service ]] && grep -q "ExecStart=/usr/bin/python3" /etc/systemd/system/bazarr.service; then
sed -i "s|ExecStart=/usr/bin/python3 /opt/bazarr/bazarr.py|ExecStart=/opt/bazarr/venv/bin/python3 /opt/bazarr/bazarr.py|g" /etc/systemd/system/bazarr.service
systemctl daemon-reload
fi