LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-18-2023, 10:14 AM   #1
Nishtya
Member
 
Registered: Feb 2004
Distribution: Mint Cinnamon, Debian sid KDE, PCLOS Cinnamon, Manjaro XFCE
Posts: 280

Rep: Reputation: 32
grub re-install can't find EFI directory


Not exactly a newbie to linux but I am with pure EFI boots.

I am trying to give back control of grub to my main install which is kubuntu on sda3. Please see output fdisk -l below

Disklabel type: gpt
Disk identifier: 47F4F7C8-1323-4270-9F4C-59053B5DC8A5

Device Start End Sectors Size Type
/dev/sda1 2048 1128447 1126400 550M EFI System
/dev/sda2 1128448 144488447 143360000 68.4G Microsoft basic data
/dev/sda3 144488448 322303999 177815552 84.8G Linux filesystem
/dev/sda4 322304000 411922431 89618432 42.7G Linux filesystem
/dev/sda5 411922432 500117503 88195072 42.1G Linux filesystem

Things were going along fine with a fresh install of windows 10, pclos and kubuntu on a new SSD when I decided to add one more "play with" distro, mageia (sda5). On install it did as I figured and took over the grub menu. I can boot anything fine from there. But I want kubuntu (sda3)to have control so I booted a live usb and attempted the fix I always do but grub is giving me "can't find EFI directory" it is right there - sda1 but no way of mounting I try gets the job done - can you tell me where I am going wrong? I have done this fix more times than I can count on legacy/BIOS but EFI is new to me.
 
Old 12-18-2023, 10:25 AM   #2
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,812
Blog Entries: 1

Rep: Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068
The tool efibootmgr is very likely all you need, to change the boot order from Mageia first to Kubuntu first.

If you installed Mageia by mistake in legacy mode, you'll need to reinstall it in UEFI mode, or utilize expert talent to reconfigure it from legacy mode to UEFI mode. When installed in UEFI mode, the ESP filesystem is mounted to /boot/efi/, and the directories that the UEFI BIOS and efibootmgr utilize are found.
 
Old 12-18-2023, 10:30 AM   #3
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,143

Rep: Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264
Can you give the output of "lsblk -f"?

Also please give the full command you are attempting.
 
Old 12-18-2023, 10:32 AM   #4
Nishtya
Member
 
Registered: Feb 2004
Distribution: Mint Cinnamon, Debian sid KDE, PCLOS Cinnamon, Manjaro XFCE
Posts: 280

Original Poster
Rep: Reputation: 32
Hello Mr This new SSD has never been booted in legacy mode. I went EFI all the way and mageia is EFI boot as well. It just has control of the grub menu and I don't let any of my "for playing" distros do that. I could get it back to kubuntu in a heartbeat if it was legacy. As a last resort I can just reinstall kubuntu. I can be up and running within an hour but I want to learn how to fix this without resorting to reinstall. I like to play with different distros, I have to know how to fix such. I will take a look at that tool. thx
 
Old 12-18-2023, 10:38 AM   #5
toothandnail
Member
 
Registered: Apr 2007
Location: Oxfordshire, UK
Distribution: Arch, Sparky, Salix64
Posts: 120

Rep: Reputation: 25
If you can boot Kubuntu from the grub menu, I can see no reason why you need to boot from to a live usb system. In the grub menu, select your Kubuntu menu entry. When the boot completes, check to make sure the EFI directory is mounted (findmnt should do that, or lsblk -fs), then reinstall grub from that boot and regenerate the grub config file to add the newly installed system to the boot menu.

I haven't run any version of Ubuntu in a number of years, so I've no idea of the commands to install grub and update the config. I normally use the raw grub commands:

Code:
sudo grub-install 
sudo grub-mkconfig -o /boot/grub/grub.conf
Never had a failure doing it that way...
 
Old 12-18-2023, 10:43 AM   #6
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,812
Blog Entries: 1

Rep: Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068
Almost certainly, nothing needs to be "reinstalled". Simply the priority in the UEFI NVRAM needs to be altered with efibootmgr.
 
1 members found this post helpful.
Old 12-18-2023, 10:50 AM   #7
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,523

Rep: Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494
If all the installs were EFI then all you should need to do it to change the order in the BIOS firmware as suggested above to put the Kubuntu first. From whichever Linux you can boot, you should be able to look at the /bootefi/EFI partion and see the directories for each Linux just to verify they are all EFI. Some computers don't work well with efibootmgr (HP in particular) but making that change in the BIOS is very simple.
 
1 members found this post helpful.
Old 12-18-2023, 11:00 AM   #8
Nishtya
Member
 
