PDA

View Full Version : Best way to reinstall Grub



safulop
30th July 2017, 08:50 AM
Something somehow deleted my bootloader file, so now my Fedora boot process leads to shim MOK manager instead of booting up. I see that the grubx64 file is missing, although the cfg file is still present ?

What is the best way to reactivate Grub without changing the installation or reinstalling? I do have a Fedora 25 Live disk but I don't want to reinstall because that would erase everything right?

tim8723
30th July 2017, 12:39 PM
Right. Since a good answer has already been published, here is a link:

https://ask.fedoraproject.org/en/question/40578/how-to-reinstall-or-fix-grub-in-fedora-without-a-recovery-option-on-the-live-cd/

Tim

amiga
30th July 2017, 07:55 PM
Right. Since a good answer has already been published, here is a link:

Did you actually read the post in the link you gave tim8723 ? It has nothing to do with this post as their system is legacy BIOS and not UEFI. The OP in this thread definitely has a UEFI system.

Also if you read that thread it is one of the worst examples ever. The OP in that thread has a very confusing disk structure with two Fedora installations, one with LVM and one with standard partitions. Also their BIOS Boot partition which should be only 1 MB in size is 128 MB and their main Linux partition is labeled "Microsoft Basic Data". All of these inconsistencies result in the responses being very confused and incorrect. I could not imagine a worse example for how to re-install grub on a UEFI system for the OP in this thread primarily since the OP in that thread has a BIOS/GPT system in addition to many confusing factors.

safulop
31st July 2017, 03:01 AM
Did you actually read the post in the link you gave tim8723 ? It has nothing to do with this post as their system is legacy BIOS and not UEFI. The OP in this thread definitely has a UEFI system.

Also if you read that thread it is one of the worst examples ever. The OP in that thread has a very confusing disk structure with two Fedora installations, one with LVM and one with standard partitions. Also their BIOS Boot partition which should be only 1 MB in size is 128 MB and their main Linux partition is labeled "Microsoft Basic Data". All of these inconsistencies result in the responses being very confused and incorrect. I could not imagine a worse example for how to re-install grub on a UEFI system for the OP in this thread primarily since the OP in that thread has a BIOS/GPT system in addition to many confusing factors.

Thanks, I thought that thread was trash also and did not attempt to follow the solutions offered, which are far too DIY for me anyway.

lsatenstein
31st July 2017, 03:48 AM
I ran sudo dnf list grub*
and came way with
dnf list grub* | cut -d' ' -f1-2

Installed Packages
grub-customizer.x86_64
grub2.x86_64
grub2-efi.x86_64
grub2-tools.x86_64
grubby.x86_64
Available Packages
grub2-breeze-theme.x86_64
grub2-efi-modules.x86_64
grub2-starfield-theme.x86_64
[leslie@F26onE ~]$ dnf list grub* | cut -d' ' -f1
Last
Installed
grub-customizer.x86_64
grub2.x86_64
grub2-efi.x86_64
grub2-tools.x86_64
grubby.x86_64
Available
grub2-breeze-theme.x86_64
grub2-efi-modules.x86_64
grub2-starfield-theme.x86_64

try dnf reinstall grub* Which should fix up your issue.

safulop
31st July 2017, 05:43 AM
I have no idea how the previous post could be applied to my situation, where I have a Fedora system which cannot be booted into nor mounted. At least, I have no idea how to mount it from running a Live USB.

srakitnican
31st July 2017, 07:30 AM
From Live media, you can mount your system and chroot into it. Since you are using UEFI boot method, you must also mount EFI System partition under /boot/efi . Here is a few links that can help you with that, and don't follow advices to use grub2-install since that is not used on an UEFI system.

https://unix.stackexchange.com/a/72599/215643

https://fedoraproject.org/wiki/GRUB_2#Install_the_bootloader_files

If your board's firmware still does not recognize Fedora boot loader, you might have to install an entry with efibootmgr.

srakitnican
31st July 2017, 07:54 AM
Thanks, I thought that thread was trash also and did not attempt to follow the solutions offered, which are far too DIY for me anyway.

Weeelll there is no GUI with a single tick for this one that I am aware of. You have to do some research on how to do stuff yourself. If you find this too hard right now, it might be easier for you to just reinstall then.

safulop
31st July 2017, 08:55 AM
I can handle the tough stuff when necessary; has anyone used Super Grub Disk for this problem? I am trying it now but when I create their bootable USB from the iso image it is not actually bootable....

safulop
31st July 2017, 07:36 PM
OK I was able to mount the installed system using the Live system, but I think it is more broken than I thought because it says "no" to both dnf and yum, and apt-get doesn't work right either.

So at this point I am just going to roll into Fedora 26; what happens if I use the installer with manual partitions to stick the new system where the old one is? Will it automatically do updates or will I end up with two of everything?

srakitnican
31st July 2017, 08:42 PM
It will format the partition and create new system on '/' partition from scratch, It think there is no "overwrite" option if I remember correctly. But stuff did change since last time I've used an installer, so I might be completely wrong. But it should be possible to install a new system in a different partition and to keep this one for reference.

