Before I had a large Windows partition and a small Fedora 36 (upgraded from previous versions during last years). Now I have deleted the large Windows partition (because the space for Fedora was not enough and I was not able to shrink Windows more than that) and installed Fedora 37 from the media writer (I had to use an external wifi for the initial setup and then I re-applied the old, useful procedure for my internal wifi).
Now at boot I see the first 3 entries for f37 and then multiple entries for f36 but they are all the same: how can I fix them? Is there something else I should do to correctly manage the boot entries also in the future? I mean, what will happen for future kernel upgrades of f37 and f36, will they create n + m entries?
(Btw, is there a smart way to bring my configurations/settings/data/passwords from the small f36 partition to the new, large f37 or an approach to “fuse” them together?)
This is what I see at bootstrap time for the 4 “f36 partition” entries and that’s quite confusing
sudo grep -P "[\t]menuentry" /boot/grub2/grub.cfg | cut -d "'" -f2
Fedora Linux 36 (Workstation Edition) (on /dev/sda7)
Fedora Linux 36 (Workstation Edition) (on /dev/sda7)
Fedora Linux 36 (Workstation Edition) (on /dev/sda7)
Fedora Linux 36 (Workstation Edition) (on /dev/sda7)
UEFI Firmware Settings
I’m missing the information about the kernels, something like
sudo ls /mnt/f36/usr/src/kernels/
5.17.12-100.fc34.x86_64 6.0.8-100.fc35.x86_64 6.0.8-200.fc36.x86_64
If I boot into f36, then I can see the correct entries:
sudo grubby --info=ALL | grep title
title="Fedora Linux (6.0.8-200.fc36.x86_64) 36 (Workstation Edition)"
title="Fedora Linux (6.0.8-100.fc35.x86_64) 35 (Workstation Edition)"
title="Fedora (5.17.12-100.fc34.x86_64) 34 (Workstation Edition)"
title="Fedora (0-rescue-1cb178663c5e44d1a4ff2c09f5819ae7) 31 (Thirty One)"
How can I restore those title at boot time for 4 “f36 partition” entries?
Should I manually edit the /boot/grub2/grub.cfg? Well, that’s what I have actually done.
I suspect you have 2 different /boot directories (and possibly /boot/efi). I think grub only gets the titles from the /boot and /boot/loader/entries folders for the system it is booting though it can tell the OS for the others it is adding.
Correct. As I said, I had a large win partition + a small f36, now (after deleting win) I have a large f37 partition (with its own /boot) and a small f36 (also with another /boot). But there is only one boot loader when I switch on the pc. So I’d love to have f37 updating its entries and f36 the other ones.
What happens if I sudo dnf up when I’ve booted f36 and the kernels are updated, one is added and another removed? What happens when I boot into f37 and I do the same for its kernels? Is there a smart way to keep the entries of the boot-loader consistently updated? Thank you
Do you actually have 2 separate /boot/efi partitions? If so then things can easily be kept separate. If you only have one then the way fedora works is that it will use only one /boot even when you have more than one release installed.
The cause is that fedora identifies the /boot partition within the /boot/efi/EFI/fedora/grub.cfg file and points grub to that /boot to continue the config and boot. Whichever grub was last installed has control of that.
Using separate /boot/efi partitions allows keeping the releases totally separate.
You can configure this with a single efi partition (I think it still uses only one /boot) but I have never tried doing so.
I think it has to do with actually creating a custom menu within grub by editing the /etc/grub.d/40_custom file and creating the menuentry entries there
I’m open to all suggestions. When I deleted win and I installed f37 I decided for a physical partition and I had only one primary partition available, I think there is a max of 4… I don’t know
I’m not sure how to do that and what would be the effect on the boot loader entries… Can you point me to a tutorial or to the documentation?
How many partitions are available is not really limited. With an msdos partition table you have a maximum of 4 primary partitions, but if the last of those is an extended partition then you have many logical partitions within that extended partition. If using a gpt partition table the number of available partitions is not really limited (for all intents and purposes)
Since you already have both OSes installed and using only one efi partition I suggest you edit the 40_custom file under /etc/grub.d on the F37 system and add entries to boot the F36 install.
This is an example of the menuentry structure from my /boot/grub2/grub.cfg.
### BEGIN /etc/grub.d/30_uefi-firmware ###
menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
fwsetup
}
### END /etc/grub.d/30_uefi-firmware ###
For each menu entry you would use for a kernel you wish to boot from F36 it would need the detail from the matching /boot/loader/entries/.conf file in the F36 /boot partition. That detail would need to be added to the /etc/grub.d/40_custom file on the F37 system, then run grub2-mkconfig -o /boot/grub2/grub.cfg to recreate the grub.cfg file and make the custom menu entry available.
Be sure you save a backup of the existing grub.cfg file before it is changed just in case something goes wrong and it needs restored.
It would help you, as well as help us help you, to have a clearer understanding of your current setup. First partition info. The following command gives all the partition info I think is relevant: lsblk -o NAME,FSTYPE,SIZE,LABEL,UUID,MOUNTPOINTS
(you might need to sudo dnf install util-linux to get that command. That is a nice package to have installed).
One of those is likely mounted /boot/efi and contains EFI/fedora/grub.cfg so the whole path is /boot/efi/EFI/fedora/grub.cfg
The contents of that file are short and relevant.
It sound like two different partitions each contain EFI/fedora/grub.cfg. Simply having that file doesn’t do anything on its own, but if that is there, likely all the other machinery is there to make that a starting point for booting (point at which the efi multi-boot firmware of your bios can hand off to installed software). You probably want to have only one of those partitions. So you want to be thinking about the clean/safe approach to getting rid of the other (guessing you have another).
Each of those /EFI/fedora/grub.cfg files selects a /grub2/grub.cfg file, normally by the UUID of the partition containing it. So you want to identify those two partitions and figure out how to combine them.
In the same partition with /grub2/grub.cfg also contains several files in /loader/entries/. Those are the important things to combine. I think after being properly combined, those will work right for future updates. Each system when updating will overwrite /boot/grub2/grub.cfg but with compatible contents. I think each system will only delete its own stale files in /boot/loader/entries/ while leaving other files there untouched. But I would never trust that, and I would always keep a full backup of /boot/loader/entries/.
Having combined two efi partitions into one and having combined two boot partitions into one, you need to edit the /etc/fstab/ of whichever system had its original efi and boot eliminated, changing (typically by UUID) the mounting of /boot and /boot/efi.
All that is based on some guesses about what you are starting from, so you might want to post the info I asked for above, before starting to change anything, to get better advice. (that lsblk output plus what you find looking for EFI/fedora/grub.cfg and loader/entries/ contents in the partitions that aren’t normally mounted by the current system.
Before I start understanding the techincal details and how to do that, do you mean that when I update the kernels (dnf up) on the separate partitions (e.g when I boot into f37 or into f36), I will automatically see the the entries (at system bootstrap) well updated or should i continue to keep them in sync as I have already done now, manually?
No, Whichever kernel is last updated will control grub without further administration.
Looking at what was posted it seems you may be booting in legacy mode.
Please post the output of cat /sys/firmware/efi. If you are booting in efi mode then it will show something like this
# cat /sys/firmware/efi
cat: /sys/firmware/efi: Is a directory
If it gives a different message then you are booting in legacy mode and the instructions change.
Which release was booted when you posted the last?
It seems windows was installed in legacy mode, and thus F36 on /dev/sda7 would have been installed in legacy mode.
Those responses show you are clearly booting legacy mode and not using uefi. Thus everything changes. It seems that for some reason the efi partition was not mounted when you showed the lsblk output above.
You have ext4 file systems on /dev/sda3, sda5, and sda7. The output of your ls commands show efi and /boot/efi/EFI/fedora have content so whichever release was booted at that time was efi booted.
It seems quite possible that you have installed fedora 37 in efi mode but fedora 36 in MBR mode and that just does not work for booting both without selecting them individually within the bios boot menu. With this situation it is difficult (or impossible) to get grub for one to boot the other.
Net analysis:
Two different OSes installed in 2 different boot modes → You need to reinstall one or the other so both are booting in the same mode. After that you can manipulate things to get both to boot from grub.
Maybe it would be easier to install again the larger Fedora 37 (I’m not sure it is worth it), but what does it mean to install it in EFI or MBR mode? In which point of the installation can I take this decision?
You have ext4 file systems on /dev/sda3, sda5, and sda7. The output of your ls commands show efi and /boot/efi/EFI/fedora have content so whichever release was booted at that time was efi booted.
At that time (= now) the larger f37 was booted. Now let me boot into Fedora 36 to double check…
That seems both may have been installed in MBR mode. The F36 install seems to have a separate /boot partition but the F37 install seems to not have a separate /boot as it is probably part of the root partition. This is probably OK and can be worked around, but I am not familiar with how to do that.
With MBR boot being able to boot separate installs is another can of worms I do not understand myself as I have not used MBR boot for many years and have never tried to use dual booting of 2 fedora installs.
This is one link I found but it was for fedora 23 and I do not know what or how much has changed in 24 releases (12 years). Most of the other links seem to be for UEFI booting.
I think the way your system is set up, at least for F37, the /boot/ and /boot/efi/ are not the ones actually used in booting. That would probably be due to some error and/or intention edit in /etc/fstab
When various operation (such as kernel update) change boot information, most of them do so simply trusting that /boot/ and /boot/efi/ are the correct places. They change the files in those places regardless of the possibility that those aren’t the files actually used in booting.
I think you are always booting through a copy of grub installed on sda2. You did not ever show us sda2 mounted.
By understanding your current boot setup, there is probably some simple edit that would get it to behave the way you want.
You should mount sda2 somewhere and look around on it to see how your current boot is set up.
No, I think sda2 is an old win (bootloader) partition and I think it is irrelevant.
The real point is that f36 has a separate /boot partition: sda5!
When I created f37 I was (and I am) afraid to point it to the same /boot partition.
So f37 has only one partition sda3, with /boot inside.
Maybe the solution could be to configure f37 with the same /boot partition as f36.
But I feel it is too risky trying to do that.
Unless I am very sure of the steps to do, I’ll keep updating the f36 entries of the f37 /boot/grub2/boot.cfg manually.