Merge pull request #43 from outis1one/claude/mumble-kiosk-setup-01RUgNotdEkjq4KfNRBeqDyK

Claude/mumble kiosk setup 01 r ug notd ekjq4 kf nr beq dy k
This commit is contained in:
outis1one
2025-11-23 07:38:31 -05:00
committed by GitHub
3 changed files with 268 additions and 34 deletions
+163
View File
@@ -0,0 +1,163 @@
#!/usr/bin/env bash
# ======================================================================
# File: diagnose_talkkonnect.sh
# Purpose: Diagnose talkkonnect installation and permission issues
# ======================================================================
echo "======================================================================="
echo "TalkKonnect Installation Diagnostics"
echo "======================================================================="
echo ""
# Check if talkkonnect binary exists
echo "[1] Checking talkkonnect binary..."
if [ -f /usr/local/bin/talkkonnect ]; then
echo " ✓ Binary found: /usr/local/bin/talkkonnect"
ls -lh /usr/local/bin/talkkonnect
else
echo " ✗ Binary NOT found at /usr/local/bin/talkkonnect"
echo " Run the installation script first!"
fi
echo ""
# Check for config files in all possible locations
echo "[2] Searching for config files..."
FOUND_CONFIGS=()
for USER_DIR in /home/*; do
CONFIG="$USER_DIR/.config/talkkonnect/talkkonnect.xml"
if [ -f "$CONFIG" ]; then
FOUND_CONFIGS+=("$CONFIG")
echo " ✓ Found: $CONFIG"
ls -lh "$CONFIG"
fi
done
if [ -f "/root/.config/talkkonnect/talkkonnect.xml" ]; then
FOUND_CONFIGS+=("/root/.config/talkkonnect/talkkonnect.xml")
echo " ✓ Found: /root/.config/talkkonnect/talkkonnect.xml"
ls -lh "/root/.config/talkkonnect/talkkonnect.xml"
fi
if [ ${#FOUND_CONFIGS[@]} -eq 0 ]; then
echo " ✗ No config files found!"
fi
echo ""
# Check systemd service
echo "[3] Checking systemd service..."
if [ -f /etc/systemd/system/talkkonnect.service ]; then
echo " ✓ Service file found"
echo ""
echo " Service User:"
grep "^User=" /etc/systemd/system/talkkonnect.service || echo " (not specified)"
echo ""
echo " Config Path:"
grep "ExecStart=" /etc/systemd/system/talkkonnect.service | grep -o '\-config [^ ]*' || echo " (not found)"
echo ""
echo " Full ExecStart line:"
grep "ExecStart=" /etc/systemd/system/talkkonnect.service
echo ""
else
echo " ✗ Service file NOT found at /etc/systemd/system/talkkonnect.service"
fi
echo ""
# Check which user should run talkkonnect
echo "[4] Audio/PipeWire session detection..."
for USER_NAME in kiosk user ubuntu; do
if id "$USER_NAME" &>/dev/null; then
USER_UID=$(id -u "$USER_NAME")
echo " Checking user: $USER_NAME (UID: $USER_UID)"
# Check if PipeWire is running for this user
if [ -S "/run/user/$USER_UID/pipewire-0" ]; then
echo " ✓ PipeWire session active: /run/user/$USER_UID/pipewire-0"
else
echo " ✗ No PipeWire session found"
fi
# Check audio group membership
if groups "$USER_NAME" | grep -q audio; then
echo " ✓ In 'audio' group"
else
echo " ✗ NOT in 'audio' group"
fi
# Check input group membership (for PTT)
if groups "$USER_NAME" | grep -q input; then
echo " ✓ In 'input' group"
else
echo " ✗ NOT in 'input' group"
fi
echo ""
fi
done
# Analyze permission issues
echo "[5] Permission Analysis..."
if [ ${#FOUND_CONFIGS[@]} -gt 0 ] && [ -f /etc/systemd/system/talkkonnect.service ]; then
SERVICE_USER=$(grep "^User=" /etc/systemd/system/talkkonnect.service | cut -d= -f2)
SERVICE_CONFIG=$(grep "ExecStart=" /etc/systemd/system/talkkonnect.service | grep -o '\-config [^ ]*' | awk '{print $2}')
echo " Service configured to run as: $SERVICE_USER"
echo " Service configured to use config: $SERVICE_CONFIG"
echo ""
if [ -f "$SERVICE_CONFIG" ]; then
CONFIG_OWNER=$(stat -c '%U' "$SERVICE_CONFIG")
echo " Config file owner: $CONFIG_OWNER"
echo ""
if [ "$CONFIG_OWNER" != "$SERVICE_USER" ]; then
echo " ⚠️ PERMISSION MISMATCH!"
echo " Service runs as '$SERVICE_USER' but config is owned by '$CONFIG_OWNER'"
echo ""
echo " This is why you're getting 'permission denied'!"
echo ""
else
echo " ✓ Ownership is correct"
fi
else
echo " ✗ Config file not found at: $SERVICE_CONFIG"
fi
fi
echo ""
echo "======================================================================="
echo "Recommendations"
echo "======================================================================="
echo ""
# Provide recommendations
if [ ${#FOUND_CONFIGS[@]} -eq 0 ]; then
echo "❌ No config files found - run the installation script first:"
echo " ./talkkonnect_complete_install.sh"
elif [ ! -f /etc/systemd/system/talkkonnect.service ]; then
echo "⚠️ Config exists but no systemd service - complete the installation:"
echo " ./talkkonnect_complete_install.sh"
else
SERVICE_USER=$(grep "^User=" /etc/systemd/system/talkkonnect.service | cut -d= -f2 2>/dev/null)
SERVICE_CONFIG=$(grep "ExecStart=" /etc/systemd/system/talkkonnect.service | grep -o '\-config [^ ]*' | awk '{print $2}' 2>/dev/null)
if [ -f "$SERVICE_CONFIG" ]; then
CONFIG_OWNER=$(stat -c '%U' "$SERVICE_CONFIG" 2>/dev/null)
if [ "$CONFIG_OWNER" != "$SERVICE_USER" ]; then
echo "🔧 PERMISSION ISSUE DETECTED - Run the fix script:"
echo " sudo ./fix_talkkonnect_permissions.sh"
echo ""
echo " Or manually fix permissions:"
echo " sudo chown -R $SERVICE_USER:$SERVICE_USER $(dirname $SERVICE_CONFIG)"
else
echo "✅ Installation looks good!"
echo ""
echo "Next steps:"
echo " 1. Edit config: sudo nano $SERVICE_CONFIG"
echo " 2. Test manually: sudo -u $SERVICE_USER /usr/local/bin/talkkonnect -config $SERVICE_CONFIG"
echo " 3. Start service: sudo systemctl start talkkonnect"
echo " 4. Check status: sudo systemctl status talkkonnect"
fi
fi
fi
echo ""
+61 -8
View File
@@ -84,25 +84,78 @@ echo "Current permissions:"
ls -la "$CONFIG_DIR"
echo ""
# Check systemd service if it exists
# Check and fix systemd service if it exists
if [ -f /etc/systemd/system/talkkonnect.service ]; then
echo "[+] Checking systemd service configuration..."
SERVICE_USER=$(grep "^User=" /etc/systemd/system/talkkonnect.service | cut -d= -f2)
SERVICE_CONFIG=$(grep "^ExecStart=" /etc/systemd/system/talkkonnect.service | grep -o '\-config [^ ]*' | cut -d' ' -f2)
echo " Service runs as: $SERVICE_USER"
echo " Config path: $SERVICE_CONFIG"
echo " Current service user: $SERVICE_USER"
echo " Current config path: $SERVICE_CONFIG"
echo ""
NEED_SERVICE_UPDATE=false
if [ "$SERVICE_USER" != "$TARGET_USER" ]; then
echo ""
echo "[!] WARNING: Service is configured to run as '$SERVICE_USER' but you selected '$TARGET_USER'"
echo "[!] Update /etc/systemd/system/talkkonnect.service to use the correct user"
echo " ⚠️ Service user needs to be changed from '$SERVICE_USER' to '$TARGET_USER'"
NEED_SERVICE_UPDATE=true
fi
if [ "$SERVICE_CONFIG" != "$CONFIG_DIR/talkkonnect.xml" ]; then
echo " ⚠️ Config path needs to be updated to: $CONFIG_DIR/talkkonnect.xml"
NEED_SERVICE_UPDATE=true
fi
if [ "$NEED_SERVICE_UPDATE" = true ]; then
echo ""
echo "[!] WARNING: Service config path doesn't match!"
echo "[!] Update /etc/systemd/system/talkkonnect.service to use: $CONFIG_DIR/talkkonnect.xml"
read -p "Update systemd service file? [Y/n]: " UPDATE_SERVICE
UPDATE_SERVICE=${UPDATE_SERVICE:-Y}
if [[ "$UPDATE_SERVICE" =~ ^[Yy] ]]; then
echo "[+] Updating systemd service..."
# Get target user's UID
TARGET_UID=$(id -u "$TARGET_USER")
# Create updated service file
sudo tee /etc/systemd/system/talkkonnect.service > /dev/null <<EOFSVC
[Unit]
Description=TalkKonnect Headless Mumble Transceiver
After=network-online.target sound.target
Wants=network-online.target
[Service]
Type=simple
User=$TARGET_USER
Group=$TARGET_USER
WorkingDirectory=$TARGET_HOME
ExecStart=/usr/local/bin/talkkonnect -config $CONFIG_DIR/talkkonnect.xml
Restart=always
RestartSec=5
StandardOutput=journal
StandardError=journal
Environment="XDG_RUNTIME_DIR=/run/user/$TARGET_UID"
[Install]
WantedBy=multi-user.target
EOFSVC
echo "[+] Service file updated!"
echo "[+] Reloading systemd..."
sudo systemctl daemon-reload
# Stop service if running
if systemctl is-active --quiet talkkonnect 2>/dev/null; then
echo "[+] Stopping existing service..."
sudo systemctl stop talkkonnect
fi
echo "[+] Service is ready to start with new configuration"
else
echo "[!] Skipped service update - you'll need to update it manually"
fi
else
echo " ✓ Service configuration is correct"
fi
fi
+44 -26
View File
@@ -434,20 +434,38 @@ echo "======================================================================="
echo "[+] CREATING CONFIGURATION"
echo "======================================================================="
CONFIG_DIR="$TARGET_HOME/.config/talkkonnect"
mkdir -p "$CONFIG_DIR"
# Verify target user's home directory exists
if [ ! -d "$TARGET_HOME" ]; then
echo "[!] Error: Home directory for user '$TARGET_USER' does not exist: $TARGET_HOME"
echo "[!] Please ensure the user account is properly set up with a home directory"
echo "[!] You may need to run: sudo mkhomedir_helper $TARGET_USER"
exit 1
fi
cat > "$CONFIG_DIR/talkkonnect.xml" << 'EOFXML'
CONFIG_DIR="$TARGET_HOME/.config/talkkonnect"
# Create config directory with appropriate permissions
if [ "$TARGET_USER" != "$USER" ]; then
# Need to use sudo to create directory in another user's home
sudo -u "$TARGET_USER" mkdir -p "$CONFIG_DIR"
echo "[+] Created config directory as user: $TARGET_USER"
else
mkdir -p "$CONFIG_DIR"
echo "[+] Created config directory"
fi
# Create config file (use tee with sudo to handle permissions)
sudo tee "$CONFIG_DIR/talkkonnect.xml" > /dev/null << 'EOFXML'
<?xml version="1.0" encoding="UTF-8"?>
<document type="talkkonnect/xml">
<global>
<software>
<settings outputdevice="default"
logfilenameandpath="/home/user/.config/talkkonnect/talkkonnect.log"
logging="both"
daemonize="false"
cancelconnect="false"
simplexwithvox="false"
<settings outputdevice="default"
logfilenameandpath="/home/user/.config/talkkonnect/talkkonnect.log"
logging="both"
daemonize="false"
cancelconnect="false"
simplexwithvox="false"
nextserverindex="0"/>
<autoprovisioning enabled="false"/>
</software>
@@ -484,17 +502,17 @@ cat > "$CONFIG_DIR/talkkonnect.xml" << 'EOFXML'
<audio>
<input>
<settings enabled="true"
device="default"
samplerate="48000"
channels="1"
codec="opus"
<settings enabled="true"
device="default"
samplerate="48000"
channels="1"
codec="opus"
framespersecond="50"/>
</input>
<output>
<settings enabled="true"
device="default"
samplerate="48000"
<settings enabled="true"
device="default"
samplerate="48000"
channels="1"/>
</output>
</audio>
@@ -504,13 +522,13 @@ cat > "$CONFIG_DIR/talkkonnect.xml" << 'EOFXML'
</ptt>
<voiceactivity enabled="true">
<settings threshold="0.3"
<settings threshold="0.3"
holdtimems="1000"
holdtimeoutms="2000"/>
</voiceactivity>
<sounds enabled="false"/>
<txtts enabled="false"/>
<smtp enabled="false"/>
@@ -522,14 +540,14 @@ cat > "$CONFIG_DIR/talkkonnect.xml" << 'EOFXML'
</document>
EOFXML
# Update the log path to use actual username
sed -i "s|/home/user/|$TARGET_HOME/|g" "$CONFIG_DIR/talkkonnect.xml"
# Update the log path to use actual username (needs sudo since file was created with tee)
sudo sed -i "s|/home/user/|$TARGET_HOME/|g" "$CONFIG_DIR/talkkonnect.xml"
# Set proper ownership if running as a different user
if [ "$TARGET_USER" != "$USER" ]; then
sudo chown -R "$TARGET_USER:$TARGET_USER" "$CONFIG_DIR"
echo "[+] Set ownership of config directory to $TARGET_USER"
fi
# Set proper ownership - always needed since we used sudo tee
sudo chown -R "$TARGET_USER:$TARGET_USER" "$CONFIG_DIR"
sudo chmod 755 "$CONFIG_DIR"
sudo chmod 644 "$CONFIG_DIR/talkkonnect.xml"
echo "[+] Set ownership of config directory to $TARGET_USER"
echo "[+] Created configuration file: $CONFIG_DIR/talkkonnect.xml"