Tried installing grub to another partition than currently running OS', then met error such:
$ sudo grub-install /dev/sda6
Installing for x86_64-efi platform.
grub-install: error: failed to make directory: '/boot/efi/EFI/artix'
found out:
$ ls -l /boot
drwxr-xr-x 5 root root 4096 Jan 10 22:29 /boot/
total 98481
drwx------ 3 root root 1024 Jan 1 1970 efi/
drwxr-xr-x 6 root root 4096 Jun 8 2022 grub/
drwxr-xr-x 2 root root 4096 Nov 14 11:27 memtest86+/
-rw-r--r-- 1 root root 51200 Dec 21 02:25 amd-ucode.img
-rw------- 1 root root 33222738 Jan 10 22:29 initramfs-linux-fallback.img
-rw------- 1 root root 6296268 Jan 10 22:28 initramfs-linux.img
...
Now have not rebooted yet.
Any clear idea what's the mistake and definitve steps for solution ?
You need to specify the target with
--target=x86_64-efi
the boot directory with
--efi-directory=/boot
and the bootloader id with
--bootloader-id="ID"
Here's the arch wiki's article (https://wiki.archlinux.org/title/GRUB#UEFI_systems) about it.
your cmd should look something like:
$ sudo grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id="GRUB"