You are not logged in.

#1 2019-03-02 12:41:53

webcapcha
Member
Registered: 2019-02-14
Posts: 167

How to mount GRUB during installation inside virtualbox

Hi there

I have two partitions like in wiki

/mnt/efi 	/dev/sda1 	EFI system partition 	FAT32
/mnt 	/dev/sda2 	Linux x86-64 root (/)  EXT4

Already installed packages grub and efibootmgr

Now I a little confused what I should substitute esp
grub-install --target=x86_64-efi --efi-directory=esp --bootloader-id=GRUB

If i try use /boot/EFI get an error: failed to get canonical path to /boot/efi

Last edited by webcapcha (2019-03-02 12:42:18)


Ukrainian

Offline

#2 2019-03-02 14:18:42

mmdamin
Member
From: Iran
Registered: 2019-02-19
Posts: 205
Website

Re: How to mount GRUB during installation inside virtualbox

webcapcha wrote:

Hi there

I have two partitions like in wiki

/mnt/efi 	/dev/sda1 	EFI system partition 	FAT32
/mnt 	/dev/sda2 	Linux x86-64 root (/)  EXT4

Already installed packages grub and efibootmgr

Now I a little confused what I should substitute esp
grub-install --target=x86_64-efi --efi-directory=esp --bootloader-id=GRUB

If i try use /boot/EFI get an error: failed to get canonical path to /boot/efi

you need to chroot into /mnt before using grub-install. also mount sda1 to /mnt/boot/efi

Offline

#3 2019-03-02 15:58:37

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: How to mount GRUB during installation inside virtualbox

webcapcha wrote:

what I should substitute esp

Replace esp with the directory under which the EFI system partition is mounted.

mmdamin wrote:

you need to chroot into /mnt before using grub-install

Not necessarily, the OP could run this command directly from the "live" environment without chrooting:

# grub-install --target=x86_64-efi --boot-directory=/mnt/boot --efi-directory=/mnt/efi --bootloader-id=Arch

Or use this instead:

# arch-chroot /mnt
[chroot]# grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=Arch

Either approach should work.

mmdamin wrote:

also mount sda1 to /mnt/boot/efi

No need for that either, the installation guide does actually sugest /mnt/efi (or /mnt/boot) as the ESP mountpoint:

Installation Guide wrote:

Create any remaining mount points (such as /mnt/efi) and mount their corresponding partitions.

https://wiki.archlinux.org/index.php/In … le_systems & https://wiki.archlinux.org/index.php/In … le_layouts

Most other distributions mount the ESP under /boot/efi but this is optional for Arch.

EDIT: I think VirtualBox tends to "forget" NVRAM entries so you may have to add the --removable flag to the `grub-install` command.

Last edited by Head_on_a_Stick (2019-03-02 16:02:25)


Jin, Jîyan, Azadî

Offline

#4 2019-03-02 20:02:18

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: How to mount GRUB during installation inside virtualbox

Head_on_a_Stick wrote:

EDIT: I think VirtualBox tends to "forget" NVRAM entries so you may have to add the --removable flag to the `grub-install` command.

Indeed.

Whenever I need to use VirtualBox for an Arch VM I just install it in BIOS mode instead. This also has the advantage of only needing 1 partition and being more portable.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#5 2019-03-03 13:02:05

mmdamin
Member
From: Iran
Registered: 2019-02-19
Posts: 205
Website

Re: How to mount GRUB during installation inside virtualbox

Head_on_a_Stick wrote:
webcapcha wrote:

what I should substitute esp

Replace esp with the directory under which the EFI system partition is mounted.

mmdamin wrote:

you need to chroot into /mnt before using grub-install

Not necessarily, the OP could run this command directly from the "live" environment without chrooting:

# grub-install --target=x86_64-efi --boot-directory=/mnt/boot --efi-directory=/mnt/efi --bootloader-id=Arch

Or use this instead:

# arch-chroot /mnt
[chroot]# grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=Arch

Either approach should work.

mmdamin wrote:

also mount sda1 to /mnt/boot/efi

No need for that either, the installation guide does actually sugest /mnt/efi (or /mnt/boot) as the ESP mountpoint:

Installation Guide wrote:

Create any remaining mount points (such as /mnt/efi) and mount their corresponding partitions.

https://wiki.archlinux.org/index.php/In … le_systems & https://wiki.archlinux.org/index.php/In … le_layouts

Most other distributions mount the ESP under /boot/efi but this is optional for Arch.

EDIT: I think VirtualBox tends to "forget" NVRAM entries so you may have to add the --removable flag to the `grub-install` command.

yes I used /boot for my esp to keep updated kernel and initrd in esp without need for any other actions. Thank you, I just suggested easiest way in my opinion. in this way grub-install will work without any arguments.

Offline

#6 2019-03-03 13:08:13

mmdamin
Member
From: Iran
Registered: 2019-02-19
Posts: 205
Website

Re: How to mount GRUB during installation inside virtualbox

Slithery wrote:
Head_on_a_Stick wrote:

EDIT: I think VirtualBox tends to "forget" NVRAM entries so you may have to add the --removable flag to the `grub-install` command.

Indeed.

Whenever I need to use VirtualBox for an Arch VM I just install it in BIOS mode instead. This also has the advantage of only needing 1 partition and being more portable.

virtualbox has a builtin efi shell (but my firmware doesn't, can I flash it?), we can use a startup.nsh to boot in this situation. something like fs0:\vmlinuz-linux quiet root=/dev/sda2 initrd=initramfs.img in it will boot. (need to mount esp to /boot and run pacman -S linux and mkinitcpio -p linux)

Last edited by mmdamin (2019-03-03 13:10:17)

Offline

Board footer

Powered by FluxBB