Understanding the Problem
You're experiencing authentication errors and crashes in Rpanion-Server, particularly with the Network Config tab. The first three tabs work, but others show auth errors, and crashes require re-login. This suggests token authentication issues.
1Accessing Rpanion-Server Logs
Rpanion-Server logs are crucial for debugging. Here's how to access them:
# SSH into your Raspberry Pi
ssh drobotics@raspberrypi
# Check if Rpanion-Server is running as a service
sudo systemctl status rpanion-server
# View live logs (if running as service)
sudo journalctl -u rpanion-server -f
# Alternatively, if running directly
sudo tail -f /var/log/rpanion-server.log
Note
If you don't see logs in these locations, check the Rpanion-Server configuration for custom log paths.
2Understanding Log Messages
Look for these key patterns in the logs:
# Authentication errors
[AUTH] Invalid token
[AUTH] Token expired
[ERROR] Authentication failed
# Network configuration issues
[NETWORK] Error
[NETWORK] Crash
Socket error
# Database issues
SQLite error
Database locked
DB query failed
Common Error Patterns
- Token validation failures
- Database permission issues
- Network socket errors
- API endpoint authentication failures
What to Look For
- Stack traces pointing to specific files
- Authentication middleware errors
- Database connection issues
- Network configuration errors
1Debugging Authentication Issues
Authentication problems often stem from token validation issues. Here's how to diagnose:
# Check token validation logic (if you have code access)
# Look for token expiration checks
# Verify system time is correct (incorrect time can cause token expiration)
date
sudo timedatectl status
# Check token storage
ls -la ~/.rpanion/
ls -la /var/lib/rpanion/
2Resetting Authentication
If authentication is broken, try these steps:
# Restart the Rpanion-Server service
sudo systemctl restart rpanion-server
# Clear browser cache and cookies for the Rpanion interface
# Or try incognito mode to rule out browser issues
# Check if authentication database is corrupted
ls -la /var/lib/rpanion/users.db
sudo sqlite3 /var/lib/rpanion/users.db.tables
Important
Backup any database before making changes to avoid data loss.
3Recreating Auth Tokens
If tokens are corrupted or expired, you may need to reset them:
# Find where tokens are stored (check config files)
grep -r "token" /etc/rpanion/
grep -r "token" /usr/lib/rpanion/
# Stop Rpanion-Server before modifying files
sudo systemctl stop rpanion-server
# Backup then remove token files (location may vary)
sudo mv /var/lib/rpanion/tokens.json /var/lib/rpanion/tokens.json.backup
# Restart service
sudo systemctl start rpanion-server
1Debugging Network Config Crashes
The Network Config tab crash might be related to specific network operations:
# Check network interfaces that might cause issues
ip addr show
sudo iwconfig
# Look for specific errors in logs when accessing Network Config
sudo journalctl -u rpanion-server -f
# Then reproduce the crash by accessing the Network Config tab
2Testing Network Operations
Test the network operations that might be causing crashes:
# Check if network scanning works
sudo iwlist wlan0 scan | head -20
# Check if hostapd (access point) is running
sudo systemctl status hostapd
# Check dnsmasq status
sudo systemctl status dnsmasq
# Look for conflicts between services
sudo netstat -tulpn | grep:53
sudo netstat -tulpn | grep:67
3Fixing Network Configuration
If specific network operations are causing crashes:
# Try stopping potentially conflicting services
sudo systemctl stop hostapd
sudo systemctl stop dnsmasq
# Restart Rpanion-Server and see if Network Config works now
sudo systemctl restart rpanion-server
# If it works, you need to configure services to not conflict
# Check Rpanion-Server documentation for proper service configuration
Pro Tip
Some network operations require root privileges. Ensure Rpanion-Server has the necessary permissions or configure it to use polkit rules for specific operations.
1Preventing Future Issues
To avoid these problems in the future:
# Set up log rotation to prevent log files from growing too large
sudo nano /etc/logrotate.d/rpanion-server
# Add the following:
/var/log/rpanion-server.log {
daily
missingok
rotate 7
compress
delaycompress
notifempty
create 640 rpanion rpanion
}
2Regular Maintenance
Implement regular maintenance routines:
# Create a cleanup script
sudo nano /usr/local/bin/rpanion-maintenance.sh
# Add the following:
#!/bin/bash
# Clear old tokens older than 30 days
find /var/lib/rpanion/tokens -type f -mtime +30 -delete
# Optimize database
sqlite3 /var/lib/rpanion/users.db "VACUUM;"
# Restart service to apply changes
systemctl restart rpanion-server
# Make executable and set up cron job
sudo chmod +x /usr/local/bin/rpanion-maintenance.sh
sudo crontab -e
# Add: 0 3 * * 0 /usr/local/bin/rpanion-maintenance.sh
3Monitoring Setup
Set up monitoring to detect issues early:
# Install and configure a simple monitoring solution
sudo apt install monit
# Configure monit for Rpanion-Server
sudo nano /etc/monit/conf.d/rpanion
# Add:
check process rpanion-server with pidfile /var/run/rpanion-server.pid
start program = "/usr/bin/systemctl start rpanion-server"
stop program = "/usr/bin/systemctl stop rpanion-server"
if failed url http://localhost:8080/api/health
and content == 'OK' then restart
if 3 restarts within 5 cycles then timeout