1

Disclaimer: I have no experience installing Ubuntu Server in UEFI boot mode.

Context

I'm setting up this new servers with RAID 10 via mdadm. AFAIK, ESP can't be RAIDed, so during Ubuntu installation I set my four disks to be used as Boot Device, which looks like this:

ubuntu_install_scrshot

After installation finished, lsblk output looks like this (sorry, long output):

citilan@zitz:~$ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE   MOUNTPOINTS
loop0         7:0    0   48M  1 loop   /snap/snapd/17029
loop1         7:1    0   47M  1 loop   /snap/snapd/16292
loop2         7:2    0   62M  1 loop   /snap/core20/1587
loop3         7:3    0 79.9M  1 loop   /snap/lxd/22923
loop4         7:4    0 63.2M  1 loop   /snap/core20/1623
loop5         7:5    0  103M  1 loop   /snap/lxd/23541
sda           8:0    0  3.6T  0 disk   
├─sda1        8:1    0    1G  0 part   /boot/efi
├─sda2        8:2    0   16G  0 part   
│ └─md2       9:2    0   32G  0 raid10 
│   └─md2p1 259:1    0   32G  0 part   [SWAP]
├─sda3        8:3    0  512M  0 part   
│ └─md0       9:0    0 1020M  0 raid10 
│   └─md0p1 259:0    0 1018M  0 part   /boot
└─sda4        8:4    0  3.6T  0 part   
  └─md1       9:1    0  7.2T  0 raid10 
    └─md1p1 259:2    0  7.2T  0 part   /
sdb           8:16   0  3.6T  0 disk   
├─sdb1        8:17   0    1G  0 part   /mnt
├─sdb2        8:18   0   16G  0 part   
│ └─md2       9:2    0   32G  0 raid10 
│   └─md2p1 259:1    0   32G  0 part   [SWAP]
├─sdb3        8:19   0  512M  0 part   
│ └─md0       9:0    0 1020M  0 raid10 
│   └─md0p1 259:0    0 1018M  0 part   /boot
└─sdb4        8:20   0  3.6T  0 part   
  └─md1       9:1    0  7.2T  0 raid10 
    └─md1p1 259:2    0  7.2T  0 part   /
sdc           8:32   0  3.6T  0 disk   
├─sdc1        8:33   0    1G  0 part   
├─sdc2        8:34   0   16G  0 part   
│ └─md2       9:2    0   32G  0 raid10 
│   └─md2p1 259:1    0   32G  0 part   [SWAP]
├─sdc3        8:35   0  512M  0 part   
│ └─md0       9:0    0 1020M  0 raid10 
│   └─md0p1 259:0    0 1018M  0 part   /boot
└─sdc4        8:36   0  3.6T  0 part   
  └─md1       9:1    0  7.2T  0 raid10 
    └─md1p1 259:2    0  7.2T  0 part   /
sdd           8:48   0  3.6T  0 disk   
├─sdd1        8:49   0    1G  0 part   
├─sdd2        8:50   0   16G  0 part   
│ └─md2       9:2    0   32G  0 raid10 
│   └─md2p1 259:1    0   32G  0 part   [SWAP]
├─sdd3        8:51   0  512M  0 part   
│ └─md0       9:0    0 1020M  0 raid10 
│   └─md0p1 259:0    0 1018M  0 part   /boot
└─sdd4        8:52   0  3.6T  0 part   
  └─md1       9:1    0  7.2T  0 raid10 
    └─md1p1 259:2    0  7.2T  0 part   /

/boot/efi is mounted because of this entry in /etc/fstab added by Ubuntu installation

root@zitz:~# grep efi /etc/fstab 
# /boot/efi was on /dev/sda1 during curtin installation
/dev/disk/by-uuid/3FD8-AF4F /boot/efi vfat defaults 0 1

Also, this is my efibootmgr -v output:

