You are not logged in.

#1 2019-01-07 21:20:37

BearerOfHonesty
Guest

[SOLVED] grub-install: error: failed to get canonical path of `/efi´.

I'm installing from archlinux-2019.01.01-x86_64.iso on an UEFI system and following the Installation guide down to the "Partition the disks" section and expected to pick up these instructions again at the start of the "Installation" section after following dm-crypt/Encrypting an entire system section Encrypted boot partition (GRUB) to set up encryption which goes fine until I get to the "Configuring GRUB" section where I get an error.

I think I have followed the instructions correctly.

Here are all the commands I've run so far and some notes on the filesystems.

loadkeys dk-latin1
ping archlinux.org
timedatectl set-ntp true

# Wipe drive with zeros
cryptsetup open --type plain -d /dev/urandom /dev/sda to_be_wiped
dd if=/dev/zero of=/dev/mapper/to_be_wiped bs=1M status=progress
cryptsetup close to_be_wiped

gdisk /dev/sda
# Number  Start (sector)    End (sector)  Size       Code  Name
#    1            2048            4095   1024.0 KiB  EF02  BIOS boot partition
#    2            4096         1130495   550.0 MiB   EF00  EFI System
#    3         1130496         2256895   550.0 MiB   8300  Linux filesystem
#    4         2256896       250069646   118.2 GiB   8E00  Linux LVM

# LVM
cryptsetup luksFormat --type luks2 /dev/sda4
cryptsetup open /dev/sda4 cryptlvm
pvcreate /dev/mapper/cryptlvm
vgcreate MyVolGroup /dev/mapper/cryptlvm
lvcreate -L 12G MyVolGroup -n swap
lvcreate -L 32G MyVolGroup -n root
lvcreate -l 100%FREE MyVolGroup -n home
mkfs.ext4 /dev/MyVolGroup/root
mkfs.ext4 /dev/MyVolGroup/home
mkswap /dev/MyVolGroup/swap
mount /dev/MyVolGroup/root /mnt
mkdir /mnt/home
mount /dev/MyVolGroup/home /mnt/home
swapon /dev/MyVolGroup/swap

# Boot partition
cryptsetup luksFormat --type luks1 /dev/sda3
cryptsetup open /dev/sda3 cryptboot
mkfs.ext4 /dev/mapper/cryptboot
mkdir /mnt/boot
mount /dev/mapper/cryptboot /mnt/boot

# EFI System partition
mkfs.fat -F32 /dev/sda2
mkdir /mnt/efi
mount /dev/sda2 /mnt/efi

lsblk
# NAME                  MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
# sda                   8:0      0 119.2G  0 disk
# ├─sda1                8:1      0     1M  0 part
# ├─sda2                8:2      0   550M  0 part  /mnt/efi
# ├─sda3                8:3      0   550M  0 part
# │ └─cryptboot         254:4    0   548M  0 crypt /mnt/boot
# └─sda4                8:4      0 118.2G  0 part
#   └─cryptlvm          254:0    0 118.2G  0 crypt
#     ├─MyVolGroup-swap 254:1    0    12G  0 lvm   [SWAP]
#     ├─MyVolGroup-root 254:2    0    32G  0 lvm   /mnt
#     └─MyVolGroup-home 254:3    0  74.2G  0 lvm   /mnt/home

# mkinitcpio
# Change HOOKS line in /etc/mkinitcpio.conf to:
# HOOKS=(base systemd autodetect keyboard sd-vconsole modconf block sd-encrypt sd-lvm2 filesystems fsck)

# GRUB
grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB --recheck

This is the error the last command spits out:

Installing for x86_64-efi platform.
grub-install: error: failed to get canonical path of `/efi´.

I was thinking that maybe it was supposed to be /mnt/efi instead but that just gives:

Installing for x86_64-efi platform.
grub-install: error: failed to get canonical path of `airootfs´.

Any idea where I went wrong or is it the wiki that's wrong?

Last edited by BearerOfHonesty (2019-01-08 07:01:33)

#2 2019-01-07 21:39:39

respiranto
Member
Registered: 2015-05-15
Posts: 479
Website

Re: [SOLVED] grub-install: error: failed to get canonical path of `/efi´.

Apparently, grub-install tries to do something with the root filesystem (airootfs).

Try running the command from within the chroot after having installed base and grub (the package).

Last edited by respiranto (2019-01-07 21:40:44)

Offline

#3 2019-01-07 21:43:47

BearerOfHonesty
Guest

Re: [SOLVED] grub-install: error: failed to get canonical path of `/efi´.

When should I be doing that and is the system even ready for that yet? Comparing the two sets of instructions it doesn't look like I've gotten far enough in the instructions for setting up encryption to where the normal installation instructions expect me to chroot which is why I haven't tried yet.

#4 2019-01-07 22:38:08

respiranto
Member
Registered: 2015-05-15
Posts: 479
Website

Re: [SOLVED] grub-install: error: failed to get canonical path of `/efi´.

You should be ready to run pacstrap and then arch-chroot.

Don't forget to change the mkinitcpio.conf inside the chroot.

Offline

#5 2019-01-08 02:47:15

BearerOfHonesty
Guest

