fix: cookie error (#127) (#210)

* Add support for custom PulseAudio cookie configuration
This commit is contained in:
Florian Asche authored and GitHub committed 2026-03-07 17:33:48 +01:00
1 parent efbad18275
commit b53678e0f3
5 files changed
+24 -1

No files matched your search

+1
View File
@@ -21,6 +21,7 @@ LVA_USER_GROUP="1000"
# Pipewire Server: /run/user/1000/pulse/native # Pipewire Server: /run/user/1000/pulse/native
LVA_PULSE_SERVER="unix:/run/user/${LVA_USER_ID}/pulse/native" LVA_PULSE_SERVER="unix:/run/user/${LVA_USER_ID}/pulse/native"
LVA_XDG_RUNTIME_DIR="/run/user/${LVA_USER_ID}" LVA_XDG_RUNTIME_DIR="/run/user/${LVA_USER_ID}"
LVA_PULSE_COOKIE="/app/configuration/tmp_pulse_cookie"
### Path to the preferences file (optional): ### Path to the preferences file (optional):
# PREFERENCES_FILE="/app/configuration/preferences.json" # PREFERENCES_FILE="/app/configuration/preferences.json"
+7 -1
View File
@@ -5,7 +5,12 @@ services:
image: "ghcr.io/ohf-voice/linux-voice-assistant:latest" image: "ghcr.io/ohf-voice/linux-voice-assistant:latest"
entrypoint: [] entrypoint: []
command: "chown -R ${LVA_USER_ID}:${LVA_USER_GROUP} /app/local /app/configuration /app/wakewords/custom /app/sounds/custom" command: "chown -R ${LVA_USER_ID}:${LVA_USER_GROUP} /app/local /app/configuration /app/wakewords/custom /app/sounds/custom"
env_file: .env environment:
# Pulseaudio
- XDG_RUNTIME_DIR=${LVA_XDG_RUNTIME_DIR}
- PULSE_SERVER=${LVA_PULSE_SERVER}
- PULSE_COOKIE=${LVA_PULSE_COOKIE}
env_file: ${ENV_FILE:-.env}
group_add: group_add:
- audio - audio
volumes: volumes:
@@ -27,6 +32,7 @@ services:
# Pulseaudio # Pulseaudio
- XDG_RUNTIME_DIR=${LVA_XDG_RUNTIME_DIR} - XDG_RUNTIME_DIR=${LVA_XDG_RUNTIME_DIR}
- PULSE_SERVER=${LVA_PULSE_SERVER} - PULSE_SERVER=${LVA_PULSE_SERVER}
- PULSE_COOKIE=${LVA_PULSE_COOKIE}
env_file: .env env_file: .env
group_add: group_add:
- audio - audio
+6
View File
@@ -5,6 +5,11 @@ services:
image: "ghcr.io/ohf-voice/linux-voice-assistant:latest" image: "ghcr.io/ohf-voice/linux-voice-assistant:latest"
entrypoint: [] entrypoint: []
command: "chown -R ${LVA_USER_ID}:${LVA_USER_GROUP} /app/local /app/configuration /app/wakewords/custom /app/sounds/custom" command: "chown -R ${LVA_USER_ID}:${LVA_USER_GROUP} /app/local /app/configuration /app/wakewords/custom /app/sounds/custom"
environment:
# Pulseaudio
- XDG_RUNTIME_DIR=${LVA_XDG_RUNTIME_DIR}
- PULSE_SERVER=${LVA_PULSE_SERVER}
- PULSE_COOKIE=${LVA_PULSE_COOKIE}
env_file: ${ENV_FILE:-.env} env_file: ${ENV_FILE:-.env}
group_add: group_add:
- audio - audio
@@ -27,6 +32,7 @@ services:
# Pulseaudio # Pulseaudio
- XDG_RUNTIME_DIR=${LVA_XDG_RUNTIME_DIR} - XDG_RUNTIME_DIR=${LVA_XDG_RUNTIME_DIR}
- PULSE_SERVER=${LVA_PULSE_SERVER} - PULSE_SERVER=${LVA_PULSE_SERVER}
- PULSE_COOKIE=${LVA_PULSE_COOKIE}
env_file: ${ENV_FILE:-.env} env_file: ${ENV_FILE:-.env}
group_add: group_add:
- audio - audio
+8
View File
@@ -81,6 +81,14 @@ if [ -n "${UNMUTE_SOUND}" ]; then
fi fi
# Add cookie file for pulseaudio to prevent errors
if [ ! -f "$PULSE_COOKIE" ]; then
echo "Creating PulseAudio cookie file"
touch "$PULSE_COOKIE"
chmod 600 "$PULSE_COOKIE"
fi
### Wait for PulseAudio ### Wait for PulseAudio
# Wait for PulseAudio to be available before starting the application # Wait for PulseAudio to be available before starting the application
CP_MAX_RETRIES=30 CP_MAX_RETRIES=30
+2
View File
@@ -204,6 +204,7 @@ Environment=PATH=/home/pi/linux-voice-assistant/.venv/bin:/usr/bin:/bin
# Environment=CLIENT_NAME="My Voice Assistant Speaker" # Environment=CLIENT_NAME="My Voice Assistant Speaker"
Environment=LVA_PULSE_SERVER="unix:/run/user/${LVA_USER_ID}/pulse/native" Environment=LVA_PULSE_SERVER="unix:/run/user/${LVA_USER_ID}/pulse/native"
Environment=LVA_XDG_RUNTIME_DIR="/run/user/${LVA_USER_ID}" Environment=LVA_XDG_RUNTIME_DIR="/run/user/${LVA_USER_ID}"
Environment=LVA_PULSE_COOKIE="/home/pi/linux-voice-assistant/tmp_pulse_cookie"
Environment=PREFERENCES_FILE="/home/pi/linux-voice-assistant/preferences.json" Environment=PREFERENCES_FILE="/home/pi/linux-voice-assistant/preferences.json"
# Environment=NETWORK_INTERFACE="eth0" # Environment=NETWORK_INTERFACE="eth0"
# Environment=HOST="0.0.0.0" # Environment=HOST="0.0.0.0"
@@ -276,6 +277,7 @@ The following variables can be configured in the `.env` or in the service file:
| `CLIENT_NAME` | (optional) | Custom name for this voice assistant instance | | `CLIENT_NAME` | (optional) | Custom name for this voice assistant instance |
| `LVA_PULSE_SERVER` | `unix:/run/user/${LVA_USER_ID}/pulse/native` | Path to the PulseAudio/PipeWire socket | | `LVA_PULSE_SERVER` | `unix:/run/user/${LVA_USER_ID}/pulse/native` | Path to the PulseAudio/PipeWire socket |
| `LVA_XDG_RUNTIME_DIR` | `/run/user/${LVA_USER_ID}` | XDG runtime directory | | `LVA_XDG_RUNTIME_DIR` | `/run/user/${LVA_USER_ID}` | XDG runtime directory |
| `LVA_PULSE_COOKIE` | `/app/configuration/tmp_pulse_cookie` | Cookie file for PulseAudio if you use encryption. By default disabled. We use a tmp file to avoid errors if the file is not found |
| `ENABLE_DEBUG` | (optional) | Set to "1" to enable debug mode | | `ENABLE_DEBUG` | (optional) | Set to "1" to enable debug mode |
| `LIST_DEVICES` | (optional) | Set to "1" to list audio devices instead of starting | | `LIST_DEVICES` | (optional) | Set to "1" to list audio devices instead of starting |
| `PREFERENCES_FILE` | (optional) | Path to a custom preferences JSON file | | `PREFERENCES_FILE` | (optional) | Path to a custom preferences JSON file |