Registered: Feb 2004
Distribution: Mint Cinnamon, Debian sid KDE, PCLOS Cinnamon, Manjaro XFCE
Posts: 280

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by smallpond View Post
Can you give the output of "lsblk -f"?
Also please give the full command you are attempting.
lsblk is a lot of output and I forget how to put it in scrollbox here. My apologies just let me know how to do it for future. But I think this is the relevant portion?

sda
├─sda1
│ vfat FAT32 89E2-26CF 517.2M 6% /boot/efi
├─sda2
│ ntfs 16DBD957262A7DA2 45.6G 33% /media/stephanie/16DBD957262A7DA2
├─sda3
│ ext4 1.0 dfbc7bcc-3573-4df6-8d67-1982f996a6f8 63.3G 18% /var/snap/firefox/common/host-hunspell
│ /
├─sda4
│ ext4 1.0 b394fd16-1a1d-4a91-9a86-9ac88868184b 31.8G 18% /media/stephanie/b394fd16-1a1d-4a91-9a86-9ac88868184b
└─sda5
ext4 1.0 cd9cc230-8240-4f15-b386-1a5fcb54d0f3 32.4G 16% /media/stephanie/cd9cc230-8240-4f15-b386-1a5fcb54d0f3
sr0

Commands: I tried just my usual: sudo mount /dev/sda3 /mnt (that's where the kubuntu is)
then sudo grub-install --boot-directory=/mnt/boot /dev/sda (it worked for legacy but obviously not UEFI)

Messed around with some things I googled to direct grub to boot/EFI but just returned errors. All the installs can be loaded fine and I changed the default (through Mageia's control panel) to kubuntu but I really want to learn to do this the right way. I looked at the wiki for the EFI mgmt tool and it started going way over my head.
 
Old 12-18-2023, 11:05 AM   #9
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,812
Blog Entries: 1

Rep: Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068
Once you get Kubuntu back in control, you'll want to prevent the others from taking it back. There are multiple approaches to this. One is to uninstall Grub from all but Kubuntu, but that might require you do some manual reconfiguration via /etc/grub.d/*_custom so that Kubuntu can use kernel and initrd symlinks of the other distros instead of needing to change as kernel versions increment. This is my foundational method. Another is to simply reconfigure /etc/fstab on each of the others so that the ESP doesn't get mounted automatically (option noauto), or remove the ESP entry entirely. Inability to write to the ESP by the others will ensure Kubuntu should stay in control. I do this as well. Only one bootloader is needed no matter how many distros are installed. I have upwards of a dozen distros each on a bunch of UEFI PCs. I use Tumbleweed's Grub for booting on all.
 
1 members found this post helpful.
Old 12-18-2023, 11:13 AM   #10
Nishtya
Member
 
Registered: Feb 2004
Distribution: Mint Cinnamon, Debian sid KDE, PCLOS Cinnamon, Manjaro XFCE
Posts: 280

Original Poster
Rep: Reputation: 32
<SOLVED> grub re-install can't find EFI directory

Quote:
Originally Posted by yancek View Post
If all the installs were EFI then all you should need to do it to change the order in the BIOS firmware as suggested above to put the Kubuntu first. From whichever Linux you can boot, you should be able to look at the /bootefi/EFI partion and see the directories for each Linux just to verify they are all EFI. Some computers don't work well with efibootmgr (HP in particular) but making that change in the BIOS is very simple.
Yancek, yes it was easy to do in the bios. I just did it now to get this all over with - but I want to learn why I can't get ubuntu in control again similar to what Mr is saying I want my main install to not lose control. Before I went all UEFI on this new disk- old disk I actually had partitioned gpt, with legacy ROMs enabled buthad UEFI - I knew that was nasty to mix as an occasional windows boot could end up with Dell blue screen trying to fix something that wasn't broke, so I went all out UEFI when I set up the new disk.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Failed to open \EFI\uniontech\grub.efi - Not found Matthew Wai Linux - Software 1 01-27-2023 12:31 AM
[SOLVED] Ooooy. EFI boot mmx64.efi.efi not found bulgin Linux - Newbie 12 12-20-2018 11:03 AM
[SOLVED] Grub-install says "error cannot find EFI directory" cov Linux - Hardware 5 06-29-2017 03:07 AM
[SOLVED] Can't find /boot/efi/EFI/Slackware/vmlinuz kernel configuration ironQiu Slackware 4 02-09-2015 06:21 AM
Infinite Grub Loop: GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB... beeblequix MEPIS 2 11-02-2013 10:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration