<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Ubuntu | Friedrich Wiemer</title>
    <link>https://asante.dev/de/tags/ubuntu/</link>
      <atom:link href="https://asante.dev/de/tags/ubuntu/index.xml" rel="self" type="application/rss+xml" />
    <description>Ubuntu</description>
    <generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>de</language><copyright>© 2026 Friedrich Wiemer</copyright><lastBuildDate>Sat, 21 Feb 2026 00:00:00 +0000</lastBuildDate>
    <image>
      <url>https://asante.dev/images/icon_hu_10c2cab00f70a654.png</url>
      <title>Ubuntu</title>
      <link>https://asante.dev/de/tags/ubuntu/</link>
    </image>
    
    <item>
      <title>Ubuntu 20.04 → 24.04 Dist-Upgrade: LUKS2, GRUB, Secure Boot und systemd-boot</title>
      <link>https://asante.dev/de/post/ubuntu-20.04-to-24.04-grub-to-sd-boot/</link>
      <pubDate>Sat, 21 Feb 2026 00:00:00 +0000</pubDate>
      <guid>https://asante.dev/de/post/ubuntu-20.04-to-24.04-grub-to-sd-boot/</guid>
      <description>&lt;p&gt;Diese Seite dokumentiert das Debugging eines fehlgeschlagenen Ubuntu-Release-Upgrade.
Das System war danach nicht mehr bootbar. Die Ursachen lagen in einem Zusammenspiel aus
LUKS2-Verschlüsselung, GRUB 2.12, Secure Boot und fehlenden Dotfiles — die sich
gegenseitig verstärkten und zu einer langen Kette von Folgeproblemen führten.&lt;/p&gt;
&lt;h2 id=&#34;ausgangssituation&#34;&gt;Ausgangssituation&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Xubuntu 20.04, LUKS2-verschlüsselte Root-Partition&lt;/li&gt;
&lt;li&gt;Dual-Boot mit Windows auf derselben NVMe-SSD&lt;/li&gt;
&lt;li&gt;Eine weitere verschlüsselte Partition (Veracrypt/exFAT) als gemeinsamer Datenspeicher,
gemountet unter &lt;code&gt;/home/user/data&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Persönliche Dotfiles (xmonad, zsh, vim, etc.) liegen als Symlinks auf dieser
Veracrypt-Partition&lt;/li&gt;
&lt;li&gt;Neo2-Tastaturlayout, xmonad als Window Manager, Alacritty als Terminal&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;phase-1-fehlgeschlagenes-dist-upgrade&#34;&gt;Phase 1: Fehlgeschlagenes Dist-Upgrade&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;do-release-upgrade&lt;/code&gt; von 20.04 → 22.04 gestartet. Das Upgrade blieb beim Paket
&lt;strong&gt;ConTeXt MarkIV&lt;/strong&gt; (Teil von TeXLive) hängen — ein sehr großes Paket das beim
Post-Install-Script sehr lange läuft. Es wurde manuell abgebrochen.&lt;/p&gt;
&lt;p&gt;Das System bootete danach nicht mehr. GRUB fiel direkt in die interaktive
Kommandozeile (&lt;code&gt;grub&amp;gt;&lt;/code&gt;) ohne ein Bootmenü anzuzeigen.&lt;/p&gt;
&lt;h2 id=&#34;phase-2-chroot-reparatur-via-live-usb&#34;&gt;Phase 2: Chroot-Reparatur via Live-USB&lt;/h2&gt;
&lt;p&gt;Das System wurde von einem Live-USB gebootet. Die verschlüsselte Partition wurde
manuell geöffnet und eine chroot-Umgebung eingerichtet:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;cryptsetup luksOpen /dev/sdXY cryptroot
mount /dev/mapper/cryptroot /mnt
mount /dev/sdXZ /mnt/boot/efi          # EFI-Partition
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
mount --bind /run /mnt/run
mount --bind /sys/firmware/efi/efivars /mnt/sys/firmware/efi/efivars
chroot /mnt
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Im chroot:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;dpkg --configure -a&lt;/code&gt; und &lt;code&gt;apt --fix-broken install&lt;/code&gt; reparierten kaputte Pakete&lt;/li&gt;
&lt;li&gt;Der Kernel fehlte komplett (nur initrd vorhanden, kein vmlinuz):
&lt;code&gt;apt install --reinstall linux-image-generic&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Das Upgrade wurde mit &lt;code&gt;do-release-upgrade&lt;/code&gt; auf 22.04 und anschließend 24.04
abgeschlossen&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;phase-3-grub--luks2--secure-boot--das-kernproblem&#34;&gt;Phase 3: GRUB + LUKS2 + Secure Boot — Das Kernproblem&lt;/h2&gt;
&lt;h3 id=&#34;symptom&#34;&gt;Symptom&lt;/h3&gt;
&lt;p&gt;Nach dem Upgrade zeigte GRUB weiterhin keine Menüeinträge. Debugging in der
GRUB-Kommandozeile:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;grub&amp;gt; ls (hd1,gpt7)
# → &amp;quot;No known filesystem detected&amp;quot;

