[SOLVED] Multiple grub and boot folders. Which one is used at bootup?
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Multiple grub and boot folders. Which one is used at bootup?
Hi all,
would require some assistance here.
I have a Dell Inspiron 15 5000 series using amd64 bit. I installed Mint 18.1 from the Live CD. During installation, I created three partitions /swap, / and /home. I selected the already existing /dev/sda1 EFI System partition as the boot partition. After installing, when I reboot, it goes into "grub rescue>" prompt due to unrecognised file format.
It appears that due to previous installations and many attempts by me to fix this issue using the Live CD has resulted in grub getting installed in many folders.
sudo fdisk -l out put is:
Device Start End Sectors Size Type
/dev/sda1 2048 1026047 1024000 500M EFI System
/dev/sda2 1026048 1288191 262144 128M Microsoft reserved
/dev/sda3 1288192 1325110255 1323822064 631.3G Microsoft basic data
/dev/sda4 1927524352 1928466431 942080 460M Windows recovery environment
/dev/sda5 1928466432 1951135743 22669312 10.8G Windows recovery environment
/dev/sda6 1951137792 1953523711 2385920 1.1G Windows recovery environment
/dev/sda7 1325111296 1332922367 7811072 3.7G Linux swap
/dev/sda8 1332922368 1381750783 48828416 23.3G Linux filesystem
/dev/sda9 1381750784 1927524351 545773568 260.3G Linux filesystem
/dev/sda11 1951135744 1951137791 2048 1M BIOS boot
"Partition table entries are not in disk order."
While using the Live CD, I mounted /dev/sda8 (which is where I installed Mint 18.1) to /mnt
I then ran "ls /mnt/boot/grub". The output is
fonts grub.cfg grubenv locale unicode.pf2 x86_64-efi
In the /mnt/boot/grub/x86_64-efi folder the relevant .mod files are found.
I then unmounted /dev/sda8 and mounted /dev/sda1 (EFI System partition) to /mnt using "sudo mount /dev/sda1 /mnt"
Now "ls /mnt" gives:
boot boot-sav EFI grub
when I check /mnt/boot/ it has only one folder "grub". Inside /mnt/boot/grub the following files are found:
fonts grubenv locale x86_64-efi
When I enter "ls /mnt/boot/grub/x86_64-efi" it lists all the .mod files similar to /dev/sda8/boot/grub/x86_64-efi earlier
Most importantly, when I enter "ls /mnt/EFI", it shows:
Boot dell Microsoft ubuntu
* Reminder: this is while mounting /dev/sda1 (EFI partition) to /mnt....
In /mnt/EFI/ubuntu, the following files are found:
fw fwupx64.efi grub.cfg grubx64.efi mmx64.efi MokManager.efi shimx64.efi
In addition, when I enter, "ls /mnt/EFI/Boot/" it shows the following:
bkpbootx64.efi bootx64.efi
So can someone please let me know how to find out which grub version in which folder is used at bootup as it gives me "grub rescue>" prompt?
Note: During bootup, I can't change the boot settings to UEFI as it only lists IPv4 and IPv6 options. When the live CD is inserted, UEFI boot options shows the the additional DVD option along with IPv4 and IPv6. However, only the "legacy" boot option gives the "hard disk" option, so I am forced to change the boot options (by pressing F2) to legacy.
Note: I am also unable to install boot-repair while booting with the Live CD even after adding the repo.
On UEFI systems, the EFI partition holds bootloaders. Normally when the computer boots, it will look in its settings to see which bootloader is first in the line and load it. Let's say it loads GRUB from EFI/ubuntu/grubx64.efi, then this program will use its configurations (grub.cfg) to display the possible options to boot.
The /boot/grub/ on your Linux filesystem is the traditional place where configuration files for GRUB were found in the time of MBR. It still contains certain files and usually a copy of these files are place on the EFI partition at EFI/ubuntu/.
What is bugging me are the 2 copies of grub.cfg, one in EFI/ubuntu/ and one in /boot/grub/. I do not use Ubuntu but I do boot my Linux distro with GRUB on an EFI machine. My grub.cfg is in /boot/grub/. Anyway, for the time being you can ensure that both copies are the same by copying back and forth, then later you can
experiment by modifying one of them and see if it changes anything.
You could boot the live DVD, chroot into your Linux filesystem and run grub-mkconfig:
Code:
# mount -t ext4 /dev/sda8 /mnt
# mount -t vfat /dev/sda1 /mnt/boot/efi
# mount -t proc /proc /mnt/proc
# mount --rbind /sys /mnt/sys
# mount --rbind /dev /mnt/dev
# mount --rbind /run /mnt/run
# chroot /mnt env -i HOME=/root TERM=$TERM PATH=/usr/bin:/usr/sbin:/bin:/sbin bash --login +h
# grub-mkconfig -o /boot/grub/grub.cfg
# cp /boot/grub/grub.cfg /boot/efi/EFI/ubuntu/grub.cfg
In case it still does not boot, the culprit is that Legacy boot.
at the grub rescue prompt enter "set" without the quotation marks. the line starting with "prefix" should tell you were grub is looking for the grub files.
edit: after reading again, here is part of your problem:
Quote:
I selected the already existing /dev/sda1 EFI System partition as the boot partition.
the efi partition /dev/sda1 should be mounted on /boot/efi when in efi mode, not on /boot. Not sure what you will have to do to fix this without knowing where your kernel and initrd is located.
at the very least will have to move /boot off of the efi partition and edit your /etc/fstab for /dev/sda1 to be mounted to /boot/efi and change where /boot is located and edit fstab for the /boot entry
Last edited by colorpurple21859; 07-05-2017 at 07:06 AM.
On Ubuntu, the grub.cfg file in the EFI partition doesn't do any more than point to the actual grub.cfg file on the Ubuntu partition. The grub.cfg file on the Ubuntu partition has all the actual menuentries.
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Rep:
You tried to configure the efi partition as /boot. Something went wrong, because there is a boot directory with contents on the root partition of the Linux installation. If you look in the /etc/fstab file of the Linux installation, it will tell you if anything is being mounted as /boot. If there is no entry in fstab, then /boot is a plain directory, not corresponding to a separate partition.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.