# efibootmgr -v
BootCurrent: 000B
Timeout: 1 seconds
BootOrder: 000B,000D,000E,000F,0003,0004,0005,0006,0002,0001
Boot0001  Hard Drive    BBS(HD,,0x0)/VenHw(5ce8128b-2cec-40f0-8372-80640e3dc858,0200)..GO..NO..........S.T.4.0.0.0.N.M.0.0.0.A.-.2.H.Z.1.0.0...................\.,[email protected].=.X..........A...........................>..Gd-.;.A..MQ..L. . . . . . . . . . . . .S.W.3.2.M.L.A.V........BO..NO..........S.T.4.0.0.0.N.M.0.0.0.A.-.2.H.Z.1.0.0...................\.,[email protected].=.X..........A...........................>..Gd-.;.A..MQ..L. . . . . . . . . . . . .S.W.3.2.M.L.H.5........BO..NO..........S.T.4.0.0.0.N.M.0.0.0.A.-.2.H.Z.1.0.0...................\.,[email protected].=.X..........A...........................>..Gd-.;.A..MQ..L. . . . . . . . . . . . .S.W.3.2.M.L.C.7........BO..NO..........S.T.4.0.0.0.N.M.0.0.0.A.-.2.H.Z.1.0.0...................\.,[email protected].=.X..........A...........................>..Gd-.;.A..MQ..L. . . . . . . . . . . . .S.W.3.2.M.L.3.4........BO
Boot0002* UEFI: Built-in EFI Shell  VenMedia(5023b95c-db26-429b-a648-bd47664c8012)..BO
Boot0003* (B2/D0/F0) UEFI PXE IPv4 Intel(R) Ethernet Controller X550(MAC:3cecefc7f71e)  PciRoot(0x0)/Pci(0x1b,0x4)/Pci(0x0,0x0)/MAC(3cecefc7f71e,1)/IPv4(0.0.0.00.0.0.0,0,0)..BO
Boot0004* (B2/D0/F1) UEFI PXE IPv4 Intel(R) Ethernet Controller X550(MAC:3cecefc7f71f)  PciRoot(0x0)/Pci(0x1b,0x4)/Pci(0x0,0x1)/MAC(3cecefc7f71f,1)/IPv4(0.0.0.00.0.0.0,0,0)..BO
Boot0005* (B2/D0/F0) UEFI PXE IPv6 Intel(R) Ethernet Controller X550(MAC:3cecefc7f71e)  PciRoot(0x0)/Pci(0x1b,0x4)/Pci(0x0,0x0)/MAC(3cecefc7f71e,1)/IPv6([::]:<->[::]:,0,0)..BO
Boot0006* (B2/D0/F1) UEFI PXE IPv6 Intel(R) Ethernet Controller X550(MAC:3cecefc7f71f)  PciRoot(0x0)/Pci(0x1b,0x4)/Pci(0x0,0x1)/MAC(3cecefc7f71f,1)/IPv6([::]:<->[::]:,0,0)..BO
Boot000B* ubuntu    HD(1,GPT,175deae0-cf0e-4637-8fd8-c358043eebae,0x800,0x219800)/File(\EFI\UBUNTU\SHIMX64.EFI)
Boot000D* ubuntu    HD(1,GPT,ad3a98c7-8a50-4fe3-abae-93aec5b080a0,0x800,0x219800)/File(\EFI\UBUNTU\SHIMX64.EFI)..BO
Boot000E* ubuntu    HD(1,GPT,b1c20b0c-c83e-4a8e-a1b8-210d1e1c5662,0x800,0x219800)/File(\EFI\UBUNTU\SHIMX64.EFI)..BO
Boot000F* ubuntu    HD(1,GPT,0bb71865-f415-4d7c-bc5a-6f30dbe9872a,0x800,0x219800)/File(\EFI\ubuntu\shimx64.efi)..BO

Questions:

  1. Does Ubuntu takes care of ESP sync? Given the case that I lost currently mounted /boot/efi, are backup ESP up to date? Otherwise, do I have to manually mount and sync them all?
  2. If I remove /dev/sda (3FD8-AF4F in /etc/fstab) and boot the server, it starts logged in as root user. No login prompt. Just boot the server and you are root. /boot/efi is not mounted (see question 3)
  3. How do I automatically mount one of the backup ESP on /boot/efi? What is the best practice here?

Thanks

1 Answer 1

1
  1. Yes, if grub-efi-amd64 is configured to use those as the ESP:s then Ubuntu will automatically sync them all. And they don't need to be mounted to be synced, myself I don't have /boot/efi mounted in fstab at all.

    That config is handled by debconf.  The command sudo dpkg-reconfigure grub-efi-amd64 should take care of this and debconf-show grub-efi-amd64 will show which devices grub is configured to use.

    If this does not work, then the debconf file can be edited manually, with

    sudo (your_favorite_editor) /var/cache/debconf/config.dat

    then search for "grub-efi".  I have 5 ESP partitions so my entry there looks like this:

    Name: grub-efi/install_devices
    Template: grub-efi/install_devices
    Value: /dev/disk/by-id/ata-ST4000NM0033-9ZM170_Z1Z2M3PT-part1, /dev/disk/by-id/ata-ST4000NM0033-9ZM170_Z1Z2MACF-part1, /dev/disk/by-id/ata-ST4000NM0033-9ZM170_Z1Z2MXKQ-part1, /dev/disk/by-id/ata-ST4000NM0033-9ZM170_Z1Z1NEB7-part1, /dev/disk/by-id/ata-ST4000NM0033-9ZM170_Z1Z1NWY6-part1
    Owners: grub-common, grub-efi-amd64
    Flags: seen
    Variables:
     CHOICES = 
     RAW_CHOICES = 
    
    Name: grub-efi/install_devices_disks_changed
    Template: grub-efi/install_devices_disks_changed
    Value: /dev/disk/by-id/ata-ST4000NM0033-9ZM170_Z1Z2M3PT-part1, /dev/disk/by-id/ata-ST4000NM0033-9ZM170_Z1Z2MACF-part1, /dev/disk/by-id/ata-ST4000NM0033-9ZM170_Z1Z2MXKQ-part1, /dev/disk/by-id/ata-ST4000NM0033-9ZM170_Z1Z1NEB7-part1, /dev/disk/by-id/ata-ST4000NM0033-9ZM170_Z1Z1NWY6-part1
    Owners: grub-common, grub-efi-amd64
    Flags: seen
    Variables:
     CHOICES = 
     RAW_CHOICES = 
    

    I'm not sure if both entries are used, but I'd change both to match all your ESP partitions. Save and then do sudo dpkg-reconfigure grub-efi-amd64 and GRUB will install on all the correct places and keep on doing it going forward.

  2. This cannot happen.  Perhaps you are entering some type of recovery prompt that you mistake for root?  The system can not do autologin due to not having an entry in fstab.

  3. Not needed at all, but if you like you can just keep the 3FD8-AF4F entry there; it isn't used for anything anyway.

1
  • Thank you Henrik for your answer, it's very clear and it worked for me. About point 2, it happens that I was entering emergency mode. Adding nofail to fstab entry worked for me. Also, as I'm using RAID10 with all 4 devices i have and all of them are boot partitions with its own ESP, I decided to change UUID from fstab to /dev/sdaX, so even if I remove current sda, on next boot it will start naming partitions from sda. If it doesn't happen, nofail will do the trick and Ubuntu willl boot just fine. Oct 27, 2022 at 12:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .