How do I rebuild Grub/Boot/initramfs from a Live USB?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all.

I need some help.

Firstly:  Please forgive the formatting - I'm new to this medium and not sure what the accepted conventions are, the HyperKitty interface is ...very basic. Also please forgive the length, I just don't know how to make it shorter without losing potentially relevant detail. If I've asked this in the wrong place, by all means punt my backside in the direction of the right place.

I seem to have got myself in a bit of a mess and I’ve having trouble finding documentation that I can apply directly to my case . This is my first time on Linux so I’m not familiar with much of the terminology or background of these systems.

**Background**

I have an internal drive that used to successfully dual boot windows and a LUKS-encrypted F36 installation with BTRFS.

I also had some spare unpartitioned space, which I used to fully install some other linux distros (including another F36 installation) to troubleshoot other minor problems (a tri-boot, so to speak)

**What went wrong**

The new distros installed fine, but I discovered afterwards I could no longer find/boot into my original LUKS F36 installation. In my igornance, I tried deleting clearing the new installation partitions, and now, if I select the Fedora option thru my BIOS boot menu, I just get to a 'grub> ’ prompt.

I’ve tried a few commands there to boot manually but nothing worked and it wouldn’t even decrypt the root partition, worse still, somehow this process accidentally wiped the ORIGINAL LUKS F36 /boot partition too. I have no idea how.

**What I have now**

Partitioning follows:

nvme0n1p1: EFI partition (both win and DF36)
nvme0n1p2: MS Reserved
nvme0n1p3: Win10
nvme0n1p5: Original Fedora /boot (accidentally wiped)
nvme0n1p6: LUKS volume
nvme0n1p7: Former ‘third OS’ boot partition (wiped)
nvme0n1p8: Former ‘third OS’ root partition (also wiped)
nvme0n1p4: Win Recovery

**What I am trying to do**

Unbork everything, somehow?

I tried using these instructions in the official Fedora Docs, but they seem to be …wrong? Out of date? They didn’t work, I suspect due to LUKS/BTRFS. [ https://docs.fedoraproject.org/en-US/Fedora/23/html/Multiboot_Guide/common_operations_appendix.html]

The I found these...other Fedora Docs? Which seemed more up to date and looked like they had relevant bits, bit still seem directly applicable and didn't work. [https://docs.fedoraproject.org/en-US/quick-docs/bootloading-with-grub2/#restoring-bootloader-using-live-disk]

The only success I’ve had is with this guide:  https://fedoramagazine.org/os-chroot-101-covering-btrfs-subvolumes/ . 

I’ve managed to chroot (a very dumb word) thru a LiveUSB session, with the following commands:

>>cryptsetup luksOpen /dev/nvme0n1p6 fedora_crypt 
>>mount /dev/mapper/fedora_crypt /mnt/ -t btrfs -o subvol=root
>>mount /dev/mapper/fedora_crypt /mnt/home -t btrfs -o subvol=home
>>mount /dev/nvme0n1p5 /mnt/boot
>>mkdir /mnt/boot/efi
>>mount /dev/nvme0n1p1 /mnt/boot/efi
>>mount --bind /dev /mnt/dev
>>mount -t proc /proc /mnt/proc
>>mount -t sysfs /sys /mnt/sys
>>mount -t tmpfs tmpfs /mnt/run
>>mkdir -p /mnt/run/systemd/resolve/
>>nano /mnt/run/systemd/resolve/stub-resolv.conf (enter 'nameserver 1.1.1.1', save)
>>chroot /mnt


I can ping google, and browse the original home folder with ls, so it looks like ‘im in’ the original installation via chroot (which is still a dumb word)

What the problems are

>From there, I go back to the Fedora Docs and run

>>dnf reinstall grub2-efi grub2-efi-modules shim

That seems to work? Downloads and seems to install without any errors.

The next step though;

>>grub2-mkconfig -o /boot/grub2/grub.cfg

fails with the following:

>> /usr/sbin/grub2-probe: error: failed to get canonical path of ‘/dev/mapper/fedora_crypt’
I have no idea what that means.

On the side, I also sees that despite the grub reinstall, theres no vmlinuz or initramfs kernel files in the reconstructed /boot partition, so I tried running

>>dracut --regenerate-all

which results in

>>dracut: Can’t write to /boot/efi/[long-ass id code string]/[kernel version]: Directory /boot/efi/[long-ass id code string]/[kernel version] does not exist or is not accessible.

This is true - that folder isn’t in /boot/efi. But I dont remember ever seeing it there, and just to check I did a fresh test install on another drive and theres nothing like that there either.

So now I’m lost

What I’m looking for

I’m fairly sure the error messages I’m seeing are a result of oversights from my cobbled-together method and gneral lack of understanding. So if anyone knows what I missed and how/why, that’d help …but honestly I still really don’t know what’s going on and suspect I’m probably going to run into another problem just as quick

Really, I’m after some sort of clear, up to date walk-through with entry-level language/detail, on how exactly to rebuild from scratch the EFI/boot partitions for F36 with a LUKS encrypted root, using BTRFS. I know the installation itself is fine and should be recoverable, I just dont know how all these different bits fit togther, and none of the guides out there seem to explain/unify the different bits into a cohesive procedure for the unfamiliar.

Thanks very much.
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux