202 lines
6.6 KiB
Markdown
202 lines
6.6 KiB
Markdown
# MYP Setup-Skript Verbesserungen v5.1.0
|
|
|
|
## Übersicht der Korrekturen
|
|
|
|
Das Setup-Skript wurde vollständig überarbeitet, um die automatische Anmeldung und das Kiosk-System zuverlässig zu implementieren. Die wichtigsten Verbesserungen:
|
|
|
|
## 🧹 PHASE 1: Vollständige Umgebungsbereinigung
|
|
|
|
### `complete_environment_cleanup()`
|
|
- **Vollständige Desktop-Environment-Entfernung**: GNOME, KDE, XFCE, LXDE, MATE, Cinnamon
|
|
- **Python-Bereinigung**: Entfernt alte Python-Installationen und pip-Pakete
|
|
- **Snap/Flatpak-Bereinigung**: Entfernt alle Snap- und Flatpak-Pakete
|
|
- **Cache-Bereinigung**: Leert alle System-Caches und temporäre Dateien
|
|
|
|
```bash
|
|
# Beispiel der Bereinigung
|
|
apt-get remove --purge -y gnome* kde* xfce4* lxde* mate* cinnamon*
|
|
rm -rf /usr/local/lib/python3.*/dist-packages/*
|
|
rm -rf /var/cache/apt/archives/*
|
|
```
|
|
|
|
## 🐍 PHASE 2: Saubere Python-Umgebung
|
|
|
|
### `setup_clean_python_environment()`
|
|
- **Python 3.11 Installation**: Über deadsnakes PPA
|
|
- **pip-Konfiguration**: Automatische `--break-system-packages` Konfiguration
|
|
- **Alternative-System**: Python 3.11 als Standard gesetzt
|
|
- **Entwicklungstools**: Alle notwendigen Header und Build-Tools
|
|
|
|
```bash
|
|
# pip-Konfiguration für System-Pakete
|
|
[global]
|
|
break-system-packages = true
|
|
trusted-host = pypi.org
|
|
pypi.python.org
|
|
files.pythonhosted.org
|
|
timeout = 60
|
|
retries = 3
|
|
```
|
|
|
|
### `install_python_packages_with_break_system()`
|
|
- **Robuste Installation**: Mehrere Fallback-Strategien
|
|
- **Einzelpaket-Installation**: Falls Batch-Installation fehlschlägt
|
|
- **Modul-Validierung**: Überprüfung aller essentiellen Module
|
|
- **Python 3.11 spezifisch**: Verwendet explizit `python3.11 -m pip`
|
|
|
|
## 🖥️ PHASE 3: Minimales Desktop-Environment
|
|
|
|
### `install_minimal_desktop_environment()`
|
|
- **X11-Basis**: Xorg, xinit, x11-xserver-utils
|
|
- **Window Manager**: OpenBox als leichtgewichtiger WM
|
|
- **Display Manager**: LightDM mit automatischer Konfiguration
|
|
- **Browser**: Chromium mit Fallback auf Firefox-ESR
|
|
- **Audio-Support**: PulseAudio und ALSA
|
|
- **Schriftarten**: Vollständige Font-Sammlung
|
|
|
|
```bash
|
|
# LightDM Autologin-Konfiguration
|
|
[Seat:*]
|
|
autologin-user=kiosk
|
|
autologin-user-timeout=0
|
|
user-session=openbox
|
|
```
|
|
|
|
## 🔐 PHASE 4: Robuste Autologin-Konfiguration
|
|
|
|
### `configure_autologin_robust()`
|
|
- **Mehrfache Methoden**: Getty, LightDM, nodm parallel
|
|
- **Getty-Service**: Systemd-Override für tty1
|
|
- **LightDM-Integration**: Automatische Konfiguration falls verfügbar
|
|
- **Nodm-Fallback**: Minimaler Display Manager als Backup
|
|
- **Passwort-Entfernung**: Automatischer Login ohne Passwort
|
|
|
|
```bash
|
|
# Getty-Service Override
|
|
[Service]
|
|
ExecStart=
|
|
ExecStart=-/sbin/agetty --autologin kiosk --noclear %I $TERM
|
|
Type=idle
|
|
Restart=always
|
|
RestartSec=0
|
|
```
|
|
|
|
## 🚀 PHASE 5: Robuste Kiosk-Autostart-Konfiguration
|
|
|
|
### `configure_kiosk_autostart_robust()`
|
|
- **Mehrfache Fallback-Strategien**: X11-Server, Browser, Backend
|
|
- **Lock-Mechanismus**: Verhindert mehrfache Ausführung
|
|
- **X11-Server-Management**: Automatischer Start und Überwachung
|
|
- **Backend-Verfügbarkeit**: Wartet auf MYP-Backend (120s timeout)
|
|
- **Browser-Optimierung**: Chromium mit vollständigen Kiosk-Parametern
|
|
|
|
```bash
|
|
# Robuste .bashrc mit Fallback-Strategien
|
|
start_x11_server() {
|
|
# Alte X-Prozesse beenden
|
|
pkill -f "X :0" 2>/dev/null || true
|
|
|
|
# X11-Server starten (mehrere Methoden)
|
|
if [ -x /usr/local/bin/start-x11-kiosk ]; then
|
|
/usr/local/bin/start-x11-kiosk &
|
|
else
|
|
startx /home/kiosk/.xinitrc -- :0 vt7 -novtswitch &
|
|
fi
|
|
}
|
|
```
|
|
|
|
### Kiosk-Watchdog-Service
|
|
- **Prozess-Überwachung**: X11-Server und Browser
|
|
- **Automatischer Neustart**: Bei Prozess-Ausfall
|
|
- **Logging**: Vollständige Protokollierung in `/var/log/kiosk-watchdog.log`
|
|
- **Systemd-Integration**: Als Service mit automatischem Restart
|
|
|
|
## 📦 PHASE 6: Phasenbasierte Installation
|
|
|
|
### Neue Installationsstruktur
|
|
```bash
|
|
# PHASE 1: UMGEBUNGSBEREINIGUNG
|
|
complete_environment_cleanup
|
|
setup_clean_python_environment
|
|
|
|
# PHASE 2: DESKTOP-ENVIRONMENT
|
|
install_minimal_desktop_environment
|
|
configure_x11_for_raspberry_pi
|
|
|
|
# PHASE 3: ANWENDUNGS-INSTALLATION
|
|
install_python_packages_with_break_system
|
|
deploy_application
|
|
|
|
# PHASE 4: KIOSK-SYSTEM
|
|
configure_autologin_robust
|
|
configure_kiosk_autostart_robust
|
|
|
|
# PHASE 5: SERVICES UND OPTIMIERUNG
|
|
install_systemd_services
|
|
enable_and_start_services
|
|
|
|
# PHASE 6: SYSTEM-TESTS
|
|
test_application
|
|
```
|
|
|
|
## 🔧 Technische Verbesserungen
|
|
|
|
### Python 3.11 Integration
|
|
- **Explizite Verwendung**: Alle pip-Befehle verwenden `python3.11 -m pip`
|
|
- **System-Pakete**: `--break-system-packages` automatisch konfiguriert
|
|
- **Alternative-System**: Python 3.11 als Standard-Python3 gesetzt
|
|
|
|
### X11-Konfiguration
|
|
- **Raspberry Pi spezifisch**: Framebuffer-Konfiguration
|
|
- **Mehrfache Treiber**: fbdev und modesetting als Fallback
|
|
- **Fehlerbehandlung**: Robuste X11-Server-Starts
|
|
|
|
### Browser-Konfiguration
|
|
- **Chromium-Optimierung**: Vollständige Kiosk-Parameter
|
|
- **Memory-Management**: Optimiert für Raspberry Pi
|
|
- **Sicherheit**: Deaktivierte Sicherheitsfeatures für Kiosk
|
|
- **Vollbild-Modus**: Echte Kiosk-Erfahrung
|
|
|
|
## 🚨 Wichtige Hinweise
|
|
|
|
### Nach der Installation
|
|
1. **Neustart erforderlich**: Für vollständige Kiosk-Aktivierung
|
|
2. **Automatischer Login**: Kiosk-User loggt sich automatisch ein
|
|
3. **Browser-Start**: Chromium startet automatisch im Kiosk-Modus
|
|
4. **Backend-Abhängigkeit**: Wartet auf MYP-Backend auf Port 5000
|
|
|
|
### Fehlerbehebung
|
|
- **Logs prüfen**: `/var/log/kiosk-watchdog.log`
|
|
- **X11-Fehler**: `/tmp/x11-error.log`
|
|
- **Service-Status**: `systemctl status kiosk-watchdog`
|
|
- **Manual-Start**: `/usr/local/bin/kiosk-watchdog.sh`
|
|
|
|
### Fallback-Mechanismen
|
|
- **X11-Server**: Mehrere Start-Methoden
|
|
- **Browser**: Chromium → Firefox-ESR Fallback
|
|
- **Display Manager**: LightDM → nodm → Getty Fallback
|
|
- **Backend**: Startet auch ohne Backend-Verfügbarkeit
|
|
|
|
## 📋 Checkliste für erfolgreiche Installation
|
|
|
|
- [ ] Vollständige Umgebungsbereinigung durchgeführt
|
|
- [ ] Python 3.11 als Standard installiert
|
|
- [ ] pip mit --break-system-packages konfiguriert
|
|
- [ ] Minimales Desktop-Environment installiert
|
|
- [ ] Autologin für kiosk-User konfiguriert
|
|
- [ ] Kiosk-Autostart-Mechanismus implementiert
|
|
- [ ] Watchdog-Service aktiviert
|
|
- [ ] System-Neustart durchgeführt
|
|
- [ ] Automatischer Kiosk-Start funktioniert
|
|
- [ ] Browser öffnet MYP-Anwendung
|
|
|
|
## 🎯 Ergebnis
|
|
|
|
Nach der Installation:
|
|
1. System startet automatisch
|
|
2. Kiosk-User loggt sich automatisch ein
|
|
3. X11-Server startet automatisch
|
|
4. Browser öffnet automatisch http://localhost:5000
|
|
5. Vollständiger Kiosk-Modus ohne Benutzerinteraktion
|
|
|
|
Das System ist jetzt vollständig automatisiert und benötigt keine manuelle Konfiguration mehr. |