grub&amp;gt; insmod luks2
# → &amp;quot;file &#39;/boot/grub/x86_64-efi/luks2.mod&#39; not found&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;ursache&#34;&gt;Ursache&lt;/h3&gt;
&lt;p&gt;Das eigentliche Problem ist eine fundamentale Inkompatibilität:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Canonical&amp;rsquo;s vorsigniertes &lt;code&gt;grubx64.efi&lt;/code&gt; enthält das &lt;code&gt;luks2&lt;/code&gt;-Modul bewusst nicht.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;GRUB 2.12 kann LUKS2 technisch entschlüsseln (sofern PBKDF2 statt Argon2 als
Key-Derivation-Function genutzt wird), aber das von Ubuntu ausgelieferte,
Secure-Boot-signierte EFI-Binary lässt dieses Modul absichtlich weg — es gilt
noch als nicht vollständig stabil.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;grub-install --modules=&amp;quot;... luks2 ...&amp;quot;&lt;/code&gt; hat deshalb keinen Effekt: Mit Secure Boot
aktiv nutzt &lt;code&gt;grub-install&lt;/code&gt; immer das vorsignierte Image und ignoriert die
&lt;code&gt;--modules&lt;/code&gt;-Option.&lt;/p&gt;
&lt;p&gt;Ein manuell mit &lt;code&gt;grub-mkimage&lt;/code&gt; erstelltes Image mit &lt;code&gt;luks2&lt;/code&gt;-Unterstützung wird von
Secure Boot sofort abgelehnt:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Verification failed: (0x1A) Security Violation
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Zusätzlich schlug &lt;code&gt;grub-install&lt;/code&gt; im chroot grundsätzlich fehl, weil EFI-Variablen
im chroot nicht beschreibbar sind (&lt;code&gt;grub-efi/install_devices_failed: true&lt;/code&gt; in
&lt;code&gt;debconf-show grub-efi&lt;/code&gt;).&lt;/p&gt;
&lt;h3 id=&#34;optionen&#34;&gt;Optionen&lt;/h3&gt;
&lt;table&gt;
	&lt;thead&gt;
			&lt;tr&gt;
					&lt;th&gt;Option&lt;/th&gt;
					&lt;th&gt;Aufwand&lt;/th&gt;
					&lt;th&gt;Nachteil&lt;/th&gt;
			&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
			&lt;tr&gt;
					&lt;td&gt;Secure Boot deaktivieren&lt;/td&gt;
					&lt;td&gt;gering&lt;/td&gt;
					&lt;td&gt;Secure Boot inaktiv&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;LUKS2 → LUKS1 konvertieren&lt;/td&gt;
					&lt;td&gt;gering&lt;/td&gt;
					&lt;td&gt;Kein Backup-Header mehr&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;Eigenen MOK-Schlüssel + selbst signiertes GRUB&lt;/td&gt;
					&lt;td&gt;hoch&lt;/td&gt;
					&lt;td&gt;Muss bei jedem GRUB-Update wiederholt werden&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;Wechsel zu systemd-boot&lt;/td&gt;
					&lt;td&gt;mittel&lt;/td&gt;
					&lt;td&gt;Konfigurationsaufwand einmalig&lt;/td&gt;
			&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;LUKS1 wurde abgelehnt, da LUKS2 einen Backup-Header mitbringt der sich bereits
