0

Good morning, I want grub to be totally independent of windows and linux mint partitions. I have already a installation of grub that work in /boot but it is in the partition of linux mint. So I followed different links and here is what I have done:

#first I mount my ext2 partition which is on sdb partition 4
sudo mount  -o rw /dev/sdb4 /mnt
#then I install grub in my partition
sudo grub-install --root-directory=/mnt /dev/sdb
sudo chmod 777 -R /mnt
#then I configure grub to have the OS list
sudo grub-mkconfig -o /mnt/boot/grub/grub.cfg
grub
# this part is supposed to make my new grub work.
root (hd1,3) # 3 is 4 - 1
setup (hd1) # 1 is 2 for sdb - 1
quit
sudo update-grub
reboot

to be sure which grub is used I have modified grub.cfg of /root So I restart and it is again the old grub which is used, which cmd is missing ? I also put gulp flag or boot flag with legacy boot with gparted but the partition still don’t appear in bios.

The following text is my motivation, it is not part of the problem description and you can jump this part. My goal is to have an ext2 or better fat32 partition because with some software is it possible to access ext2 partition from windows and this will allow me to create a script to automatically restart on linux from windows by modifying grub. I also want to access linux physical partition from windows with virtualbox (It already works in the other way), I have already succeed but I have to use an iso of grub that redetect each time which OSs I have on my system. And I think if I understand how to make grub totally independent it will solve my problem to use it in virtualbox.

Thank you

1

Since GRUB starts very early in the boot process, there is usually something simple that is wrong, however it can be difficult to determine what. Here are my suggestions:

  1. Usually the BIOS boots from the first hard drive and the first hard drive is usually called sda. What is your sda? Maybe grub-installing to sdb is having no effect because the BIOS is actually booting from sda?
  2. Older BIOSes can have trouble reading beyond a certain point on a hard disk. If your GRUB partition is towards the end of your disk this could be invisible to the BIOS.
  3. Does your system have UEFI? This boots quite differently. If you have UEFI you either need to work with it, or put your BIOS into "Legacy boot" mode where it will behave like a non-UEFI BIOS.
2
  • Thanks for your answer. The pc is new and it have EUFI, there is almost no option, I can't disable secure boot (it is in grey) and there is no legacy mode menu. I have resized my disk to let storage at the begining (it has taken a very long time with gparted 1h30) . I tested to modify in efi the grub.cfg file of ubuntu replacing sdb5 by sdb. when I have restarted ubuntu entry was disappeared and I had to reinstall grub from usb key. sdb is the ssd with windows and linux and sda is just a data disk. – bormat Jan 22 '18 at 23:42
  • I will try tomorrow to install on the new partition but I think it works only for BIOS not EUFI ? Since I have reinstalled grub I have to use the option --efi-directory= after having mount efi. It is no more automatic. efi is on sdb1. – bormat Jan 22 '18 at 23:42
0

I don't exactly know what was the problem but this is a working solution to have a partition containing grub.cfg accessible from windows and linux.

  • create a fat32 partition with windows and give a letter to the partition, I had problems with gparted (no need to put the partition at the start). Then restart on linux, the new partition is sdb8 for me.

first backup /boot/grub/grub.cfg before to launch these commands

sudo mkdir -p /media/grub2 /media/efi
sudo mount /dev/sdb8 /media/grub2
sudo mkdir -p /media/efi
sudo mount /dev/sdb1 /media/efi
sudo grub-install --no-floppy --boot-directory=/media/grub2/boot --efi-directory=/media/efi /dev/sdb

Then restore the backup of grub.cfg in /media/grub2/boot/grub/grub.cfg Then modify boot order (F2 on startup) to put the new entry first. Now it is supposed to works. I have a fat32 partition containing grub.cfg that I can edit on both windows and linux.

I think it is the use of boot-directory instead of root-directory and the fact I put file in /media instead of /mnt, I have try without --no-floopy it works too. I don't do grub-mkconfig because it creates non bootable entry and after I have to use boot-repair with a live usb.

I tried tried also:

  • efibootmgr : Is is a command to add entry in EFI but for me each modification was disapearing on reboot, even boot order

Maybe an other way to do it is the use of grub-mkstandalone

I installed too rEFInd, clover and OSX siera maybe it has changed my EFI in a way that works better.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.