Re: [SOLVED] grub-install: error: failed to get canonical path of `/efi´.

That seems to work.

With all the juggling around of the order of things to do in the two guides, have I made any obvious errors in the following commands? This includes redoing the last two sections in the original post in a different order but otherwise continues from there and seems to work other than that I still have to enter the passphrase twice, and it uses a US keymap rather than a Danish one for the first of those prompts, but these are at least obvious problems that are easy enough to work on, I'm more worried about having done something wrong that's non-obvious.

# Installation guide, Installation, Install the base packages
packstrap /mnt base base-devel vim

# Installation guide, Installation, Configure the system, Fstab
genfstab -U /mnt >> /mnt/etc/fstab

# Installation guide, Installation, Configure the system, Chroot
arch-chroot /mnt

# Installation guide, Installation, Configure the system, Time zone
ln -sf /usr/share/zoneinfo/Europe/Copenhagen /etc/localtime

# Installation guide, Installation, Configure the system, Localization
vim /etc/locale.gen
# Uncomment en_US.UTF-8 UTF-8 and other needed locales in /etc/locale.gen, and generate them with:
locale-gen
# Set the LANG variable in locale.conf(5) accordingly, for example:
vim /etc/locale.conf
# LANG=en_US.UTF-8
# If you set the keyboard layout, make the changes persistent in vconsole.conf(5):
vim /etc/vconsole.conf
# KEYMAP=dk-latin1

# Installation guide, Installation, Configure the system, Network configuration
vim /etc/hostname
# lenovo-u41-70
vim /etc/hosts
# 127.0.0.1	localhost
# ::1		localhost
# 127.0.1.1	lenovo-u41-70.localdomain	lenovo-u41-70
pacman -S networkmanager
systemctl enable NetworkManager

# dm-crypt/Encrypting an entire system, Encrypted boot partition (GRUB), Configuring mkinitcpio
vim /etc/mkinitcpio.conf
# Change HOOKS line to:
# HOOKS=(base systemd autodetect keyboard sd-vconsole modconf block sd-encrypt sd-lvm2 filesystems fsck)

# Installation guide, Installation, Configure the system, Initramfs
mkinitcpio -p linux

# Installation guide, Installation, Configure the system, Root password
passwd

# dm-crypt/Encrypting an entire system, Encrypted boot partition (GRUB), Configuring GRUB
pacman -S grub efibootmgr
grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB --recheck
grub-install --target=i386-pc --recheck /dev/sda
# Configure GRUB to recognize the LUKS encrypted /boot partition and unlock the encrypted root partition at boot:
vim /etc/default/grub
# GRUB_CMDLINE_LINUX="... rd.luks.name=<sda4-UUID>=cryptlvm" ...
# GRUB_ENABLE_CRYPTODISK=y
grub-mkconfig -o /boot/grub/grub.cfg
# Use workaround if grub-mkconfig hangs: https://bbs.archlinux.org/viewtopic.php?pid=1820949#p1820949

# dm-crypt/Encrypting an entire system, Encrypted boot partition (GRUB), Configuring fstab and crypttab
dd bs=512 count=4 iflag=fullblock if=/dev/random of=/etc/mykeyfile
chmod 600 /etc/mykeyfile
cryptsetup luksAddKey /dev/sda3 /etc/mykeyfile
vim /etc/crypttab
# cryptboot /dev/sda3   none    luks
vim /etc/crypttab
# cryptboot    UUID=<UUID identifier of crypto_LUKS partition on sda3>    /etc/mykeyfile
vim /etc/fstab
# /dev/mapper/cryptboot        /boot   ext4        defaults        0       2
vim /etc/pacman.conf
# It may be worth considering to add the GRUB bootloader to the ignore list of /etc/pacman.conf in order to take particular control of when the bootloader (which includes its own encryption modules) is updated.

# Installation guide, Installation, Configure the system, Boot loader
pacman -S intel-ucode
grub-mkconfig -o /boot/grub/grub.cfg

# Installation guide, Installation, Reboot
exit
umount -R /mnt
reboot

# TODO:
# Installation guide, Installation, Post-Installation
# Fix keymap for GRUB stage 1 https://bbs.archlinux.org/viewtopic.php?id=240739
# Fix having to enter passphrase twice to boot.
# WiFi https://wiki.archlinux.org/index.php/Network_configuration
# Suspend to disk https://wiki.archlinux.org/index.php/Dm-crypt/Swap_encryption#With_suspend-to-disk_support
# https://wiki.archlinux.org/index.php/General_recommendations
# See tip about cryptboot after install. https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system#Encrypted_boot_partition_(GRUB)

Last edited by BearerOfHonesty (2019-01-08 03:09:00)

#6 2019-01-08 06:52:39

respiranto
Member
Registered: 2015-05-15
Posts: 479
Website

Re: [SOLVED] grub-install: error: failed to get canonical path of `/efi´.

Great that it works now.  Please prepend '[SOLVED]' to your thread's title by editing the first post, unless you believe there are (serious) issues remaining.

Your list of commands looks generally fine.  Some points:

  • You run grub-mkconfig twice.  The second time suffices (though it does not at all harm to run it twice).

  • You install grub in both UEFI and BIOS mode.  I'm not sure if that is what you want.  There are good possible reasons though and in fact I had such a setup myself in the past.

  • You might consider not relying on grub-mkconfig, see [0] and the possibly generated the grub.cfg.

  • In order to prevent entering the password twice, see [1].

  • I didn't know about umount's -R option.  Thanks for that.  Unmounting explicitly before rebooting (or shutting down) is not necessary though.


[0] https://wiki.archlinux.org/index.php/Us … figuration
[1] https://wiki.archlinux.org/index.php/Dm … _initramfs

Offline

Board footer

Powered by FluxBB