Alpine setup on virtual machine UEFI does not boot

I am trying to setup Alpine linux on a VM (Proxmox) to replicate the layout of physical hardware (raspberry pi). The real layout is a raspberry pi 3, installed as "data" mode (based on wiki) with :

  • sd card: 2 partitions (/boot, /)
  • usb hard disk : 2 partitions (swap, /var)

I create the VM booting as UEFI, with 2 scsi disks :

  • 8G, GPT, 2 partitions (/boot 512M FAT32 flags=boot,efi, / 7.5G ext4)
  • 60G, GPT, 2 partitions (swap 4G, /var 56G ext4)

Partitions are made using gparted livecd, then I reboot with alpine-virt iso.

I launch the setup-alpine script, until it asks for disk (I Ctrl+C). Then I mount the disk layout and launch install :

swapon /dev/sdb1
mount /dev/sda2 /mnt
mkdir -p /mnt/boot /mnt/var
mount /dev/sda1 /mnt/boot
mount /dev/sdb2 /mnt/var
apk add grub-efi efibootmgr
export BOOTLOADER=grub
export USE_EFI=1
setup-disk -m data /mnt

Then I see this message : You might need fix the MBR to be able to boot. And when I try to reboot, it does not boot on hard drive.

What kind of magic have I missed ?


Solution 1:

First of all: The MBR message is meaningless in this case. It is always displayed when installing into existing partition(s), but is only relevant when using MBR (duh).

The crucial part is that Alpine expects EFI partition to be mounted at /boot/efi not /boot. Otherwise, installation scripts get confused and overwrite grub with syslinux, rendering the system unbootable.

So, modify your commands to do this instead:

mkdir -p /mnt/boot/efi
mount -t vfat /dev/sda1 /mnt/boot/efi

and it should work.