Projektarbeit-MYP/backend/app/docs/KEYMAP_PROBLEME_BEHOBEN.md

3.7 KiB

Keymap-Probleme Behoben

Problem-Beschreibung

Das ursprüngliche Installationsskript hatte Probleme mit der deutschen Tastaturlayout-Konfiguration, insbesondere:

  • localectl konnte keine Keymaps lesen
  • Fehlende deutsche Keymap-Dateien
  • Unvollständige keyboard-configuration-Pakete
  • Fehlerhafte systemd-localed-Konfiguration

Implementierte Lösung

1. Erweiterte Paket-Installation

# Vollständige Keyboard-Unterstützung
apt-get install -y \
    keyboard-configuration \
    console-setup \
    console-data \
    kbd \
    console-common \
    xkb-data \
    locales

2. Debconf-Vorkonfiguration

# Automatische Konfiguration ohne Benutzerinteraktion
echo "keyboard-configuration keyboard-configuration/layout select German" | debconf-set-selections
echo "keyboard-configuration keyboard-configuration/layoutcode string de" | debconf-set-selections
echo "keyboard-configuration keyboard-configuration/model select Generic 105-key (Intl) PC" | debconf-set-selections

3. Keymap-Verzeichnis-Reparatur

  • Erstellt fehlende Keymap-Verzeichnisse
  • Prüft auf vorhandene deutsche Keymaps
  • Erstellt Fallback-Keymap falls nötig

4. localectl-Reparatur

# Startet systemd-localed Service
systemctl start systemd-localed
systemctl enable systemd-localed

# Testet und repariert localectl-Funktionalität
if localectl status &> /dev/null; then
    localectl set-keymap de
    localectl set-x11-keymap de
fi

5. Multiple Fallback-Methoden

  1. Primär: localectl (systemd)
  2. Sekundär: /etc/default/keyboard
  3. Tertiär: /etc/vconsole.conf
  4. Fallback: Manuelle Keymap-Erstellung

6. Console-Setup-Integration

# Console-Setup konfigurieren
cat > "/etc/default/console-setup" << EOF
ACTIVE_CONSOLES="/dev/tty[1-6]"
CHARMAP="UTF-8"
CODESET="guess"
FONTFACE="Fixed"
FONTSIZE="8x16"
EOF

# Setupcon ausführen
setupcon --force --save

Neue Funktion: fix_keymap_issues()

Diese Funktion wird in Phase 0.3 der Installation ausgeführt und:

  1. Installiert alle keyboard-bezogenen Pakete
  2. Generiert deutsche Locales
  3. Prüft und repariert Keymap-Verzeichnisse
  4. Erstellt Fallback-Keymap falls nötig
  5. Testet Keymap-Funktionalität
  6. Repariert localectl-Konfiguration
  7. Konfiguriert vconsole.conf
  8. Aktualisiert initramfs

Fehlerbehandlung

  • Graceful Degradation: Bei Fehlern wird auf alternative Methoden zurückgegriffen
  • Umfassende Logging: Alle Schritte werden protokolliert
  • Fallback-Keymaps: Manuelle Erstellung wenn Pakete fehlen
  • Service-Recovery: Automatischer Neustart von systemd-localed

Getestete Systeme

  • Raspberry Pi OS (Debian-basiert)
  • Ubuntu Server 20.04+
  • Debian 11+ (Bullseye)
  • Systeme ohne vorinstallierte Desktop-Umgebung

Referenzen

Wartung

Das Skript erstellt automatisch:

  • /etc/vconsole.conf für systemd-Systeme
  • /etc/default/keyboard für X11/Console
  • /etc/default/console-setup für Console-Setup
  • Fallback-Keymap in /usr/share/keymaps/i386/qwertz/de.kmap.gz

Bei Problemen nach der Installation:

# Keymap manuell laden
sudo loadkeys de

# localectl-Status prüfen
sudo localectl status

# Console-Setup neu konfigurieren
sudo dpkg-reconfigure keyboard-configuration

Status: Behoben
Datum: $(date +%Y-%m-%d)
Version: 2.0 (Erweiterte Keymap-Unterstützung)