[systemd-devel] howto switch from grub2-bios to systemd-boot

Reindl Harald h.reindl at thelounge.net
Mon Jun 22 14:01:23 UTC 2020


what is the best way to get a Fedora using legacy-boot to UEFI and at
the same time switch from grub2 to systemd-boot?

* how to get in installed from a live-iso to
  the existing setup on disk
* how to get the config files right at the first try
* how does it work with kernel-updates
* how to get GRUB_CMDLINE_LINUX over
* is it possible to not kill grub2 for the time beeing
  to boot back into BIOS-mode in case of emergency

can /boot holding the kernel itself still be a Linux RAID1 or classical
ext4 partition or is it required that the kernel and initrd live on the
EFI partition too?

how to get the mounts right?
how to get the files to the correct locations?

-------------------------------------------------------

the "EFI system partition" is prepared, in that case as partition on the
first vdisk (VMware)

in the future i need to replace my physical machines where i don't wont
do touch the RAID1/RAID10 holding systemd and data dating back to 2011
and in that case i consider to use a usb-drive for the EFI partition

so this is more or less a testballon for the production servers given
that ove time i would like to switch completly to systemd-boot

-------------------------------------------------------

everything i found is talking about "you have already bootet in UEFI
mode" which makes it a little hard especially when it comes to dnf
operations

https://kowalski7cc.xyz/blog/systemd-boot-fedora-32/

what i don't like here at all is this (besides sudo):
sudo dnf remove grubby grub2\* shim\* memtest86\ && sudo rm -rf
/boot/grub2 && sudo rm -rf /boot/loader

-------------------------------------------------------

[root at testserver:~]$ df
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/sdb1      ext4   12G  6.3G  5.4G  54% /
/dev/sda3      ext4  376M   43M  310M  12% /boot
/dev/sda1      vfat  100M     0  100M   0% /boot/efi
/dev/md0       ext4  1.9G  3.0M  1.9G   1% /mnt/raid10

-------------------------------------------------------

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          206847   100.0 MiB   EF00  EFI system
partition
   2          206848          227327   10.0 MiB    EF02  BIOS boot partition
   3          227328         1048542   401.0 MiB   8300  Linux filesystem

-------------------------------------------------------

that was the steps to prepare the partitioning and re-install grub2 for
now on the new layout which could be dd'ed to dozenzs of identical
machines with one step

* rsync.sh /boot/ /data/boot/
* umount /boot/
* dd if=/dev/zero of=/dev/sda
* partprobe /dev/sda
* gdisk /dev/sda
* o
* n
* end at +100M
* type: EF00 (EFI-System)
* n (Neue Partition erzeugen)
* end at +10M
* type: ef02 (BIOS boot partition)
* n (Neue Partition erzeugen)
+ accept defaults
* w
* partprobe /dev/sda
* mkfs.vfat /dev/sda1
* mkfs.ext4 -I 256 -O ^has_journal /dev/sda3
* e2label /dev/sda3 boot
* UUID der bootdisk in /etc/fstab aktualisieren
* systemctl daemon-reexec
* mount /dev/sdb3 /boot/
* rsync.sh /data/boot/ /boot/
* grub2-install /dev/sda

-------------------------------------------------------

[root at testserver:~]$ cat /etc/default/grub
GRUB_TIMEOUT=2
GRUB_DISTRIBUTOR="Fedora"
GRUB_SAVEDEFAULT="false"
GRUB_TERMINAL_OUTPUT="console"
GRUB_GFXPAYLOAD_LINUX="text"
GRUB_CMDLINE_LINUX="quiet transparent_hugepage=never edd=off
hpet=disable audit=0 rd.plymouth=0 plymouth.enable=0 zswap.enabled=0
nodmraid raid=noautodetect nomodeset selinux=0 net.ifnames=0
biosdevname=0 noswapaccount nousb usbcore.nousb noisapnp noresume
hibernate=no kaslr thermal.off=1 nmi_watchdog=0 consoleblank=0 rd.luks=0
rd.lvm=0 rd.md=0 rd.dm=0 vconsole.font=latarcyrheb-sun16
vconsole.keymap=de-latin1-nodeadkeys locale.LANG=C.UTF-8"
GRUB_DISABLE_RECOVERY="true"
GRUB_DISABLE_SUBMENU="true"
GRUB_DISABLE_OS_PROBER="true"
GRUB_ENABLE_BLSCFG="false"


More information about the systemd-devel mailing list