TeamSpeak Echoion Bot - Systemd Service
This directory contains systemd service files and scripts for running TeamSpeak 3 client with Echoion bot in headless mode using Weston Wayland compositor with RDP backend.
Files
teamspeak-echoion.service- System-wide systemd service (runs as root/system)teamspeak-echoion-user.service- User systemd service (runs as user)run-teamspeak-headless.sh- Wrapper script for manual executioninstall-service.sh- Installation scriptstart-echoion.sh- Quick start helper script (handles DBus session issues)diagnose-echoion.sh- Diagnostic tool for troubleshootingstart-with-tmux.sh- Alternative startup using tmux
Prerequisites
-
Weston - Wayland compositor
sudo pacman -S weston -
DBus - For session management
sudo pacman -S dbus -
TeamSpeak 3 Client - Installed in
/home/bot/TeamSpeak3-Client-linux_amd64 -
TLS Certificates - For RDP connections
# Generate self-signed certificates openssl req -x509 -newkey rsa:4096 \ -keyout ~/.config/EchoionTsBot.key \ -out ~/.config/EchoionTsBot.crt \ -days 365 -nodes
Quick Install
Option 1: User Service (Recommended)
Run as your bot user:
cd ~/echoion/scripts
./install-service.sh user
This creates a user service that runs as the bot user.
⚠️ Important: DBus Session Error
If you get an error like:
Failed to connect to user scope bus via local transport: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined
This happens when running from a minimal shell without a full user session. This is normal and the service files are still installed correctly. See the DBus Session section below for solutions.
Option 2: System Service
Run as root:
cd /path/to/echoion/scripts
sudo ./install-service.sh system
Manual Installation
User Service
-
Copy service file:
mkdir -p ~/.config/systemd/user cp teamspeak-echoion-user.service ~/.config/systemd/user/teamspeak-echoion.service -
Copy wrapper script:
mkdir -p ~/echoion/scripts cp run-teamspeak-headless.sh ~/echoion/scripts/ chmod +x ~/echoion/scripts/run-teamspeak-headless.sh -
Reload systemd:
systemctl --user daemon-reload -
Start service:
systemctl --user start teamspeak-echoion -
Enable on login:
systemctl --user enable teamspeak-echoion -
Enable on boot (without login):
sudo loginctl enable-linger $(whoami)
System Service
-
Copy service file:
sudo cp teamspeak-echoion.service /etc/systemd/system/ -
Edit service file to match your user:
sudo systemctl edit --full teamspeak-echoion -
Reload systemd:
sudo systemctl daemon-reload -
Start service:
sudo systemctl start teamspeak-echoion -
Enable on boot:
sudo systemctl enable teamspeak-echoion
DBus Session Setup
When running the install script or systemd commands via SSH or a minimal shell, you may encounter:
Failed to connect to user scope bus via local transport: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined
This is normal and the service files are still installed correctly. Here are the solutions:
Solution 1: Use SSH with PTY (Easiest)
Connect with a pseudo-terminal allocation:
ssh -t bot@your-server bash
Then run systemd commands normally:
systemctl --user daemon-reload
systemctl --user start teamspeak-echoion
Solution 2: Enable Lingering and Reboot
Enable lingering so the user services start on boot without needing a login session:
sudo loginctl enable-linger bot
Then reboot the server. After reboot, the service will start automatically.
Solution 3: Manual Start (No systemd)
If you just want to test or can't get systemd working:
~/echoion/scripts/run-teamspeak-headless.sh
Or use the helper script:
~/echoion/scripts/start-echoion.sh
Solution 4: Use tmux/screen
Run in a persistent terminal session:
tmux new-session -d -s teamspeak '~/echoion/scripts/run-teamspeak-headless.sh'
To view: tmux attach -t teamspeak
To detach: Press Ctrl+B then D
Solution 5: System Service (No DBus needed)
Install as a system service instead (requires root):
sudo ~/echoion/scripts/install-service.sh system
Usage
Check Service Status
User service:
systemctl --user status teamspeak-echoion
System service:
sudo systemctl status teamspeak-echoion
View Logs
User service:
journalctl --user -u teamspeak-echoion -f
System service:
sudo journalctl -u teamspeak-echoion -f
Stop Service
User service:
systemctl --user stop teamspeak-echoion
System service:
sudo systemctl stop teamspeak-echoion
Restart Service
User service:
systemctl --user restart teamspeak-echoion
System service:
sudo systemctl restart teamspeak-echoion
RDP Connection
Once the service is running, you can connect via RDP to manage TeamSpeak:
Default port is now 3390 (changed from 3389 to avoid conflicts):
xfreerdp3 /v:localhost:3390 /u:bot /p: /cert:ignore
Or use any RDP client with:
- Host: Your server IP or localhost
- Port: 3390 (default, or change in service file)
- Username: bot (or your configured user)
- TLS: Enabled (uses the certificates you provided)
To use a different port, edit the service:
systemctl --user edit --full teamspeak-echoion
Change RDP_PORT=3390 to your preferred port.
Configuration
Edit the service file to customize:
- User/Group: Change
botto your bot user - Paths: Update paths to TeamSpeak, certificates, and scripts
- Environment: Add or modify environment variables
- Resources: Adjust
LimitNOFILEandLimitNPROC - Restart policy: Change
RestartandRestartSecvalues
Troubleshooting
Service fails to start
-
Check logs:
journalctl -u teamspeak-echoion --no-pager -n 50 -
Verify certificates exist:
ls -la ~/.config/EchoionTsBot.* -
Test wrapper script manually:
~/echoion/scripts/run-teamspeak-headless.sh
Weston/RDP issues
Error: "RDP unable to bind socket"
This is the most common error. Several things can cause this:
1. Port already in use or permission denied
# Check if port is in use
sudo ss -tlnp | grep 3389
# Try a different port (edit service file to use port 3390 or higher)
export RDP_PORT=3390
~/echoion/scripts/run-teamspeak-headless.sh
2. Certificate issues
# Check certificates exist and are readable
ls -la ~/.config/EchoionTsBot.*
# Generate new certificates if needed
openssl req -x509 -newkey rsa:4096 \
-keyout ~/.config/EchoionTsBot.key \
-out ~/.config/EchoionTsBot.crt \
-days 365 -nodes
# Fix permissions
chmod 600 ~/.config/EchoionTsBot.key
chmod 644 ~/.config/EchoionTsBot.crt
3. Missing weston RDP backend
# Check if RDP backend is installed
ls -la /usr/lib/libweston-*/rdp-backend.so
# If missing, install weston properly
sudo pacman -S weston
4. Test weston without TeamSpeak
# Create test directory
mkdir -p /tmp/test-weston
export XDG_RUNTIME_DIR=/tmp/test-weston
# Test weston only
dbus-run-session -- weston --backend=rdp --rdp-port=3390
# If this works, the issue is with the full setup
5. Use alternative port (3390 instead of 3389) The service now defaults to port 3390 to avoid conflicts. To change the port:
Edit the service file:
systemctl --user edit --full teamspeak-echoion
Change:
Environment="RDP_PORT=3390"
To your preferred port (e.g., 3391, 3392, etc.)
Other RDP issues
-
Check weston configuration:
cat ~/.config/weston.ini -
Run diagnostic script:
~/echoion/scripts/diagnose-echoion.sh -
Check weston logs:
journalctl --user -u teamspeak-echoion --no-pager -n 100
Permission issues
-
Check file ownership:
ls -la ~/TeamSpeak3-Client-linux_amd64/ ls -la ~/.config/EchoionTsBot.* -
Fix permissions:
sudo chown -R bot:bot ~/TeamSpeak3-Client-linux_amd64/ sudo chown bot:bot ~/.config/EchoionTsBot.*
Security Notes
-
Firewall: Restrict RDP port (3389) access to trusted IPs only
sudo ufw allow from 192.168.1.0/24 to any port 3389 -
Certificates: Use proper TLS certificates in production, not self-signed
-
User permissions: Run as non-root user with minimal privileges
-
Network isolation: Consider running in a container or VM for isolation
Uninstallation
User Service
systemctl --user stop teamspeak-echoion
systemctl --user disable teamspeak-echoion
rm ~/.config/systemd/user/teamspeak-echoion.service
systemctl --user daemon-reload
System Service
sudo systemctl stop teamspeak-echoion
sudo systemctl disable teamspeak-echoion
sudo rm /etc/systemd/system/teamspeak-echoion.service
sudo systemctl daemon-reload