[SOLVED] Managed to bork my system. Messed up grub. What can I do?
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.
Distribution: Formerly Various Linux Distros, Now Fixed on Fedora 32
Posts: 189
Rep:
Managed to bork my system. Messed up grub. What can I do?
So I had a lovely Fedora 32 system running nicely on old hardware (Dell Dimension E520). For reasons I won't bore you with I wanted to try out Manjaro Linux, but didn't want to install it. I created a bootable USB and started it from that. The problem was that Manjaro doesn't seem to allow the creation of persistent storage on a USB.
So... My brilliant solution? I have a spare 32gb USB stick, I'll just install it on that. What could possibly go wrong?...
Well it installed OK. It even boots from the USB.
The problem is that now I can't boot my Fedora 32 system.
The Manjaro boot screen shows a Fedora 32 option, but selecting that just leads to hundreds of errors.
I can put a Fedora 32 (Server edition) DVD in the drive and go into the rescue option on that. It shows some errors, but does eventually get me to a command line.
The two links are garbled. I can't tell to which instructions you refer.
The general approach is: Boot from the installation disk, open the recovery menu. Launch a shell, chroot to /mnt/sysroot, use dnf/yum to reinstall grub.
Seems to me if you can boot Manjaro, you should be able to chroot from it. Before trying that, maybe better to mount the Fedora partition(s) to collect fdisk -l output and the fstab and grub.cfg from Fedora to post here. Fedora typically includes LVM, which can complicate the rescue process. Knowing what Fedora's installer did can help us help you. Something else that can help is to ensure the Fedora filesystems all have volume labels, which can be added with e2label or tune2fs if using EXTx filesystems. Mounting by label in a manual rescue environment can be orders of magnitude easier than using UUIDs, yet more accurate than device names that can differ when booted to USB.
If you know drive/partition is fedora/fedora boot partition is on
do something like this. For example if you have fedora boot partition on sda1, use this
Code:
grub>configfile (hd0,1)/grub2/grub.cfg
to get the fedora grub menu. Then boot into fedora and run
Code:
sudo grub2-install /dev/sda
To reinstall fedora grub bootloader.
To see what files are on the first drive/first partition do this
Code:
grub> ls (hd0,1)/
or change accordingly for other partitions.
Without knowing the number of drives you have and partition layout, unable to give concrete numbers just examples
Last edited by colorpurple21859; 06-08-2020 at 05:39 AM.
Distribution: Formerly Various Linux Distros, Now Fixed on Fedora 32
Posts: 189
Original Poster
Rep:
Quote:
Originally Posted by mrmazda
... Before trying that, maybe better to mount the Fedora partition(s) to collect fdisk -l output and the fstab and grub.cfg from Fedora to post here....
OK Apologies for asking a dumb question - but how do I mount the partitions?
I can see my /etc/fstab file, but fdisk gives the errors I describe above.
Too many unknowns so I would concur w/post 2 to get the bootinfoscript which will give a lot of detailed information to get help for you.
Also, could you try the commands suggested in post 6 and post that info here. To mount a partition you need to use or create a mount point which is simply a directory then use the mount command. Below is an example if the partition you want to mount is sdb1 so change accordingly (needs to be done w/root privileges:
Code:
mkdir /mnt/sdb1
mount /dev/sdb1 /mnt/sdb1
I'm not clear on what you actually did as your first post indicates you put a 'live' manjaro on a usb and then did a full install to a 32GB usb, correct?
Distribution: Formerly Various Linux Distros, Now Fixed on Fedora 32
Posts: 189
Original Poster
Rep:
Quote:
Originally Posted by yancek
I'm not clear on what you actually did as your first post indicates you put a 'live' manjaro on a usb and then did a full install to a 32GB usb, correct?
Yes. That is exactly right. I had a "live" version of Manjaro on a 4gb USB stick. I booted into that and then tried to do a full install onto a different 32gb USB stick. I naively thought that my Fedora installation would not be would involved at all - it would just use the metal and plastic of the PC... You live and learn (or don't in my case)...
Even an expert at the helm directly would find this hardly worth the effort to "repair". With old PCs it's common that including USB at boot time causes device enumeration to differ from when only HD or HD and CD/DVD are present. Here, with USB present, the HD can be shoved out of order by the USB multi-reader, which on the repair boot reserved drives sdd, sde, sdf & sdg. By disconnecting the multi-reader before booting, and booting repair from CD/DVD with no USB devices present, a different scenario is certain. Doing so might make another run with a boot repair CD or DVD produce a report that could result in an easier job of repair.
The report shows the 320GB Hitachi HD still has a partition sdb10 with a Fedora 20 installation to further confuse. Partition rearranging on the 320GB Hitachi occurred when Fedora 25 and/or 32 was installed, so the partitions on it are out of order. There is free space at start of Hitachi where a Fedora 20 or 25 partition surely lived.
The repair suggested by the report, if successful would resurrect the Fedora 20 installation. I don't see that as a possibility, as the Fedora 25 and/or 32 installation rearranged the device names, and probably reused one or more partitions from the Fedora 20 installation.
IMO it will be far easier to use the Fedora DVD to perform a clean install on the HD, wiping it completely. Then if you wish to install Manjaro on USB, disconnect the HD first. Better to pre-partition the 320GB Hitachi HD for both Fedora and Manjaro, and install both there, but only use CD/DVD to install from, not USB. Alternatively, repartition the 500GB Seagate to host one of the operating systems. In either case, switch the Seagate with the Hitachi physically (via cable and/or jumpers) so that the Hitachi is enumerated before the Seagate during a normal boot.
Distribution: Formerly Various Linux Distros, Now Fixed on Fedora 32
Posts: 189
Original Poster
Rep:
Quote:
Originally Posted by mrmazda
...IMO it will be far easier to use the Fedora DVD to perform a clean install on the HD, wiping it completely....
Sigh... Yes I was afraid of that.
My approach until relatively recently, was to have two partitions for Fedora OSs with a separate /home partition. As a new release came out I would do a clean install over the last-but-one release (keeping the most recent previous release in the other other partition, which would enable me to access configuration settings etc. and speed up the process of getting back to how things were). I would then alternate new releases between these two partitions. Once Fedora introduced the complete upgrade system however (and it seemed relatively reliable) I simply allowed it to upgrade to the new version as it became available. This is why I still have a partition with F20 on it lying around. Ironically, only the other day I thought about wiping that and reclaiming the space... Like many things - I never got around to it...
The DVD I have is of F32 Server Edition (which I put on a different machine). So I am downloading a F32 Desktop .iso as we speak and I will do a complete install later, when I have time...
I will not dual boot with Manjaro (I simply wanted to try it - but be able to install software on it). I have had quite enough to deal with without adding extra complexity...
Hopefully I will get back to what I had in the not too distant future...
I would like to take this opportunity to thank all the people here who took the trouble and time to try to help me. I really appreciate the spirit of this community.
Thank you.
Last edited by ArthurDent; 06-08-2020 at 12:38 PM.
Distribution: Formerly Various Linux Distros, Now Fixed on Fedora 32
Posts: 189
Original Poster
Rep:
Well the saga continues...
I decided to bite the bullet and reinstall. I popped in a Fedora 32 Live CD and, while I was in there I did my best to tidy up the partitions using the Disks GUI utility. I removed the FAT partitions that I had used to share when I dual booted with Windows (a very long time ago) and combined them all into one large partition that I formatted as ext4 and rsync'd my /home (which was previously on an ext3 partition) data into it so that I would have a nice large area for /home. I deleted the old F20 partition and reformatted it, naming it as "Fedora32" ready for the new install, but I kept the "Fedora_25" partition (which actually houses my F32 OS - it has been incrementally upgraded from F25 to F32) because I want to be able to access any configuration settings I might need for the new install.
I then did an install into the partition that I had set aside for it (and allowed it to reformat the partition). I watched it complete (and noticed the message saying "installing bootloader" - and then rebooted...
Code:
error: no such device: b6657472-d09e-49de-8493-7aaade80b3ed.
error: unknown filesystem
Entering rescue mode...
grub rescue>
This is how I partitioned the drive:
Notice the free space at the beginning of the drive. I could not get rid of that! I deleted the partition that was originally next to it (the one that held the old Fedora 20 install) and it made one contiguous chunk of space. Good... So I then created a partition using all of that space and... hey presto... the space appeared again... What's happening there I wonder?
Anyway. Despite installing without any reported errors, I still can't boot.
Where do I go from here?
Thanks again for your help...
[Edit]: I just put the Manjaro USB into the drive. According to Fedora's Disks utility, its UUID is b6657472-d09e-49de-8493-7aaade80b3ed. So grub is still looking for that! Why did the the install not create its own boot point?
Last edited by ArthurDent; 06-10-2020 at 05:07 PM.
Reason: Add Infor about USB
IMO you didn't go far enough. Partitions out of logical order on disk is an obstacle, the degree to which different people will have differing opinions. Mine is I can't be of any material help if when I recommend wipe, wipe or a functional equivalent thereof does not occur. The same limitation results from a screenshot of a GUI partitioner rather than text output from fdisk -l, parted -l or equivalent. IME with nearly three decades of multibooting, bootloader(s) and the kernel need to be in sync at all times for multiboot to work reliably.
What I might have done if I was really ambitious would have been to devise a plan of both deleting, relocating, then creating, to ensure everything exists in logical order, with no unexpected freespace, after all was done.
One other thing that can help when trying to rescue is to ensure every filesystem has a label. In contrast to utilities and scripts, labels are infinitely easier for humans to work with than are UUIDs, particularly at a GRUB> prompt. If I can get to a GRUB> prompt, and labels are present, I can boot Linux with relative ease. With only UUIDs, I'd be crosseyed and exhausted before anything would boot. All of my native filesystems have labels, none of my fstabs use UUIDs, and none of my bootloader menus depend on UUIDs.
Distribution: Formerly Various Linux Distros, Now Fixed on Fedora 32
Posts: 189
Original Poster
Rep:
Quote:
Originally Posted by mrmazda
IMO you didn't go far enough.
In actual fact I agree with this. My trusty workhorse is a very old PC and it has been with me through many variations of OSs Dual Boots and goodness knows what else. Over the years I have tinkered around, added stuff, removed stuff created new partitions, reformatted others etc.etc. It was definitely time for a clear up.
So this is what I did. The only things I really cared about were my /home partition and (for reference) my existing F32 install. Fortunately there was *just* enough space left on the 500gb drive (which is my media / data storage) to rsync each of these filesystems there for temporary safekeeping.
I then swapped the SATA cables so that the 320gb drive became once again /dev/sda (There was a reason in the long-distant past that I swapped them to be the wrong way round, but I have absolutely no recollection of why I did it).
I then destroyed ALL the partitions on the 320gb drive (and re-formatted for good measure).
I then allowed the Fedora Live distro to install on the blank drive. Bearing in mind that I first set this drive up back in the days of Fedora Core 1 or 2 (or something), and I have messed around with it ever since, I was curious to see how a new version of Fedora would like to have its disks. I therefore let it do an "automatic" partitioning.
It installed and I now have a working, but virgin, Fedora 32 system (it boots!).
As you can tell from my previous posts I am no expert when it comes to filesystems and I have no idea how LVMs work. I was a little perturbed to see that it seems to have created a partition of only 1.1gb for itself and then /sda2 is a LVM of 297gb.
If I add more software, will the 1.1gb expand? If I copy back the ~32gb of my /home where will that go?
If this is not an optimal solution I an, at this stage, quite prepared to tear it down and start again with another install. Essentially I want to have what is considered to be best practice in terms of file structure for security and flexibility going forward. Is there a better configuration?
Code:
[mark@localhost ~]$ sudo fdisk -l
Disk /dev/sda: 298.9 GiB, 320072933376 bytes, 625142448 sectors
Disk model: Hitachi HDT72503
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x67919503
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 2099199 2097152 1G 83 Linux
/dev/sda2 2099200 625141759 623042560 297.1G 8e Linux LVM
Disk /dev/sdb: 465.78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: ST3500418AS
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000d6ab9
Device Boot Start End Sectors Size Id Type
/dev/sdb1 63 976768064 976768002 465.8G 83 Linux
Disk /dev/mapper/fedora_localhost--live-root: 70 GiB, 75161927680 bytes, 146800640 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/fedora_localhost--live-swap: 3.92 GiB, 4185915392 bytes, 8175616 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/fedora_localhost--live-home: 223.19 GiB, 239645753344 bytes, 468058112 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
I was a little perturbed to see that it seems to have created a partition of only 1.1gb for itself and then /sda2 is a LVM of 297gb.
If I add more software, will the 1.1gb expand? If I copy back the ~32gb of my /home where will that go?
sda1 is a boot partition. sda2 is everything else in LVM, a typical Fedora automatic configuration.
In the LV, you have three filesystems, 70GB OS, 4GB swap, and 223GB /home. There's no near future need to modify any of it. 70GB is more than plenty for adding more software. If you wish a future Fedora version to be added to the Hitachi, you could easily reduce the LV size of /home in real time to accommodate one, assuming your /home has sufficient freespace at that time.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.