You are not logged in.
##UPDATE: jonno2002 solved this issue for me. The solution was to mount my EFI partition (for me, /dev/sda1) to /mnt, then input this command:
grub-install --target=x86_64-efi --efi-directory=/mnt --bootloader-id=GRUB##Original Post:
Hello. I recently built a new PC and transferred my old SSD to my new PC. My old PC was booting in legacy mode, so in order to make my SSD boot-compatible with UEFI I had to install Grub onto an EFI partition on my drive. After doing so, every time I start my PC it boots into the Grub command line. I'm able to get it too boot into Arch Linux manually with:
set root=(hd0,gpt102)
linux (hd0,gpt102)/boot/vmlinuz-linux root=/dev/sda102
initrd (hd0,gpt102)/boot/initramfs-linux.img
bootThis is the output of fdisk -l:
Disk model: Samsung SSD 870
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 14C4BD10-045E-4D10-9BBC-5ACAB1604C70
Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda5 1952602112 1953525134 923023 450.7M Microsoft basic data
/dev/sda6 1748418560 1952602111 204183552 97.4G Linux filesystem
/dev/sda100 368082944 368492543 409600 200M BIOS boot
/dev/sda101 368492544 385269759 16777216 8G Linux swap
/dev/sda102 385269760 1748418559 1363148800 650G Linux filesystemThe partition where I installed Grub is in /dev/sda1 and my root partition is in /dev/sda102
When I'm in Arch Linux I have to manually mount my EFI directory with
mount /dev/sda1 /mntThe contents of /mnt/EFI:
BOOT ubuntuThe contents of /mnt/EFI/BOOT:
BOOTX64.EFI fbx64.efi mmx64.efiThe contents of /mnt/EFI/ubuntu:
BOOTX64.CSV grub.cfg grubx64.efi mmx64.efi shimx64.efiThe contents of /mnt/EFI/ubuntu/grub.cfg:
search.fs_uuid 61AF-0FCA root hd0,gpt102
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfgThis is where there might be an issue. The UUID 61AF-0FCA in /mnt/EFI/ubuntu/grub.cfg is the UUID of my EFI partition, NOT my root partition. The problem is that when I change this to my root partition's UUID (not partuuid) and restart my PC, it just boots directly into BIOS and I can't get it to boot into the SSD at all, and I have to boot into a live USB to change it back.
Here's the contents of /etc/fstab:
#
# /etc/fstab: static file system information
#
# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sda102
UUID=32651e3f-b094-430c-966b-4f9cd4a3c44e / ext4 rw,relatime,data=ordered 0 1
UUID=323ed795-dd1a-4d3a-9970-98357a7cf8e2 none swap defaults 0 0When I mount my EFI partition to /mnt and attempt to grub-install /dev/sda, this is the error message I get:
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.These are the contents of my root partition's /boot directory:
efi grub initramfs-linux-fallback.img initramfs-linux.img intel-ucode.img vmlinuz-linux vmlinuz-linux2Both /boot/efi and /boot/grub each have a grub.cfg file in them.
Could someone lend me a hand? Thanks in advance!
Last edited by axsc (2023-06-27 00:12:56)
Offline
grub-install /dev/sdais not correct.
please read this page: https://wiki.archlinux.org/title/GRUB#Installation
the correct way to install grub if your efi partition is mounted to /mnt would be:
grub-install --target=x86_64-efi --efi-directory=/mnt --bootloader-id=GRUByou have a big mess on your hands anyway with things all in the wrong places
Offline
grub-install /dev/sdais not correct.
please read this page: https://wiki.archlinux.org/title/GRUB#Installation
the correct way to install grub if your efi partition is mounted to /mnt would be:
grub-install --target=x86_64-efi --efi-directory=/mnt --bootloader-id=GRUByou have a big mess on your hands anyway with things all in the wrong places
I just tried that command, and here's the output:
Installing for x86_64-efi platform.
grub-install: warning: disk does not exist, so falling back to partition device /dev/sda1.
grub-install: warning: disk does not exist, so falling back to partition device /dev/sda1.
grub-install: warning: disk does not exist, so falling back to partition device /dev/sda1.
grub-install: error: disk `hostdisk//dev/sda1' not found.When I tried grub-install --target=x86_64-efi --efi-directory=/dev/sda1 --bootloader-id=GRUB:
Installing for x86_64-efi platform.
grub-install: error: failed to get canonical path of `devtmpfs'.Could you specify which things are in the wrong places? Thanks
Last edited by axsc (2023-06-26 23:46:00)
Offline
did you mount /dev/sda1 to /mnt before running that command..... i only gave this command because thats how you appear to be trying to do it.
Offline
did you mount /dev/sda1 to /mnt before running that command..... i only gave this command because thats how you appear to be trying to do it.
Woops, my mistake was I didn't use sudo lol.
This seemed to add a GRUB directory to /mnt/EFI:
BOOT GRUB ubuntuThe contents of /mnt/EFI/GRUB:
grubx64.efiLast edited by axsc (2023-06-27 00:01:27)
Offline
lsblk -f
ls -R /mntEDIT: nevermind you fixed it.... well does it work now ?
Last edited by jonno2002 (2023-06-27 00:02:28)
Offline
lsblk -f ls -R /mnt
My mistake was I didn't use sudo lol.
After using the command you gave me:
Installing for x86_64-efi platform.
Installation finished. No error reported.Output of lsblk -f"
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1 vfat FAT32 EFI 61AF-0FCA 504.8M 1% /mnt
├─sda5 vfat FAT32 2620-FD4F
├─sda6 ext4 1.0 6733c547-045d-4eb3-83de-5dee002aa421
├─sda100
├─sda101 swap 1 323ed795-dd1a-4d3a-9970-98357a7cf8e2 [SWAP]
└─sda102 ext4 1.0 32651e3f-b094-430c-966b-4f9cd4a3c44e 3.6G 94% /And ls -R /mnt:
/mnt:
EFI
/mnt/EFI:
BOOT GRUB ubuntu
/mnt/EFI/BOOT:
BOOTX64.EFI fbx64.efi mmx64.efi
/mnt/EFI/GRUB:
grubx64.efi
/mnt/EFI/ubuntu:
BOOTX64.CSV grub.cfg grubx64.efi mmx64.efi shimx64.efiThe /mnt/EFI/GRUB directory seems to be new after I input your command.
The contents of /mnt/EFI/ubuntu/grub.cfg seems to be the same as before (I'm not sure if that's a problem):
search.fs_uuid 61AF-0FCA root hd0,gpt102
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfgOffline
i have no idea how ubuntus grub works, you will have to ask on their forums if thats the grub you want to use.
the arch grub should work now if you reboot and select it from the efi boot menu, thats assuming you've already done the rest of the grub setup like grub-mkconfig, refer to the wiki link i posted for all of that
Offline
lsblk -f ls -R /mntEDIT: nevermind you fixed it.... well does it work now ?
Yes, that worked! Thank you so much!
Just a couple followup questions:
1. Is that EFI partition at /dev/sda1 supposed to be mounted when I boot into Arch? I vaguely recall reading somewhere that it's supposed to be listed in /etc/fstab
2. You might have noticed I have a big unallocated space in my SSD. Would it be safe to boot into a live USB to resize my Arch partition to use up the rest of that space?
Thanks again!!!
Offline
1. no it doesnt HAVE to be mounted as its only needed when running the grub-install command.
2. its never SAFE to do anything to your partitions without having a backup first, it may be fine or you might loose everything, ALWAYS BACKUP!
Offline
1. no it doesnt HAVE to be mounted as its only needed when running the grub-install command.
2. its never SAFE to do anything to your partitions without having a backup first, it may be fine or you might loose everything, ALWAYS BACKUP!
Got it. Also, I only have the ubuntu directory in /dev/sda1/EFI because I used a live Ubuntu USB to install it. Anyways, thanks again! I really appreciate you!
Offline