einmal als lebensrettend erwiesen hatte. Gewählt wurde systemd-boot.&lt;/p&gt;
&lt;h2 id=&#34;phase-4-wechsel-zu-systemd-boot&#34;&gt;Phase 4: Wechsel zu systemd-boot&lt;/h2&gt;
&lt;h3 id=&#34;warum-systemd-boot&#34;&gt;Warum systemd-boot?&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Secure Boot wird nativ unterstützt (das Binary ist von den Distributionen signiert)&lt;/li&gt;
&lt;li&gt;LUKS wird nicht von systemd-boot selbst geöffnet — das übernimmt die initramfs
beim Kernel-Start. Damit entfällt das LUKS2-Problem komplett&lt;/li&gt;
&lt;li&gt;Dual Boot mit Windows funktioniert: systemd-boot erkennt den Windows-EFI-Eintrag
automatisch&lt;/li&gt;
&lt;li&gt;Kein shim als Vermittler nötig (anders als bei GRUB)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;installation&#34;&gt;Installation&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;bootctl install --esp-path=/boot/efi
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Kernel und initrd werden von &lt;code&gt;kernel-install&lt;/code&gt; automatisch auf die EFI-Partition
kopiert. Bei jedem Kernel-Update wird ein neuer Boot-Entry angelegt.&lt;/p&gt;
&lt;h3 id=&#34;luks-parameter&#34;&gt;LUKS-Parameter&lt;/h3&gt;
&lt;p&gt;Der automatisch generierte Boot-Entry enthielt keine LUKS-Parameter. Diese werden
dauerhaft in &lt;code&gt;/etc/kernel/cmdline&lt;/code&gt; hinterlegt:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rd.luks.uuid=&amp;lt;UUID-der-LUKS-Partition&amp;gt; rd.luks.name=&amp;lt;UUID&amp;gt;=cryptroot root=/dev/mapper/cryptroot rw quiet splash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;kernel-install add &amp;lt;version&amp;gt; /boot/vmlinuz-&amp;lt;version&amp;gt;&lt;/code&gt; regeneriert den Entry mit
diesen Parametern. Zukünftige Kernel-Updates setzen die Parameter automatisch korrekt.&lt;/p&gt;
&lt;h3 id=&#34;secure-boot-problem&#34;&gt;Secure Boot Problem&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;systemd-bootx64.efi&lt;/code&gt; war auf dem System nicht signiert — Ubuntu liefert kein
&lt;code&gt;.efi.signed&lt;/code&gt;-Paket für systemd-boot aus. &lt;strong&gt;Vorläufige Lösung: Secure Boot im
BIOS deaktiviert.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Für eine spätere saubere Lösung mit aktivem Secure Boot:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;# Eigenen Signing-Key generieren
openssl req -newkey rsa:4096 -nodes -keyout /root/mok.key \
  -new -x509 -sha256 -days 3650 \
  -subj &amp;quot;/CN=My Boot Signing Key/&amp;quot; -out /root/mok.crt

# systemd-boot signieren
sbsign --key /root/mok.key --cert /root/mok.crt \
  --output /boot/efi/EFI/systemd/systemd-bootx64.efi \
  /boot/efi/EFI/systemd/systemd-bootx64.efi

# Schlüssel bei Secure Boot registrieren
mokutil --import /root/mok.crt
# → Beim nächsten Boot einmalig im MOK-Manager bestätigen
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;efi-boot-reihenfolge&#34;&gt;EFI-Boot-Reihenfolge&lt;/h3&gt;
&lt;p&gt;Der alte GRUB-Eintrag wurde entfernt und systemd-boot als erster Eintrag gesetzt:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;efibootmgr --delete-bootnum --bootnum XXXX   # alten Ubuntu/GRUB-Eintrag löschen
efibootmgr --bootorder 0001                  # Linux Boot Manager an erste Stelle
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;phase-5-veracrypt-partition--der-eigentliche-mount-fehler&#34;&gt;Phase 5: Veracrypt-Partition — Der eigentliche Mount-Fehler&lt;/h2&gt;
&lt;h3 id=&#34;symptom-1&#34;&gt;Symptom&lt;/h3&gt;
&lt;p&gt;Die Veracrypt-Partition wurde beim Boot nicht gemountet. Das Journal zeigte:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mount: wrong fs type, bad option, bad superblock on /dev/mapper/data,
missing codepage or program, or other error
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Das klang nach einem ernsthaften Problem — war es aber nicht.&lt;/p&gt;
&lt;h3 id=&#34;diagnose-mit--v&#34;&gt;Diagnose mit &lt;code&gt;-v&lt;/code&gt;&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;cryptsetup open /dev/sdXY data \
  --type tcrypt --veracrypt \
  --key-file /home/user/.data.key -v