There was an option to keep /home partition though if you have it separate, in that case be sure to do manual partitioning and to tell it to not format. In any case is always a good idea to backup anything important to you before this action.

nsnbm
1st August 2017, 03:31 AM
what happens if I use the installer with manual partitions to stick the new system where the old one is? Will it automatically do updates or will I end up with two of everything?

If you choose to "stick the new system where the old one is" then the installer will reformat the partition with the old system and install the new system on that partition. That is effectively, overwritng that partition with the new installation. Before it writes anything to disk, the installer will give you a window telling you which partition it will "reformat" so that you can make a final check that it's doing what you want it to. If it's not what you want, you can go back and start partitioning again or readjust what you have configured. As mentioned above, you have to choose custom partitioning to arrange all of this. The installer only reformats partitions which have the reformat box ticked.

A new installation from media such as a usb or disk doesn't automatically do updates and if you install over the old partition you will not end up with anything from the old system, so there's no doubling up.

amiga
1st August 2017, 04:27 AM
OK I was able to mount the installed system using the Live system, but I think it is more broken than I thought because it says "no" to both dnf and yum, and apt-get doesn't work right either.


This doesn't make sense as apt-get is not in Fedora at all. It is package management for Debian systems. If you have apt-get on your Live System and don't have either dnf or yum then you don't have a Fedora Live DVD.

safulop
1st August 2017, 07:47 AM
This doesn't make sense as apt-get is not in Fedora at all. It is package management for Debian systems. If you have apt-get on your Live System and don't have either dnf or yum then you don't have a Fedora Live DVD.

Well, I already did chroot over to my installed system. So when I was calling for yum, dnf, and apt-get it was not using the Live system, it was using my installed system. I can assure you I have a Fedora Live USB, I am using it right now to try and get stuff off my old system before I erase it and start over.

amiga
1st August 2017, 07:51 PM
Well, I already did chroot over to my installed system. So when I was calling for yum, dnf, and apt-get it was not using the Live system, it was using my installed system.

So now you are claiming that your installed system is not Fedora but a Debian derivative as apt-get wouldn't exist in any Fedora installation.


I can assure you I have a Fedora Live USB, I am using it right now to try and get stuff off my old system before I erase it and start over.

So you don't like my questioning whether you have a Fedora Live USB or not but apparently your old installed system is not Fedora. If your installed system does not have either dnf or yum and does have apt-get, which doesn't work right but does exist then your old installed system is not Fedora.

In none of your previous posts you never mentioned that you have any installed system but Fedora.

Post #6 by safulop

I have no idea how the previous post could be applied to my situation, where I have a Fedora system which cannot be booted into nor mounted. At least, I have no idea how to mount it from running a Live USB.

Post #1 by safulop

Something somehow deleted my bootloader file, so now my Fedora boot process leads to shim MOK manager instead of booting up. I see that the grubx64 file is missing, although the cfg file is still present ?

What is the best way to reactivate Grub without changing the installation or reinstalling? I do have a Fedora 25 Live disk but I don't want to reinstall because that would erase everything right?

In all of your previous posts you only talked about having an installed Fedora system. Now you are claiming that your installed system does not have either dnf or yum and does have apt-get meaning it can't be Fedora.

safulop
1st August 2017, 08:37 PM
I assure you my installed system was also Fedora; however it had been modified by me so it had apt-get already. I don't know why it didn't have yum or dnf, that's what made me realize I had seriously broken it by a "remove" command I did earlier using apt-get. That is probably what caused the system to die and fail to boot in the first place. I didn't know how apt-get worked and when I did a "remove" command for a package it removed too many other things along with it and broke the system.

In any case I have now fixed the situation by installing Fedora 26, using custom installation where it only formatted the root and boot partitions, thus saving all my personal files and installing GRUB.

nsnbm
2nd August 2017, 12:30 AM
amiga wrote:


This doesn't make sense as apt-get is not in Fedora at all.

Actually, if you seek apt-get in rpmfind.net, it reveals the corresponding program for various fedoras including f25 and f26. It's in the package apt *.rpm and within it is the executable apt-get.

safulop
2nd August 2017, 09:32 AM
Some sources say that apt-get doesn't work in Fedora, or doesn't work correctly. I found this to be true, since it deleted half my system when I tried to remove one package.

antikythera
2nd August 2017, 09:37 AM
that wasn't a specific issue due to using apt-get as it can happen if you use any package manager dependent entirely on the package you are attempting to remove.

if apt-get didn't warn you of the other packages it would remove before you ran the transaction then clearly it needs some work.

dnf will warn you before running the transaction as long as you do not add the -y switch to the dnf command.

safulop
3rd August 2017, 09:56 PM
that wasn't a specific issue due to using apt-get as it can happen if you use any package manager dependent entirely on the package you are attempting to remove.

if apt-get didn't warn you of the other packages it would remove before you ran the transaction then clearly it needs some work.

dnf will warn you before running the transaction as long as you do not add the -y switch to the dnf command.

I did get a warning; I didn't read the other packages very closely but enough to see there were over 200 mentioned; then when I tried to cancel the operation I accidentally typed 'y' somehow and it did the operation.

Still it seemed strange to me that a command to remove python3-pip would also have to remove so much stuff that it left the system broken.