File::Path::make_path("$targetdir/$espmp/EFI/proxmox") ||
die "unable to create directory $targetdir/$espmp/EFI/proxmox\n";
- syscmd("chroot $targetdir bootctl --no-variables --path /$espmp install") == 0 ||
+ syscmd("chroot $targetdir bootctl --path /$espmp install") == 0 ||
die "unable to install systemd-boot loader\n";
write_config("timeout 3\ndefault proxmox-*\n",
"$targetdir/$espmp/loader/loader.conf");
die "unable to mount proc on $targetdir/proc\n";
syscmd("mount -n -t sysfs sysfs $targetdir/sys") == 0 ||
die "unable to mount sysfs on $targetdir/sys\n";
+ if ($boot_type eq 'efi') {
+ syscmd("mount -n -t efivarfs none $targetdir/sys/firmware/efi/efivars") == 0 ||
+ die "unable to mount efivarfs on $targetdir/sys/firmware/efi/efivars: $!\n";
+ }
syscmd("chroot $targetdir mount --bind /mnt/hostrun /run") == 0 ||
die "unable to re-bindmount hostrun on /run in chroot\n";
syscmd("umount $targetdir/mnt/hostrun");
syscmd("umount $targetdir/tmp");
syscmd("umount $targetdir/proc");
+ syscmd("umount $targetdir/sys/firmware/efi/efivars");
syscmd("umount $targetdir/sys");
if ($use_zfs) {
mount -n -t proc proc /proc
mount -n -t sysfs sysfs /sys
+if [ -d /sys/firmware/efi ]; then
+ echo "EFI boot mode detected, mounting efivars filesystem"
+ mount -nt efivarfs none /sys/firmware/efi/efivars
+fi
mount -n -t tmpfs tmpfs /run
parse_cmdline