Linuxhotel Wiki

Wie ging das nochmal?

Benutzer-Werkzeuge

Webseiten-Werkzeuge


admin_grundlagen:bootloader

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen gezeigt.

Link zu der Vergleichsansicht

Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung
Nächste Überarbeitung
Vorherige Überarbeitung
admin_grundlagen:bootloader [2019/11/09 21:41]
ingo_wichmann [Bootloader löschen]
admin_grundlagen:bootloader [2023/10/11 14:32] (aktuell)
natureshadow2 Anpassung für RockyLinux
Zeile 1: Zeile 1:
 ====== Bootloader ====== ====== Bootloader ======
-===== Bootloader im MBR löschen ===== +===== Kernel Bootparameter ändern ​=====
-  dd if=/​dev/​zero of=/dev/sda bs=$((512-64)) count=1 +
- +
-===== grub2 ===== +
-==== Grub2 in den MBR installieren ==== +
-=== CentOS 7 === +
-  yum install grub2 +
- +
-=== Debian (ab 6.0) Ubuntu (ab 14.04) === +
-  apt-get install grub-pc +
-  update-grub2 +
-  grub-install /dev/sda +
- +
-=== openSuSE 12.2 === +
-  update-bootloader +
-  grub2-install /dev/sda +
- +
-==== Kernel Bootparameter ändern ====+
 Z.B. Kernel Argument ''​nomodeset''​ setzen: Z.B. Kernel Argument ''​nomodeset''​ setzen:
 +==== grub2-mkconfig ====
 === openSuSE 12.3 === === openSuSE 12.3 ===
 ''/​etc/​default/​grub''​ : ''/​etc/​default/​grub''​ :
Zeile 35: Zeile 19:
   grub-mkconfig --output=/​boot/​grub/​grub.cfg   grub-mkconfig --output=/​boot/​grub/​grub.cfg
  
