Add SD image pipeline, documentation overhaul, and fix module issues
- Add automatic SD image builds for Raspberry Pi via Forgejo Actions - Enable binfmt emulation on cryodev-main for aarch64 cross-builds - Add sd-image.nix module to cryodev-pi configuration - Create comprehensive docs/ structure with installation guides - Split installation docs into: first-install (server), reinstall, new-client (Pi) - Add lib/utils.nix and apps/rebuild from synix - Fix headplane module for new upstream API (tale/headplane) - Fix various module issues (mailserver stateVersion, option conflicts) - Add placeholder secrets.yaml files for both hosts - Remove old INSTRUCTIONS.md (content moved to docs/)
This commit is contained in:
parent
a5261d8ff0
commit
5ba78886d2
44 changed files with 3570 additions and 609 deletions
183
docs/getting-started/reinstall.md
Normal file
183
docs/getting-started/reinstall.md
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
# Neuinstallation (Reinstall)
|
||||
|
||||
Diese Anleitung beschreibt die **Neuinstallation** eines bestehenden Hosts, z.B. nach Hardwarewechsel oder bei Problemen.
|
||||
|
||||
## Unterschied zur Erstinstallation
|
||||
|
||||
| Aspekt | Erstinstallation | Neuinstallation |
|
||||
|--------|------------------|-----------------|
|
||||
| SOPS-Secrets | Noch nicht vorhanden | Bereits konfiguriert |
|
||||
| SSH-Host-Key | Neu generiert | **Muss wiederhergestellt werden!** |
|
||||
| Disk-IDs | Neu ermitteln | Oft geändert (neue Hardware) |
|
||||
| secrets.yaml | Wird erstellt | Bereits vorhanden |
|
||||
|
||||
## Wichtig: SSH-Host-Key Problem
|
||||
|
||||
Bei einer Neuinstallation wird ein **neuer SSH-Host-Key** generiert. Dieser stimmt nicht mehr mit dem Age-Key in `.sops.yaml` überein!
|
||||
|
||||
### Lösungsmöglichkeiten
|
||||
|
||||
**Option A: Alten Host-Key sichern und wiederherstellen** (empfohlen)
|
||||
|
||||
**Option B: Neuen Key generieren und SOPS aktualisieren**
|
||||
|
||||
## Voraussetzungen
|
||||
|
||||
- Backup des alten SSH-Host-Keys (falls Option A)
|
||||
- Zugriff auf `.sops.yaml` und die Admin-Age-Keys
|
||||
- Bootbares NixOS ISO
|
||||
|
||||
## Schritt 1: Vorbereitung (vor der Installation)
|
||||
|
||||
### 1.1 Alten SSH-Host-Key sichern (Option A)
|
||||
|
||||
Falls der alte Host noch läuft:
|
||||
|
||||
```bash
|
||||
# Auf dem alten Host
|
||||
sudo cat /etc/ssh/ssh_host_ed25519_key > ~/ssh_host_ed25519_key.backup
|
||||
sudo cat /etc/ssh/ssh_host_ed25519_key.pub > ~/ssh_host_ed25519_key.pub.backup
|
||||
```
|
||||
|
||||
Dateien sicher auf den Entwicklungsrechner kopieren.
|
||||
|
||||
### 1.2 Disk-IDs ermitteln
|
||||
|
||||
**Bei neuer Hardware** ändern sich die Disk-IDs!
|
||||
|
||||
```bash
|
||||
# Im NixOS Live-System
|
||||
lsblk -o NAME,SIZE,MODEL,SERIAL
|
||||
ls -la /dev/disk/by-id/
|
||||
```
|
||||
|
||||
Die neue Disk-ID in `hosts/<hostname>/disks.sh` oder `disks.nix` eintragen:
|
||||
|
||||
```bash
|
||||
# Beispiel disks.sh
|
||||
DISK="/dev/disk/by-id/nvme-Samsung_SSD_970_EVO_Plus_XXXXX"
|
||||
```
|
||||
|
||||
## Schritt 2: Installation durchführen
|
||||
|
||||
### 2.1 NixOS ISO booten
|
||||
|
||||
Von USB/CD booten, Root-Passwort setzen, per SSH verbinden.
|
||||
|
||||
### 2.2 Repository klonen
|
||||
|
||||
```bash
|
||||
sudo -i
|
||||
nix-shell -p git
|
||||
git clone <GIT_REPO_URL> /tmp/nixos
|
||||
cd /tmp/nixos
|
||||
```
|
||||
|
||||
### 2.3 Disk-Konfiguration prüfen
|
||||
|
||||
```bash
|
||||
# Aktuelle Disk-IDs anzeigen
|
||||
ls -la /dev/disk/by-id/
|
||||
|
||||
# Mit Konfiguration vergleichen
|
||||
cat hosts/<hostname>/disks.sh | grep DISK
|
||||
```
|
||||
|
||||
**Falls nötig:** Disk-ID in der Konfiguration anpassen.
|
||||
|
||||
### 2.4 Install-Script ausführen
|
||||
|
||||
```bash
|
||||
bash scripts/install.sh -n <hostname>
|
||||
```
|
||||
|
||||
### 2.5 SSH-Host-Key wiederherstellen (Option A)
|
||||
|
||||
**Vor dem Reboot!**
|
||||
|
||||
```bash
|
||||
# Host-Key vom Backup wiederherstellen
|
||||
cp /path/to/ssh_host_ed25519_key.backup /mnt/etc/ssh/ssh_host_ed25519_key
|
||||
cp /path/to/ssh_host_ed25519_key.pub.backup /mnt/etc/ssh/ssh_host_ed25519_key.pub
|
||||
chmod 600 /mnt/etc/ssh/ssh_host_ed25519_key
|
||||
chmod 644 /mnt/etc/ssh/ssh_host_ed25519_key.pub
|
||||
```
|
||||
|
||||
### 2.6 Reboot
|
||||
|
||||
```bash
|
||||
umount -Rl /mnt
|
||||
reboot
|
||||
```
|
||||
|
||||
## Schritt 3: Nach dem Reboot
|
||||
|
||||
### Bei Option A (Key wiederhergestellt)
|
||||
|
||||
SOPS-Secrets sollten automatisch funktionieren. Testen:
|
||||
|
||||
```bash
|
||||
sudo cat /run/secrets/tailscale/auth-key
|
||||
```
|
||||
|
||||
### Bei Option B (Neuer Key)
|
||||
|
||||
Der Host kann die Secrets nicht entschlüsseln. Neuen Key konfigurieren:
|
||||
|
||||
```bash
|
||||
# Neuen Age-Key ermitteln
|
||||
nix-shell -p ssh-to-age --run 'cat /etc/ssh/ssh_host_ed25519_key.pub | ssh-to-age'
|
||||
```
|
||||
|
||||
Auf dem Entwicklungsrechner:
|
||||
|
||||
```bash
|
||||
# .sops.yaml aktualisieren mit neuem Key
|
||||
vim .sops.yaml
|
||||
|
||||
# Secrets mit neuem Key neu verschlüsseln
|
||||
sops updatekeys hosts/<hostname>/secrets.yaml
|
||||
```
|
||||
|
||||
Dann Konfiguration neu deployen:
|
||||
|
||||
```bash
|
||||
nixos-rebuild switch --flake .#<hostname> --target-host root@<IP>
|
||||
```
|
||||
|
||||
## Häufige Probleme
|
||||
|
||||
### "No secret key available"
|
||||
|
||||
SOPS kann die Secrets nicht entschlüsseln. Ursache:
|
||||
- SSH-Host-Key stimmt nicht mit Age-Key in `.sops.yaml` überein
|
||||
|
||||
Lösung: Option B durchführen (neuen Key konfigurieren).
|
||||
|
||||
### "Device not found" beim Partitionieren
|
||||
|
||||
Disk-ID in `disks.sh`/`disks.nix` ist falsch.
|
||||
|
||||
```bash
|
||||
# Richtige ID finden
|
||||
ls -la /dev/disk/by-id/
|
||||
```
|
||||
|
||||
### Hardware-Config veraltet
|
||||
|
||||
Bei neuer Hardware muss `hardware.nix` neu generiert werden:
|
||||
|
||||
```bash
|
||||
# Install-Script generiert automatisch neu, falls Datei fehlt
|
||||
rm hosts/<hostname>/hardware.nix
|
||||
bash scripts/install.sh -n <hostname>
|
||||
```
|
||||
|
||||
## Checkliste
|
||||
|
||||
- [ ] Alten SSH-Host-Key gesichert (falls möglich)
|
||||
- [ ] Disk-IDs in Konfiguration geprüft/aktualisiert
|
||||
- [ ] Installation durchgeführt
|
||||
- [ ] SSH-Host-Key wiederhergestellt ODER neuen Key in SOPS konfiguriert
|
||||
- [ ] Secrets funktionieren (`sudo cat /run/secrets/...`)
|
||||
- [ ] Tailscale verbunden (`tailscale status`)
|
||||
Loading…
Add table
Add a link
Reference in a new issue