Chroot in to reinstall Grub2 reinstall, mnt/ is empty
First thing to do is to ensure you are able to use the Internet in your mode, as you might need it in case that your installed system doesn't contain grub. Typical way for wired connection is to list your interfaces:
ifconfig -a
choose one that connects you to the Internet (you should be able to tell, it's probably named eth0
or em0
) and run dclient
on it like this:
dhclient eth0&
Next thing to do is to mount your partition that contains your installed Fedora. Make a mount point for your partition and mount it there:
mkdir /mnt/fedora
mount /dev/mapper/fedora-root /mnt/fedora
If you have a boot partition (you'd know if you had), you should mount it, too. You can check if you need whether grep /boot /etc/fstab
gives you any output. If it gives something like /dev/sda1
as a first column, you should do:
mount /dev/sda1 /mnt/fedora/boot
Then bind some important directories - go to /mnt/fedora
first, to not overtype:
cd /mnt/fedora
mount -o bind /dev dev
mount -o bind /proc proc
mount -o bind /sys sys
mount -o bind /run /run
mount -t tmpfs tmpfs tmp
And finally chroot:
chroot /mnt/fedora
Now you should check your /boot
directory contents. Does it have some files named vmlinuz
, initrd
, grub
directory with grub.cfg
in it? If so, good, you can just install grub - assuming your drive you want it to install to being /dev/sda it would be:
grub-install /dev/sda
If it doesn't work, you'll have to install GRUB using yum install grub
(I don't know the exact package name, though). If you don't have grub.cfg file, then run:
grub-mkconfig -o /boot/grub/grub.cfg
You might install GRUB again for being sure.
Related videos on Youtube
M.Koptak
Updated on September 18, 2022Comments
-
M.Koptak over 1 year
I have a common problem: I installed Fedora 18 on my PC that has Windows on it. When I start the PC I don't get asked which system I want to boot, Windows is chosen always.
So I found out that I have to reinstall Grub2. So I booted from a Live CD and entered rescue mode (hit e in Grub2 and added
single
to the line that begins with "linux..").Then I should do
chroot /mnt/sysimage
, but there is no such directory. When I docd mnt
andls
, it is empty. So I have no idea how to change root. When I dofdisk -l
, the Fedora instalation is in partition/dev/mapper/fedora-root
.How can I correctly chroot into the Fedora installation and reinstall Grub2?
-
TNW about 11 yearsRescue mode cuts off some of the starting scripts, thus that might be the reason your
/mnt/sysimage
doesn't exist. Are you sure that/dev/mapper/fedora-root
is your installation? It rather sounds like the root of Live CD to me. -
M.Koptak about 11 yearsany idea what to add, to fix mounting /mnt/sysimage? it is, I remember selecting 40GB partition when I installed fedora into HD. When i do 'fdisk -l', 40GB partition is named /dev/mapper/fedora-root
-
TNW about 11 yearsI posted the answer assuming you're right about it. If you're stuck at some point, post it in comments.
-
-
M.Koptak about 11 yearsI have grub2.cfg in /boot directory, I can install it directly. I will try it in an hour, thanks for advice for now
-
TNW about 11 yearsYeah, the locations might be different between distributions.
-
TNW about 11 yearsOops, I forgot the mount point. Fixed.
-
M.Koptak about 11 yearswow, I did everything, but notebook is still booting windows automatically...
-
M.Koptak about 11 yearswhen i do grub2-mkconfig -o /boot/grub2/grub2.cfg I get following: Generating grub.cfg ... (sda4) can't find ext4 filesystem (sda4) can't find ext4 filesystem (sda4) can't find ext4 filesystem can't find a SQUASHFS superblock on sda4 (sda4) bogus member of reserved sectors (sda4) bogus member of reserved sectors found windows recovery enviroment (loader) on /dev/sda2 done and when I reboot, windows is booted automatically again..
-
M.Koptak about 11 yearswhen I do ls /boot before I reboot after finishing everything, there are: EFI grub2
-
M.Koptak about 11 yearsmaybe that's the problem, because when I go to bios, i can choose only LEGACY and UEFI at boot options, but fedora seems to be EFI, it is the problem?
-
TNW about 11 yearsIt could work with legacy setting, but I'm not sure for UEFI, I don't have much experience with it. Have you partitioned your drive as GPT one?
-
M.Koptak about 11 yearsnow I will try this guide: superuser.com/questions/549514/…