LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Cannot Boot Fedora and Grub Menu Disappeared (https://www.linuxquestions.org/questions/linux-newbie-8/cannot-boot-fedora-and-grub-menu-disappeared-4175648466/)

zavmat 02-16-2019 07:37 PM

Cannot Boot Fedora and Grub Menu Disappeared
 
2 Attachment(s)
Solution Below
Hello again, I have been working for the past couple weeks now trying to get my laptop up and running after accidentally scrambling my partitions. I have had a lot of help, but cannot seem to permanently solve the problem. Running these commands
Code:

sudo mount /dev/mapper/fedora-root /mnt
sudo mount /dev/sda5 /mnt/boot
sudo mount /dev/sda1 /mnt/boot/efi
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo mount -o bind /run /mnt/run
chroot /mnt
dnf reinstall grub2-efi shim
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
exit
sudo umount /mnt/run
sudo umount /mnt/sys
sudo umount /mnt/proc
sudo umount /mnt/dev
sudo umount /mnt/boot/efi
sudo umount /mnt/boot
sudo umount /mnt

and then rebooting had originally worked in so far as grub was back, as well as these commands
Code:

sudo mkdir /mnt/test
sudo mount /dev/mapper/fedora-root /mnt/maps
sudo mount /dev/sda5 /mnt/maps/boot
sudo mount /dev/sda1 /mnt/maps/boot/efi
sudo mount --bind /dev /mnt/maps/dev
sudo mount --bind /proc /mnt/maps/proc
sudo mount --bind /sys /mnt/maps/sys
sudo cp /etc/resolv.conf /mnt/test/etc/resolv.conf
chroot /mnt/test
dnf reinstall grub2-efi shim

but I still could not boot into Fedora. I reinstalled Fedora on a new partition, hoping that it might give me an option in the boot loader that worked, but grub disappeared again and the only Fedora option in the Bios disappeared. Now, when I rerun the commands, the system just continues to go directly to the live usb. If I remove the live usb there is no bootable drive detected. Attached is a bootinfoscript to give you a little more information. Under sda8/grub2/grub.cfg the grub.cfg file, so it shouldn't need to be downloaded. Some additional questions I have are whether or not you should need to run Fedora from the Bios first in order to have grub pop up on start, and why does the bios boot list change so frequently?

Thank you for reading, I appreciate any help you can give.

Solution
1. Remove Fedora partitions with fdisk (WARNING fdisk is a dangerous tool, it is very easy to delete the wrong partitions if you aren't careful, there are probably better solutions out there, fdisk is how I got in this mess in the first place) https://wiki.mageia.org/en/How_to_de...ion_with_fdisk And/Or disk utility.
Code:

sudo fdisk /dev/sdx
where x is the disk in question.
Code:

Command (m for help): p
Code:

Command (m for help): d
here choose the partition you want to (d)elete
Code:

Command (m for help): p
Code:

Command (m for help): w
w to save changes. Do this for each partition you want to remove and reboot (even if it says it could not delete the partition, chances are it did (at least in my experience).You can also delete partitions from the disks utility. I used a combination of both.

2. Reinstall OS from live USB. Be sure to choose "Custom" under Storage Configuration. Change "LVM" to "Standard Partition." Thank you Ztcoracat for providing a comprehensive solution.
Quote:

Ztcoracat:
Create at least a 250 MB /boot partition.
-create at least a 100 MB efi partition
-create a 5 GB root partition
-create a 1 GB swap partition and than allocate the rest of the space to the /home partition.
...
https://docs.fedoraproject.org/en-US...mmend-x86.html
...
https://www.youtube.com/watch?v=OL-y_AJHesA
The second link is to a very helpful youtube video that gives you step by step instructions specifically for Fedora.
Thank you yancek for identifying LVM as the culprit and colorpurple21859 for highlighting the fact that LVM can be changed via custom installation.
Quote:

yancek:
A default install of Fedora as I understand it (I don't use it myself) will do an LVM install and create a separate boot partition in addition to putting EFI files in the EFI partition and creating LVM.
Quote:

colorpurple21859:
fedora does default to lvm partitioning, but during the disk partition stage the lvm can be changed to partition.
Additional Material
1. Bootinfoscript
Quote:

bootinfoscript is a bash script which searches all hard drives attached to the computer for information related to booting and displays it in a convenient format. Its primary use is for troubleshooting booting problems.http://bootinfoscript.sourceforge.net/
Thank you mrmazda for providing link to download: https://github.com/arvidjaar/bootinfoscript Extract download to Downloads, cd to the file and enter
Code:

sudo bash bootinfoscript
The RESULTS.txt file will be placed in the same directory if not otherwise specified.

Thank you to everyone for all your help.

Ztcoracat 02-16-2019 09:35 PM

I read through your bootinfo script and Grub is installed to the MBR of /dev/sda but if Grub won't even boot for you and trying to install grub isn't working I recommend deleting all of the partitions that are not Windows and starting over.

You should be able to use the partition manager that Anaconda uses to delete those fedora partitions.

Made sure you know which partitions are your Windows 7 partitions so you don't delete them.

Once you have deleted those partitions create new ones from the free space.

Create at least a 250 MB /boot partition.
-create at least a 100 MB efi partition
-create a 5 GB root partition
-create a 1 GB swap partition and than allocate the rest of the space to the /home partition.

When my partitions were a mess that's what I did.

https://docs.fedoraproject.org/en-US...mmend-x86.html

Ztcoracat 02-16-2019 10:20 PM

You may want to hang on to this for future use if you have trouble with Grub again.

https://fedoraproject.org/wiki/GRUB_2

yancek 02-17-2019 06:41 AM

You have a mixed Legacy/MBR install and also an EFI install. You have windows boot code in the MBR. Does windows boot? Which windows do you have, 7, 8 , 10? I would not expect windows to boot from the MBR as it is a GPT drive which with windows requires EUFI.

You have a vfat EFI partition (sda1) with the proper EFI boot files for windows and Fedora. Disable Legacy/CSM boot in the BIOS and try booting and make notes of the results.
sda7 is a BIOS-boot partition which is only needed on a GPT drive with a Legacy boot on a Linux system. You have a mix of Legacy/CSM and UEFI files which is always going to be problematic. There is a menuentry for windows on your Fedora partition but it is incorrect as it is pointing to the windows system partition (sda2) and it needs to be pointing to the EFI partition (sda1) and to the specific file. Change the set root line and the chainloader lines to what shows below after disabling Legacy/CSM in the BIOS. Make a note of the results on reboot.

Quote:

set root='hd0,gpt1'
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
I would also suggest you read the link above on fedora Grub2. If disabling Legacy/CSM in the BIOS does not work, you need to do an EFI install of Fedora and you will probably be best off starting all over after deleting your Linux partitions including the BIOS boot partition. Do not delete the vfat EFI partition.

zavmat 02-18-2019 03:23 PM

Quote:

You have a mixed Legacy/MBR install and also an EFI install. You have windows boot code in the MBR. Does windows boot? Which windows do you have, 7, 8 , 10? I would not expect windows to boot from the MBR as it is a GPT drive which with windows requires EUFI.
Windows 10 does not boot, unfortunately. I'm reading the links now, I'll get back to you guys once I've gotten somewhere I guess.

Legacy csm boot does not exist on this computer [edit, there is no option in the bios).

zavmat 02-18-2019 04:41 PM

Code:

NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0          7:0    0  1.7G  1 loop
loop1          7:1    0  6.5G  1 loop
├─live-rw    253:5    0  6.5G  0 dm  /
└─live-base  253:6    0  6.5G  1 dm 
loop2          7:2    0    32G  0 loop
└─live-rw    253:5    0  6.5G  0 dm  /
sda            8:0    0 698.7G  0 disk
├─sda1        8:1    0  200M  0 part
├─sda2        8:2    0 263.3G  0 part
├─sda3        8:3    0 263.3G  0 part
├─sda4        8:4    0    25G  0 part
├─sda6        8:6    0 120.6G  0 part
│ ├─fedora-swap
│ │          253:2    0  5.9G  0 lvm  [SWAP]
│ ├─fedora-home
│ │          253:3    0  64.8G  0 lvm 
│ └─fedora-root
│            253:4    0    50G  0 lvm 
└─sda9        8:9    0    24G  0 part
  ├─fedora00-swap
  │          253:0    0  2.5G  0 lvm  [SWAP]
  └─fedora00-root
            253:1    0  21.5G  0 lvm 
sdb            8:16  1  28.7G  0 disk /run/media/liveuser/SanDiskNTFS
sdc            8:32  1  3.7G  0 disk
├─sdc1        8:33  1  1.8G  0 part /run/initramfs/live
├─sdc2        8:34  1  9.8M  0 part
└─sdc3        8:35  1  20.5M  0 part
sr0          11:0    1  1024M  0 rom

sda6 and sda9 can't be deleted because they are busy

If GRUB is installed, is the problem in sda1?

yancek 02-18-2019 06:53 PM

Did you delete sda7 which is the partition which showed as BIOS_boot?
What happened when you changed the windows menuentry to the one I suggested above, pointing to the EFI file for windows?
Are you posting this info from the Live Fedora? Or are you now able to boot the installed Fedora?

Quote:

Legacy csm boot does not exist on this computer [edit, there is no option in the bios)
That's odd but certainly possible. Generally there is some option to allow only UEFI.

Quote:

sda6 and sda9 can't be deleted because they are busy
Why would you want to delete them? Obviously, you don't need to, you would have to turn one of them off before deleting if you want. Did you get rid of sda7 (see above)?
Could you be specific about the current status? You said you can't boot windows 10, if you change the boot entry in grub.cfg as suggested is there any change. If you do make this change in grub.cfg as a test, do NOT run grub2-mkconfig. What happens when you try to boot Fedora. Haven't read your other threads so??

zavmat 02-18-2019 09:59 PM

That was the advice, to delete all non windows partitions and try again, so that's what I did (including sda7). I do not know how to make a /boot partition, or an efi partition, or a root partition, or a swap partition, or a /home partition manually. Google does not help, I just spend hours sifting through information that only confuses me further. I try to follow something I read, it gets worse, and then I'm off fixing something else. There is definitely room for user error here, and I don't mean to imply that it is someone else's fault that I am in this position.

About three weeks ago I began my experiment with linux to see if it would correct a strange hardware problem that I was encountering in Windows. The error was making this laptop unusable. Linux did correct that error, but the version I was running (Fedora 22) was very out of date. I tried to upgrade it, following some advice I found on this forum that led me to believe reinstalling via live usb would overwrite any previous versions of Fedora. Rather than over it, Fedora 29 installed next to 22. The 22 partition was using up some 200G of disk space so I went about trying to delete it. Following advice I found on google, I ended up "scrambling my windows partitions."

We tried to fix them but it didn't work. Next came running chkdsk from a Windows 10 installation usb. That didn't fix the boot loader and made Grub disappear. Following the commands above temporarily brought GRUB back, but none of the listed partitions were bootable, because of some sulogin error or something that said the system was locked down. Fedora disappeared from the bios boot list, leaving me with only removable media as boot options. I checked the bios and there is a Legacy or CSM option that is currently disabled. all that is enabled is UEFI without which the live image cannot boot.

Today I deleted all non windows partitions, and reinstalled Fedora 29 hoping that with all other's gone, the MBR might just successfully boot into it. It did not. One last detail on grub. Two types of menus load upon reboot, sometimes one, somethimes another, and sometimes one before the other. One of them is a blurry light blue letters with white highlight displaying the selected option, the other is a crisp, regular font sized grey lettering with white highlight for selection. Both only display the live os as options along with a troubleshoot option.

Code:

NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0        7:0    0  1.7G  1 loop
loop1        7:1    0  6.5G  1 loop
├─live-rw  253:3    0  6.5G  0 dm  /
└─live-base 253:4    0  6.5G  1 dm 
loop2        7:2    0    32G  0 loop
└─live-rw  253:3    0  6.5G  0 dm  /
sda          8:0    0 698.7G  0 disk
├─sda1        8:1    0  200M  0 part
├─sda2        8:2    0 263.3G  0 part
├─sda3        8:3    0 263.3G  0 part
├─sda4        8:4    0    25G  0 part
├─sda5        8:5    0    1M  0 part
├─sda6        8:6    0    1G  0 part
└─sda7        8:7    0 120.6G  0 part
  ├─fedora-swap
  │        253:0    0  5.9G  0 lvm  [SWAP]
  ├─fedora-home
  │        253:1    0  64.8G  0 lvm  /run/media/liveuser/0cddb549-7022-4a5d-a9c
  └─fedora-root
            253:2    0    50G  0 lvm 
sdb          8:16  1  28.7G  0 disk /run/media/liveuser/SanDiskNTFS
sdc          8:32  1  3.7G  0 disk
├─sdc1        8:33  1  1.8G  0 part /run/initramfs/live
├─sdc2        8:34  1  9.8M  0 part
└─sdc3        8:35  1  20.5M  0 part
sr0          11:0    1  1024M  0 rom

Here's the new lsblk. Thank you for taking the time to respond.

Ztcoracat 02-18-2019 11:30 PM

This should help:-

https://www.youtube.com/watch?v=OL-y_AJHesA

yancek 02-19-2019 06:38 AM

Quote:

I do not know how to make a /boot partition, or an efi partition
The bootinfoscript output in your initial post above shows that you already have an EFI partition so you would not need to create one. What should happen when you install Fedora (or any Linux for that matter) is that the installer will create a new directory inside the EFI partition and put some efi boot files there. You would also have additional Grub boot files on the Fedora / (root filesystem) partition. A default install of Fedora as I understand it (I don't use it myself) will do an LVM install and create a separate boot partition in addition to putting EFI files in the EFI partition and creating LVM. I don't use LVM so can't give you any details on that.

I don't know how you got windows code in the MBR, possibly trying to repair the boot from windows? Windows 10 on a GPT drive needs to be installed in UEFI mode so the windows code in the MBR is useless.

The output below from your last post of the lsblk command would seem to indicate you did a Legacy install of Fedora. Can't think of any other reason you would have a 1MB partition? Run the bootinfoscript again and post the link or the output.

Quote:

├─sda5 8:5 0 1M 0 part

colorpurple21859 02-19-2019 07:33 AM

fedora does default to lvm partitioning, but during the disk partition stage the lvm can be changed to partition.

zavmat 02-20-2019 08:15 AM

1 Attachment(s)
If the windows boot files are useless maybe they are getting in the way of GRUB from working properly, should I try to get rid of them, is that possible?
Quote:

A default install of Fedora as I understand it (I don't use it myself) will do an LVM install and create a separate boot partition in addition to putting EFI files in the EFI partition and creating LVM.
Quote:

fedora does default to lvm partitioning, but during the disk partition stage the lvm can be changed to partition.
I think I see what you're all getting at here, I have been letting the installer automatically make the partitions for me. I'll delete everything but EFI and windows files and try installing Fedora the way the video describes.

colorpurple21859 02-20-2019 09:24 AM

see if this helps
Code:

sudo mount /dev/sda6 /mnt
sudo mount /dev/sda1 /mnt/efi
cp /mnt/grub2/grub.cfg /mnt/efi/EFI/fedora/grub.cfg


zavmat 02-20-2019 09:50 AM

1 Attachment(s)
Thanks you guys, I'm booted into Fedora now, sans live disk. Thank you for all your help and your patience. I can't tell you what a relief it is to have that problem off my shoulders after all this time. I'll compile the steps I took and put them back into the first comment in case anyone else needs to use them.

It looks like the problem was LVM after all. Once I installed Fedora as a standard partition, organized as the video and link advised, it started up no problem.

In case anyone is curious, I added a new bootinfoscript file for comparison.

yancek 02-20-2019 12:43 PM

Quote:

If the windows boot files are useless
I'm not sure you were understanding. In your specific situation the windows boot code in the MBR was useless as you have an EFI install and the necessary boot files are on both the EFI partition and the windows system partition. If the computer was set to boot in Legacy then it would use the boot code in the MBR and boot only windows. Although it is possible to boot a Linux system from windows BCD, it is a pretty convoluted process and there is nothing like grub-mkconfig available to find another OS to boot. At any rate, you have it working so enjoy.


All times are GMT -5. The time now is 10:02 AM.