Enhance code robustness and fix several critical issues identified during code review: **Error Handling:** - Add set -euo pipefail to all modules for consistent error detection - Add sleep delays after partition refresh to prevent race conditions **Bug Fixes:** - Fix package verification flag from -R to -r (xbps-query) - Fix swap file creation for btrfs (use dd instead of fallocate) - Add atomic fstab updates with backup mechanism **Optimizations:** - Remove @swap btrfs subvolume, use regular directory instead - Direct dd usage for btrfs swap files (COW-compatible) - Optimize swap creation logic per filesystem type **Security:** - Add GRUB/LUKS2 compatibility check with version warning - Create fstab backup before modifications Changes affect 14 files across all installer phases. All changes improve reliability, error detection, and filesystem compatibility. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
180 lines
6.1 KiB
Markdown
180 lines
6.1 KiB
Markdown
# Void Bootstrapp - Vollständiger CLI-Installer
|
|
|
|
Ein vollautomatischer Bash-Installer für verschlüsselte Void Linux Installationen.
|
|
|
|
## Überblick
|
|
|
|
Dieser Installer automatisiert die komplette Installation von Void Linux mit LUKS2-Verschlüsselung, btrfs/ext4-Dateisystem und allen erforderlichen System-Konfigurationen - **ohne manuelle Eingriffe**.
|
|
|
|
**Was ist neu (v2.0):**
|
|
- Vollständig automatisiert - keine manuelle void-installer Navigation mehr
|
|
- Package-Installation (Base-System, Kernel, Tools)
|
|
- Locale/Timezone/Keyboard-Konfiguration
|
|
- User-Management (Root + Standard-User mit sudo)
|
|
- Service-Aktivierung (dhcpcd für Netzwerk)
|
|
|
|
## Installation-Workflow
|
|
|
|
Der Installer führt folgende Phasen automatisch aus:
|
|
|
|
1. **Sanity Checks** - Root-Rechte, UEFI-Modus, Zielplatte validieren
|
|
2. **Konfiguration** - Interaktive Eingabe aller Parameter
|
|
3. **Partitionierung** - GPT-Layout (ESP + Root-Partition)
|
|
4. **Verschlüsselung** - LUKS2/LUKS1 auf Root-Partition
|
|
5. **Dateisysteme** - btrfs (mit Subvolumes) oder ext4
|
|
6. **Mounts** - Alle Dateisysteme mounten
|
|
7. **Packages** - Base-System, Kernel, Network-Tools installieren
|
|
8. **Locale** - System-Sprache, Timezone, Keyboard konfigurieren
|
|
9. **Users** - Root-Passwort + Standard-User mit sudo anlegen
|
|
10. **Services** - dhcpcd (Netzwerk) aktivieren
|
|
11. **Post-Install** - initramfs, GRUB, crypttab, Swap-File, fstab
|
|
|
|
## Verwendung
|
|
|
|
```bash
|
|
sudo ./src/main.sh [--dry-run]
|
|
```
|
|
|
|
### Flags
|
|
|
|
- `--dry-run`: Zeigt die Konfiguration und bricht ohne Änderungen ab
|
|
|
|
## Konfiguration
|
|
|
|
Während der Installation werden folgende Parameter abgefragt:
|
|
|
|
### Disk-Konfiguration
|
|
- **Target Disk**: Zielplatte (z.B. `/dev/sda`)
|
|
- **Hostname**: System-Hostname
|
|
- **Filesystem**: `btrfs` (Standard) oder `ext4`
|
|
- **LUKS Version**: `2` (Standard) oder `1` (für ältere GRUB-Versionen)
|
|
- **ESP Size**: EFI System Partition Größe (Standard: `1GiB`)
|
|
- **Root End**: Ende der Root-Partition (Standard: `100%`)
|
|
- **Swap Size**: Swap-File Größe (Standard: `4GiB`, `0` zum Deaktivieren)
|
|
|
|
### Locale-Konfiguration
|
|
- **Locale**: System-Sprache (Standard: `en_US.UTF-8`)
|
|
- **Timezone**: Zeitzone (Standard: `UTC`, z.B. `Europe/Berlin`)
|
|
- **Keyboard**: Console-Keyboard-Layout (Standard: `us`, z.B. `de-latin1`)
|
|
|
|
### User-Konfiguration
|
|
- **Username**: Name des Standard-Benutzers (erforderlich)
|
|
- **Root-Passwort**: Wird interaktiv gesetzt
|
|
- **User-Passwort**: Wird interaktiv gesetzt
|
|
|
|
Der Standard-User wird automatisch folgenden Gruppen zugeordnet:
|
|
- `wheel` - sudo-Zugang
|
|
- `audio` - Audio-Geräte
|
|
- `video` - Video-Geräte
|
|
- `storage` - Speicher-Geräte
|
|
- `network` - Netzwerk-Konfiguration
|
|
|
|
## Btrfs Subvolumes
|
|
|
|
Bei Auswahl von btrfs werden automatisch folgende Subvolumes angelegt:
|
|
|
|
- `@` → `/` (Root)
|
|
- `@home` → `/home` (Benutzer-Daten)
|
|
- `@var` → `/var` (Variable Daten)
|
|
- `@log` → `/var/log` (System-Logs)
|
|
- `@snapshots` → `/.snapshots` (Snapshot-Speicher)
|
|
|
|
**Hinweis:** Das Swap-File wird direkt im Root-Subvolume unter `/swap/swapfile` erstellt (kein separates Subvolume), da dies bei btrfs performanter ist.
|
|
|
|
## Package-Liste
|
|
|
|
Der Installer installiert standardmäßig folgende Pakete:
|
|
|
|
**Base-System:**
|
|
- `base-system` - Essential base packages
|
|
- `linux` - Linux Kernel
|
|
- `linux-firmware` - Hardware-Firmware
|
|
- `grub` - Bootloader
|
|
- `cryptsetup` - LUKS-Tools
|
|
- `dracut` - initramfs Generator
|
|
|
|
**Netzwerk:**
|
|
- `dhcpcd` - DHCP-Client
|
|
- `iproute2` - IP-Konfiguration
|
|
- `iputils` - ping, traceroute
|
|
|
|
**System-Tools:**
|
|
- `vim` - Text-Editor
|
|
- `nano` - Alternative Editor
|
|
- `sudo` - Privilege Escalation
|
|
|
|
## Nach der Installation
|
|
|
|
Nach erfolgreichem Abschluss:
|
|
|
|
1. System neustarten: `reboot`
|
|
2. LUKS-Passphrase beim Boot eingeben
|
|
3. Mit Standard-User einloggen
|
|
4. Netzwerk ist via dhcpcd automatisch verfügbar
|
|
5. `sudo` funktioniert für wheel-Gruppen-Mitglieder
|
|
|
|
## Systemanforderungen
|
|
|
|
- **Boot-Modus**: UEFI (BIOS wird nicht unterstützt)
|
|
- **Architektur**: x86_64
|
|
- **Live-Medium**: Void Linux Live-ISO
|
|
- **Netzwerk**: Für Package-Download erforderlich
|
|
|
|
## Hinweise
|
|
|
|
- **Destruktiv**: Der Installer löscht die Zielplatte nach expliziter Bestätigung
|
|
- **Interaktiv**: Passwörter werden aus Sicherheitsgründen interaktiv abgefragt
|
|
- **Logs**: Unter `/tmp/void-wrapper-YYYY-MM-DD-HHMMSS.log`
|
|
- **Package-Install**: Erfolgt direkt ins Ziel-Root via `xbps-install -R /mnt` (kein void-installer)
|
|
- **fstab**: Wird automatisch geschrieben, inklusive `/boot/efi` und Swap-File
|
|
|
|
## Fehlerbehebung
|
|
|
|
Bei Fehlern während der Installation:
|
|
|
|
1. **Fehler in Packages-Phase**: Netzwerk-Konnektivität und Mirror-Status prüfen
|
|
2. **Fehler in Users-Phase**: Passwort-Eingabe wiederholen
|
|
3. **Rollback angeboten**: Bei Fehler werden Mounts und LUKS-Mappings automatisch aufgeräumt
|
|
|
|
Für detaillierte Fehleranalyse siehe Log-Datei.
|
|
|
|
## Entwicklung
|
|
|
|
### Struktur
|
|
|
|
```
|
|
src/
|
|
├── main.sh # Orchestrierung aller Phasen
|
|
├── logging.sh # Logging-Funktionen
|
|
├── config.sh # Konfigurations-Prompts und Validierung
|
|
├── sanity.sh # System-Checks
|
|
├── partitioning.sh # GPT-Partitionierung
|
|
├── encryption.sh # LUKS-Setup
|
|
├── filesystems.sh # Dateisystem-Formatierung
|
|
├── mounts.sh # Mount-Management
|
|
├── packages.sh # Package-Installation
|
|
├── locale.sh # Locale/Timezone/Keyboard
|
|
├── users.sh # User-Management
|
|
├── services.sh # Service-Aktivierung
|
|
├── postinstall.sh # initramfs, GRUB, crypttab
|
|
└── rollback.sh # Cleanup bei Fehlern
|
|
```
|
|
|
|
### Architektur-Prinzipien
|
|
|
|
- **Narrative Documentation**: Jedes Modul dokumentiert Motivation, Decisions, Alternatives
|
|
- **Modulare Phasen**: Jede Phase ist eigenständig und testbar
|
|
- **Error Handling**: `set -euo pipefail` + trap-basiertes Rollback
|
|
- **Logging**: Alle Operationen werden geloggt
|
|
|
|
## Zukünftige Erweiterungen
|
|
|
|
- Config-File Support (JSON) für unattended Installations
|
|
- Desktop-Environment Auswahl (XFCE, KDE, GNOME)
|
|
- Zusätzliche Service-Optionen (sshd, chronyd)
|
|
- Checkpoint-System für Phase-Wiederaufnahme
|
|
|
|
## Lizenz
|
|
|
|
Dieses Projekt ist für Void Linux Installationen optimiert und folgt den Best Practices der Void Linux Dokumentation.
|