Ask Your Question
0

Cannot reinstall GRUB2

asked 2014-02-27 18:39:06 -0500

Oscar Contreras gravatar image

Hello,

I have a Sony Vaio with Fedora 19 and GRUB2. I also have Windows 8 and boot it once in a while. Recently I installed firmmware updates using Vaio Update under Windows.

After that I am no longer able to boot Linux, it goes directly to Windows.

I have Fedora 19 installation DVD from which linux rescue cannot be started. So in order to reinstall GRUB2 I boot the Fedora 19 installation DVD and then I setup the environment manually with the following commands:

mkdir /mnt/sysimage

mount -t ext4 /dev/mapper/fedora-root /mnt/sysimage

mount -t ext4 /dev/sda7 /mnt/sysimage/boot

mount --bind /dev /mnt/sysimage/dev

mount --bind /proc /mnt/sysimage/proc

mount --bind /sys /mnt/sysimage/sys

chroot /mnt/sysimage

/sbin/grub2-install /dev/sda

... and the installation ends without errors reported.

However when I reboot it goes again directly to Windows. It looks like if the Vaio restores the MBR as it takes longer for the computer to ask for boot password, with

a lot of previous disk activity.

Any ideas?

Thanks in advance.

edit retag flag offensive close merge delete

Comments

Is your system using UEFI? my guess would be yes since you have windows 8. Did you install Fedora in UEFI mode?

How do you boot the F19 DVD? I assume you can select which device to boot by pressing one of the Function keys (e.g. F12) when you boot the machine; do you see the Fedora installation there too?

Ahmad Samir gravatar imageAhmad Samir ( 2014-02-28 01:05:32 -0500 )edit

Yes, my system is using UEFI. Yes, I installed Fedora in UEFI mode. As a clarification, I have been using Fedora during months with no problem. At boot time, a Grub menu appeared allowing to select several Fedora kernels or the windows system for booting. The problem is that after updating Vaio firmware this menu no longer appears and Windows is directly booted. Even after reinstalling grub it seems that Vaio detects it and reinstalls his own MBR :-(

I boot F19 DVD by pressing the "ASSIST" key and selecting the option of booting from removable media. After booting the DVD I can see all Fedora partitions (root, boot, home, swap...). All of them apparently are ok, with all files...

Oscar Contreras gravatar imageOscar Contreras ( 2014-02-28 03:54:38 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-02-28 06:57:04 -0500

Ahmad Samir gravatar image

updated 2014-02-28 23:45:01 -0500

In UEFI, with GPT-labelled HDD there's no MBR so you can't fix it by reinstalling grub.

It could be that when the firmware was updated it removed the Fedora entry from the UEFI boot manager. Follow the same steps you used before to chroot, but before you execute chroot, mount the EFI partition at /mnt/sysimage/boot/efi. The EFI partition type is vfat (fat32 or fat16).

Examine the UEFI boot entries:

efibootmgr -v

there should be one for the Fedora installation on the HDD.

If there isn't, you can add one:

efibootmgr -c -d /dev/sda -p 1 -l '\EFI\fedora\shim.efi' -L Fedora

change the number in '-p 1' depending on the EFI partition number on the HDD, ('-p 1' if it's /dev/sda1, '-p 2' if it's /dev/sda2 ... etc).

EDIT: fixed the instructions about mounting the EFI partition, it should be mounted regularly, i.e. not with 'mount --bind'.

edit flag offensive delete link more

Comments

Thanks a lot, it worked!!! I just had to remove the --bind option from the EFI partition mount.

Sorry for being so dumb about UEFI booting process. I have learned a lot.

Oscar Contreras gravatar imageOscar Contreras ( 2014-02-28 20:04:30 -0500 )edit

You're right, the EFI partition mustn't be mounted with --bind, sorry about that error :/

Glad it's fixed.

FWIW, Adam Williamson (from the RedHat QA team) has written an extensive - and rather very long - article about UEFI , I have yet to find the time/stamina to read it all but it does look quite good.

Ahmad Samir gravatar imageAhmad Samir ( 2014-02-28 23:43:00 -0500 )edit

Thanks for the info. The article looks very interesting. I will read it.

Oscar Contreras gravatar imageOscar Contreras ( 2014-03-01 06:02:42 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-02-27 18:39:06 -0500

Seen: 862 times

Last updated: Feb 28 '14