Repair Fedora GRUB after grub2-mkconfig gone wrong
2
votes
1
answer
1718
views
I was trying to enable fractional scaling in Fedora 39 using ChatGPT and he recommended the following:
# NVIDIA's proprietary driver requires DRM KMS to be disabled for Wayland to work.
# Edit the file /etc/default/grub and ensure the parameter nvidia-drm.modeset=1 is not set.
# If it is, change it to nvidia-drm.modeset=0 or remove it. Then update the grub configuration with:
sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
I did so and ran the command, only to find my GRUB Menu only showing me the Windows Boot Manager. I can boot into Windows without problems, but now GRUB cannot find Fedora.
**Solution I am trying**
I created a USB bootable drive with Fedora and, after doing a quick Google search (and more ChatGPT, besides being the culprit), I stumbled upon the following plausible solution (with my
/dev
partitions already inputted):
# Mount the root filesystem
sudo mount /dev/nvme0n1p7 /mnt/root
# Mount the EFI partition
sudo mount /dev/nvme0n1p6 /mnt/root/boot/efi
# Bind-mount the virtual filesystems
for dir in /dev /proc /sys /run; do
sudo mount --bind $dir /mnt/root$dir
done
With that /mnt
set up, I run sudo chroot /mnt
, which worked as intented. I edited my /etc/default/grub
file back to how it originally was, and then I tried to re-generate my grub.cfg
file again with the command: grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
. Nevertheless, I keep getting the following error: /usr/sbin/grub2-probe: error: cannot find a device for / (is /dev mounted?).
. I have tried several combinations of the mounting procedure without success, such as this one:
sudo mount --bind /dev /mnt/root/dev
sudo mount --bind /dev/pts /mnt/root/dev/pts
sudo mount --bind /dev/shm /mnt/root/dev/shm
sudo mount --bind /dev/disk /mnt/root/dev/disk
sudo mount --bind /proc /mnt/root/proc
sudo mount --bind /sys /mnt/root/sys
sudo mount --bind /run /mnt/root/run
I also tried to follow this guide , which attempts to solve a similar problem, and there, the command works. I don't know what I could be doing wrong. Any help is appreciated!
**Output of lsblk**
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 845151 843104 411.7M EFI System
/dev/nvme0n1p2 845824 878591 32768 16M Microsoft reserved
/dev/nvme0n1p3 878592 783736831 782858240 373.3G Microsoft basic data
/dev/nvme0n1p4 994082816 997033681 2950866 1.4G Windows recovery environmen
/dev/nvme0n1p5 997033984 1000214527 3180544 1.5G Windows recovery environmen
/dev/nvme0n1p6 783736832 785833983 2097152 1G EFI System
/dev/nvme0n1p7 785833984 977303551 191469568 91.3G Linux filesystem
/dev/nvme0n1p8 977303552 994080767 16777216 8G Linux swap
Asked by Camilo Martínez M.
(141 rep)
Jan 15, 2024, 03:00 AM
Last activity: Jan 15, 2024, 10:47 PM
Last activity: Jan 15, 2024, 10:47 PM