# → Error: device already exists
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;device already exists&lt;/code&gt; bedeutet: cryptsetup hatte die Partition bereits erfolgreich
geöffnet. Das Problem lag allein beim anschließenden Mount-Vorgang.&lt;/p&gt;
&lt;h3 id=&#34;ursache-ungültige-fstab-optionen-für-exfat&#34;&gt;Ursache: Ungültige fstab-Optionen für exFAT&lt;/h3&gt;
&lt;p&gt;Die &lt;code&gt;/etc/fstab&lt;/code&gt; enthielt für die Partition:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/dev/mapper/data  /home/user/data  auto  permissions,users,nosuid,nodev,nofail,...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;permissions&lt;/code&gt; ist keine gültige Mount-Option für exFAT-Dateisysteme und führt zu
einem sofortigen Mount-Fehler. Die korrigierte Zeile:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/dev/mapper/data  /home/user/data  exfat  nofail,fmask=133,dmask=022,uid=1000,gid=1000  0  0
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;phase-6-keyboard-layout-chaos-durch-fehlende-dotfiles&#34;&gt;Phase 6: Keyboard-Layout-Chaos durch fehlende Dotfiles&lt;/h2&gt;
&lt;h3 id=&#34;was-passierte&#34;&gt;Was passierte&lt;/h3&gt;
&lt;p&gt;Da die Veracrypt-Partition nicht gemountet war, fehlten alle Symlink-Ziele:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.xmonad/&lt;/code&gt; → xmonad startete nicht, XFCE wurde als Fallback geladen&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.zshrc&lt;/code&gt; → versuchte Dateien von der nicht gemounteten Partition zu laden&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.vimrc&lt;/code&gt; → Symlink ins Leere&lt;/li&gt;
&lt;li&gt;xkb/xmodmap-Konfiguration fehlte&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;XFCE initialisierte das Tastaturlayout ohne die benutzerspezifische xkb-Konfiguration.
Das Ergebnis war ein &lt;code&gt;BadKey (0xcf)&lt;/code&gt; als &lt;code&gt;mod2&lt;/code&gt;-Modifier in X11 — sichtbar mit:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;xmodmap -pm
# mod2  BadKey (0xcf)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Dieser ungültige Modifier-Eintrag aktivierte Layer-4-Sonderzeichen statt normaler
Eingabe. Neo2-Layer-4 belegt die Zifferntasten mit Symbolen wie &lt;code&gt;º&lt;/code&gt;, &lt;code&gt;£&lt;/code&gt;, &lt;code&gt;¤&lt;/code&gt; —
was erklärt warum die Tastatur scheinbar komplett kaputt war.&lt;/p&gt;
&lt;h3 id=&#34;lösung&#34;&gt;Lösung&lt;/h3&gt;
&lt;p&gt;Nach korrektem Mount der Veracrypt-Partition startete xmonad mit den vorhandenen
Dotfiles normal. Das Tastaturlayout funktionierte sofort ohne weiteren Eingriff,
da die xmodmap-Konfiguration korrekt geladen wurde.&lt;/p&gt;
&lt;h2 id=&#34;zusammenfassung-lessons-learned&#34;&gt;Zusammenfassung: Lessons Learned&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;LUKS2 + GRUB + Secure Boot&lt;/strong&gt; ist auf Ubuntu derzeit nicht out-of-the-box möglich.
Die Kombination erfordert entweder einen eigenen MOK-Schlüssel mit selbst gebautem
GRUB-Image, die Konvertierung auf LUKS1, oder den Wechsel zu einem anderen
Bootloader. systemd-boot ist hier die eleganteste Lösung da er LUKS der initramfs
überlässt und Secure Boot nativ unterstützt.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Dotfiles auf verschlüsselten Partitionen&lt;/strong&gt; sind ein zweischneidiges Schwert: Sie
sind sicher, aber wenn die Partition beim Boot nicht verfügbar ist, bricht die
gesamte Session-Initialisierung still und mit kryptischen Folgefehlern zusammen.
Eine minimale Fallback-Konfiguration direkt im Home-Verzeichnis ist empfehlenswert.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;cryptsetup -v&lt;/code&gt;&lt;/strong&gt; ist unverzichtbar beim Debugging — ohne verbose Output sieht
&amp;ldquo;device already exists&amp;rdquo; genauso aus wie ein echter Fehler.&lt;/p&gt;
&lt;h2 id=&#34;offene-punkte&#34;&gt;Offene Punkte&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Secure Boot wieder aktivieren via eigenem MOK-Schlüssel für systemd-boot&lt;/li&gt;
&lt;li&gt;Alten &lt;code&gt;/boot&lt;/code&gt;-fstab-Eintrag bereinigen&lt;/li&gt;
&lt;li&gt;&lt;code&gt;python&lt;/code&gt;-Symlink: &lt;code&gt;sudo ln -s /usr/bin/python3 /usr/bin/python&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Audio-Fehler (alsactl) aus dem Journal untersuchen&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
  </channel>
</rss>