-=== centos ​(ab 7) === +==== grubby ==== 
-siehe [[#grubby]]+=== CentOS ​(bis 7) === 
 +Anzeigen der Konfiguration des Bootmanagers 
 +  ​grubby ​--info=ALL 
 + 
 +Eine Option zum Default-Kernel hinzufügen (hier: SELinux ausschalten) 
 +  grubby --args="​enforcing=0"​ --update-kernel="​$(grubby --default-kernel)"​ 
 + 
 +Optionen vom Default-Kernel entfernen (hier: Unterdrückung der Kernel-Meldungen ausschalten) 
 +  grubby --remove-args="​rhgb quiet" --update-kernel="​$(grubby --default-kernel)"​ 
 + 
 +=== CentOS (8) === 
 +Unter Centos 8 aktualisiert ''​grubby''​ nur noch die Konfigurationsdateien von Fedoras Variante der BootLoaderSpec (BLS) in ''/​boot/​loader/​entries''​. Das bedeutet, dass die Änderungen keine Auswirkung haben, wenn 
 +<file txt /​etc/​default/​grub>​ 
 +… 
 +GRUB_ENABLE_BLSCFG=false 
 +… 
 +</​file>​ 
 +gesetzt ist. (( siehe auch https://​fedoraproject.org/​wiki/​Changes/​BootLoaderSpecByDefault )) 
 +===== grub2 ===== 
 +==== Grub2 in den MBR installieren ==== 
 +=== CentOS 7 === 
 +  yum install grub2 
 + 
 +=== Debian (ab 6.0) Ubuntu (ab 14.04) === 
 +  apt-get install grub-pc 
 +  update-grub2 
 +  grub-install /dev/sda 
 + 
 +=== openSuSE 12.2 === 
 +  update-bootloader 
 +  grub2-install /dev/sda 
 ==== Grub2 mit Passwort absichern ==== ==== Grub2 mit Passwort absichern ====
 === Root Passwort ändern === === Root Passwort ändern ===
-Grub Bootprompt: ''​init=/​bin/​bash''​ als Parameter zum Linux Kernel hinzufügen+Grub Bootprompt: ''​init=/​bin/​bash''​ als Parameter zum Linux Kernel hinzufügen, evtl. ''​ro'',​ ''​quiet''​ und ''​splash=silent''​ entfernen. (( siehe 
 +  man bootparam  
 +))
  
 Kernel mit ''​strg+x''​ booten Kernel mit ''​strg+x''​ booten
Zeile 46: Zeile 63:
   passwd   passwd
  
 +++++ bei Systemem mit SELinux |
   touch /​.autorelabel   touch /​.autorelabel
 +++++
  
-((nur bei Systemen mit aktiviertem SELinux notwendig)) 
- 
-  mount -o remount,ro / 
   exec /sbin/init   exec /sbin/init
  
 === Grub absichern === === Grub absichern ===
-== Passwort Hash erzeugen == +(( Weitere Absicherungsmöglichkeiten:​ 
-Debian 6, CentOS 7:+  http://​0pointer.net/​blog/​unlocking-luks2-volumes-with-tpm2-fido2-pkcs11-security-hardware-on-systemd-248.html 
 +)) 
 + 
 +== Passwort-Hash erzeugen == 
 +CentOS ​(ab 7), Rocky, openSuSE Leap (ab 15.1):
   grub2-mkpasswd-pbkdf2   grub2-mkpasswd-pbkdf2
  
Zeile 61: Zeile 81:
   grub-mkpasswd-pbkdf2   grub-mkpasswd-pbkdf2
  
-== Passwort Hash eintragen ​==+== Grub-Configdatei mit Passwort Hash anlegen ​==
 <file txt /​etc/​grub.d/​45_password>​ <file txt /​etc/​grub.d/​45_password>​
 #!/bin/sh #!/bin/sh
Zeile 74: Zeile 94:
   chmod +x /​etc/​grub.d/​45_password   chmod +x /​etc/​grub.d/​45_password
  
-== grub Konfigurationsdatei neu erzeugen == +== Auswahl ermöglichen,​ editieren absichern ​(Standard auf Rocky)==
-Debian (ab 6), Ubuntu (14.04): +
-  grub-mkconfig -o /​boot/​grub/​grub.cfg +
- +
-CentOS (7): +
-  grub2-mkconfig -o /​boot/​grub2/​grub.cfg +
-oder +
-  grub2-mkconfig -o "​$(readlink -e /​etc/​grub2.conf)"​ +
-oder für UEFI-Systeme:​ +
-  grub2-mkconfig -o "​$(readlink -e /​etc/​grub2-efi.cfg)"​ +
- +
-== Auswahl ermöglichen,​ editieren absichern ==+
 <file txt /​etc/​grub.d/​10_linux>​ <file txt /​etc/​grub.d/​10_linux>​
 ... ...
Zeile 91: Zeile 100:
 ... ...
 </​file>​ </​file>​
 +
 +== grub Konfigurationsdatei neu erzeugen ==
 +Für BIOS-Systeme:​
 +
 +Debian (ab 6), Ubuntu (ab 14.04):
 +  grub-mkconfig -o /​boot/​grub/​grub.cfg
 +
 +CentOS (ab 7), Rocky, openSuSE (ab Leap 15.1):
 +  grub2-mkconfig -o /​boot/​grub2/​grub.cfg
 +
 +Für UEFI-Systeme:​
 +
 +Debian, Ubuntu, openSuSE: wie bei BIOS-Systemen
 +
 +CentOS (8)
 +  grub2-mkconfig -o /​boot/​efi/​EFI/​centos/​grub.cfg
 +
 +Rocky
 +    grub2-mkconfig -o /​boot/​efi/​EFI/​rocky/​grub.cfg
  
 == testen == == testen ==
-Debian (ab 6), Ubuntu (14.04)+Debian (ab 6), Ubuntu (14.04)CentOS (ab 7): 
-  grep password /​boot/​grub/​grub.cfg +  grep -E '​superusers|password_pbkdf2' ​/boot/grub*/grub.cfg
-  reboot +
-CentOS (7): +
-  grep password ​/boot/grub2/grub.cfg+
   reboot   reboot
  
Zeile 103: Zeile 128:
   * https://​www.gnu.org/​software/​grub/​manual/​html_node/​Security.html   * https://​www.gnu.org/​software/​grub/​manual/​html_node/​Security.html
  
-===== grubby ===== +==== Grub2 ohne Konfigurationsdatei von Hand starten ​==== 
-Anzeigen ​der Konfiguration des Bootmanagers +Notfall: ​der Rechner bootet nicht, sondern begrüßt uns mit einem freundlichen ''​grub>​ _''​
-  grubby --info=ALL+
  
-Eine Option zum Default-Kernel hinzufügen (hier: SELinux ausschalten+Weist Du noch, welche Dateisysteme Dein System verwendet? (Im Zweifel einfach alle Dateisystem-Module laden
-  ​grubby --args="​enforcing=0"​ --update-kernel="​$(grubby --default-kernel)"​+  ​insmod ext2 
 +  insmod xfs
  
-Optionen vom Default-Kernel entfernen ​(hierUnterdrückung der Kernel-Meldungen ausschalten+Welche Storage Verwaltung verwendet Dein System? ​(Im Zweifel einfach alle laden) 
-  ​grubby --remove-args="rhgb quiet" ​--update-kernel="​$(grubby ​--default-kernel)"​+  insmod lvm 
 +  insmod mdraid09 
 +  insmod mdraid1x 
 + 
 +Laufwerke anzeigen, die grub jetzt sieht: 
 +  ls 
 + 
 +Partition/​Laufwerk finden, auf dem Kernel ​(''​vmlinuz…''​und Initrd liegen. Tab-Taste hilft ... 
 +  ​ls (hd0,​msdos1)/​ 
 + 
 +Grub-root setzen: 
 +  set root=(hd0,​msdos1) 
 + 
 +Partition/​Laufwerk finden, auf dem das Linux root-Dateisystem liegt (''​etc/'',​ ''​bin/'',​ …). Tab-Taste hilft ... 
 +  ls (lvm/centos-root)/ 
 + 
 +Kernel zum Boot vorbereiten:​ 
 +  linux /vmlinuz-… root=/​dev/​mapper/​centos-root ro 
 + 
 +Initrd zum Boot vorbereiten:​ 
 +  initrd /​initramfs-…
  
 +Booten:
 +  boot
 ===== grub ===== ===== grub =====
 ==== Grub in den MBR installieren ==== ==== Grub in den MBR installieren ====
Zeile 162: Zeile 209:
 password --md5 $1$ZkniA/​$2EBU5eSONAj.i2KIhhtWA0 password --md5 $1$ZkniA/​$2EBU5eSONAj.i2KIhhtWA0
 </​file>​ </​file>​
 +
 +===== Bootloader im MBR löschen =====
 +  dd if=/​dev/​zero of=/dev/sda bs=$((512-64)) count=1
  
 ===== Dokus & Links ===== ===== Dokus & Links =====
   * http://​wiki.ubuntuusers.de/​grub_2/​konfiguration   * http://​wiki.ubuntuusers.de/​grub_2/​konfiguration
  
admin_grundlagen/bootloader.1573335681.txt.gz · Zuletzt geändert: 2019/11/09 21:41 von ingo_wichmann