Skip to content

Instantly share code, notes, and snippets.

@foundObjects
Created April 5, 2019 00:09
Show Gist options
  • Save foundObjects/a192f7165a6e34ca87cc2e10d12147bc to your computer and use it in GitHub Desktop.
Save foundObjects/a192f7165a6e34ca87cc2e10d12147bc to your computer and use it in GitHub Desktop.
Proxmox 5.2/5.3 UEFI grub install
#!/bin/bash
BOOTDEV="/dev/sda"
# PVE 5.3
EFIDEV="/dev/sda2"
# PVE 5.2
# EFIDEV="/dev/sda9"
# == ( 5.2/5.3 FIX UEFI BOOT ) ==========================
## in UEFI mode: install zfs root, shut down completely, cold rescue boot from Proxmox ___5.2___ install media
## 5.3 install media will not rescue boot successfully
## cold boot was important on my machine, warm boot would just hang trying to boot the rescue media
# Notes:
# find 512MB UEFI partition, for me it was /dev/sda2 (sda1 was BIOS boot stuff) on 5.3
# and /dev/sda9 (solaris reserved) on 5.2
# lsblk -f
# fdisk -l /dev/sda (YOUR BOOT DEVICE HERE)
#
# use your EFI partition below
mkdir -p /boot/efi
mkfs.vfat -F32 $EFIDEV
echo PARTUUID=$(blkid -s PARTUUID -o value $EFIDEV) /boot/efi vfat noatime,nofail,x-systemd.device-timeout=1 0 1 >> /etc/fstab
mount /boot/efi
grub-probe -d $EFIDEV
update-grub
grub-install -d /usr/lib/grub/x86_64-efi $BOOTDEV
@killmasta93
Copy link

thanks for the reply, not sure if you had a case to replace a disk on proxmox 6.x with uefi? Because i tried the follow steps

sgdisk /dev/disk/by-id/scsi-35000c5003a81d367 -R /dev/disk/by-id/scsi-35000c5003a7dab73
sgdisk -G /dev/disk/by-id/scsi-35000c5003a7dab73
zpool replace -f rpool 8707294139048458014  /dev/disk/by-id/scsi-35000c5003a7dab73-part3

but install the boot on that drive i got this error

root@prometheus:~# pve-efiboot-tool init /dev/sdb2
Re-executing '/usr/sbin/pve-efiboot-tool' in new private mount namespace..
UUID="" SIZE="536870912" FSTYPE="" PARTTYPE="c12a7328-f81f-11d2-ba4b-00a0c93ec93b" PKNAME="sdb" MOUNTPOINT=""
E: '/dev/sdb2' has wrong filesystem (!= vfat).
root@prometheus:~# pve-efiboot-tool init /dev/sdb1
Re-executing '/usr/sbin/pve-efiboot-tool' in new private mount namespace..
UUID="" SIZE="1031168" FSTYPE="" PARTTYPE="21686148-6449-6e6f-744e-656564454649" PKNAME="sdb" MOUNTPOINT=""
E: '/dev/sdb1' is too small (<256M).
root@prometheus:~# pve-efiboot-tool init /dev/sdb3
Re-executing '/usr/sbin/pve-efiboot-tool' in new private mount namespace..
UUID="" SIZE="299462063616" FSTYPE="" PARTTYPE="6a898cc3-1dd2-11b2-99a6-080020736631" PKNAME="sdb" MOUNTPOINT=""
E: '/dev/sdb3' has wrong partition type (!= c12a7328-f81f-11d2-ba4b-00a0c93ec93b).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment