About EFI

Hello,
I want to install TW from scratch (or if I need to reinstall grub). GPT partitions and UEFI
I need a little help with boot-efi, please.
I read openSUSE doc, ArchLinux and Gentoo.

openSUSE - grub2-install --target=x86_64-efi
Arch and Gentoo - grub-install --target=x86_64-efi --efi-directory=/boot/efi (arch prefer /boot instead of /boot/efi).
If I understand right, openSUSE grub2 = grub from Arch and Gentoo because oS keep both package “grub” and “grub2”.
Is it necessary to add efi-directory: grub2-install --target=x86_64-efi --efi-directory=/boot/efi, on oS install?

Another question: /boot and /boot/efi partitions
Is it necessary to make two different partitons: /boot - ext4 and /boot/efi - vfat or is enough a single partiton /boot/efi - vfat?
I ask this because today I read a discution on Mailing list about Leap 15.0 /boot/efi partition. The kernels are in /boot and /boot/efi is only for bootloader. So, is it better to keep kernels on an Linux system that Windows one (two partitons /boot and /boot/efi than only one /boot/efi)?

Thank you.

Kernels always go in boot, whether boot is on a separate filesystem or not. On my systems, separate boot is sometimes used, and when it is, I always make it EXT2. /boot does not get written to very often, mostly only when a new kernel is installed, so I don’t like to waste space for a journal.

The VFAT EFI partition is intended for use by UEFI system components, the UEFI BIOS, and the bootloader. Usually it has an overabundance of space, so other things could be put there, but remember that VFAT does not support native ownerships and permissions. Mine is 320MB and almost entirely freespace even though the disk has 4 installed operating systems. I haven’t yet needed to run grub2-install myself. I only have it on my UEFI system, always using Grub 0.97 on MBR disks.

Whether /boot is a separate filesystem from / or not, /boot/EFI is always intended to be a VFAT filesystem distinct from its native parent filesystem.

Thank you for the answer. I read your post on mailinglist.

I thought that, if I will not make a separate /boot partition, only a /boot/efi, the kernel will be on /boot and bootloader on /boot/efi, both with vfat.
Now I understand: if a make a separate /boot partition, kernels will be on that partition, if I not, kernels will be in directory boot on partition /. Never on /boot/efi (vfat).

Yes, that’s exactly right.

Some linux distros use systemd-boot instead of grub. For those distros, the kernel is in the EFI partition. But most distros use grub (or grub2-efi), which uses partitions exactly as you describe.

Thank you.

Installed a new disk yesterday:

erlangen:~ # gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.1

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): BEEDF98F-DA82-4488-A275-F581FA13B9F8
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          206847   100.0 MiB   EF00  
   2          206848        63121407   30.0 GiB    8300  
   3        63121408       976773134   435.7 GiB   8300  
erlangen:~ # 

Cloned the system partition from /dev/sdc1 to /dev/sda2 and installed grub2 efi on /dev/sda. The new system would readily boot, but only when booting into /dev/sda2 from disk /dev/sdc. Only after installing legacy grub2 and switching back to grub2 efi the system now boots from /dev/sda. Any idea?

It’s not completely clear what you did.

In particular, I am not clear on whether you are now booting grub2 (legacy booting) or with grub2-efi (UEFI booting). And if it is the latter, then I don’t know what it is that you are asking.

I upgraded the first disk from Samsung 840 Evo 250 GB MBR to 850 Evo 500 GB GPT. I now have:

Drives: HDD Total Size: 2750.6GB (73.2% used)
ID-1: /dev/sda model: Samsung_SSD_850 size: 500.1GB GPT
ID-2: /dev/sdb model: ST2000DM001 size: 2000.4GB MBR
ID-3: /dev/sdc model: Samsung_SSD_850 size: 250.1GB MBR

Partition: ID-1: / size: 30G used: 16G (56%) fs: ext4 dev: /dev/sda2
ID-2: /home size: 428G used: 227G (56%) fs: ext4 dev: /dev/sda3
ID-3: swap-1 size: 16.78GB used: 0.00GB (0%) fs: swap dev: /dev/sdc3

I copied a working instance of Tumbleweed from /dev/sdc1 (MBR) to /dev/sda2 (GPR) and installed grub efi on /dev/sda Then I updated the boot loader of the old system (/dev/sdc1) and got a nice menu. Upon rebooting the machine from disk /dev/sdc (MBR) I selected the entry /dev/sda2 and got a working system (as expected). The I tried to boot from disk /dev/sda. But I only got an error message from efi: no bootable disk (puzzling). :frowning:

After some trial and error I booted from disk /dev/sdc into /dev/sda2 and switched that partition from grub efi to grub and back again to grub efi. Now I was able to boot from disk /dev/sda. :slight_smile:

The system now does exactly what I want. However I am wondering for what reason the first attempt failed. And I am pretty clueless why switching the bootloader back and forth fixed the problem.

It’s hard to know. In spite of the detail you have given, I’m still not sure on exactly what you did.

You have to keep in mind that the UEFI firmware (BIOS) mostly only runs during boot. So you could make a lot of changes, and the BIOS would not be aware of them until it next scanned the system and update whatever records it keeps in NVRAM. So possibly you had a system with everything in place, but the BIOS did not yet know about it.

Hope I am done with 4 years of legacy junk:

  • reset UEFI to defaults, enabled good night led and fan silent mode
  • converted disks to gpt
  • moved system partitions to ssd
  • switched all system partitions to grub efi with each disk using their own EFI system partition
  • updated signature

@another_roadrunner: main disk now has


erlangen:~ # gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.1

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): BEEDF98F-DA82-4488-A275-F581FA13B9F8
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          206847   100.0 MiB   EF00  
   2          206848        63121407   30.0 GiB    8300  
   3        63121408       976773134   435.7 GiB   8300  
erlangen:~ # df -h /dev/sda*
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       100M  126K  100M   1% /boot/efi
/dev/sda2        30G   16G   13G  56% /
/dev/sda3       428G  243G  164G  60% /home
erlangen:~ # 

Hello @karlmistelberger.

I have about the same configuration.
But I preferred a separate partition for /boot and a bigger one for /boot/efi - 550 M. No swap, like you. :slight_smile:

I had used YAST > Boot Loader for performing the switch to efi. However when removing the old disk I got error messages. I had a closer look and found that Boot Manager claimed to create a new initrd. But actually it didn’t. The following fixed the problem:

dracut -f
grub2-install --target=x86_64-efi

On the smaller of the machines adding, removing and moving disks together with switching from grub mbr to efi created a mess. On the larger machine I first moved disks and made sure the system would properly update the kernel while still using grub mbr.

erlangen:~ # inxi -D
Drives:    HDD Total Size: 7013.4GB (46.3% used)
           ID-1: /dev/nvme0n1 model: Samsung_SSD_950_PRO_512GB size: 512.1GB
           ID-2: /dev/sda model: WDC_WD40EZRX size: 4000.8GB
           ID-3: /dev/sdb model: Samsung_SSD_850 size: 500.1GB
           ID-4: USB /dev/sdc model: Elements_1078 size: 2000.4GB
erlangen:~ # 

Switching to efi now was straight forward:

  1. Convert disks to gpt using sgdisk -g /dev/nvme01 …

  2. Shrink swap and add esp partition:

erlangen:~ # lsblk -f /dev/nvme0n1
NAME        FSTYPE LABEL      UUID                                 MOUNTPOINT
nvme0n1                                                            
├─nvme0n1p1 swap   Swap       aa065695-b637-4d5d-bb2a-4ad459c9556a [SWAP]
├─nvme0n1p2 ext4   Tumbleweed 8b190950-c141-4351-9198-7a9592b4fb34 /
├─nvme0n1p3 ext4   Home       704621ef-9b45-4e96-ba7f-1becd3924f08 /home
└─nvme0n1p4 vfat              6DEC-64F9                            /boot/efi
erlangen:~ # 
  1. Add esp partition to fstab

  2. Install grub efi using yast2-bootloader

  3. Use efibootmgr to create boots:

efibootmgr --create --disk /dev/nvme0n1 --part 4 --label default --loader /EFI/opensuse/grubx64.efi
efibootmgr --create --disk /dev/sdb1 --part 1 --label backup --loader /EFI/opensuse/grubx64.efi