12.09.2019
Posted by 

Grub2 is a very powerful boot loader, developed by GNU. You can easily install Grub2 from Windows with just a few commands.

Grub2 supports both UEFI and Legacy BIOS modes. It is capable of booting most Windows, Linux, BSD and macOS operating systems. For more information on Grub2, please refer to the GNU GRUB Manual.

This includes copying GRUB images into the target directory (gener‐ ally /boot/grub), and on some platforms may also include installing GRUB onto a boot sector. OPTIONS -modules=MODULES Pre-load modules specified by MODULES.install-modules=MODULES Install only MODULES and their dependencies. If your Windows is installed in Bios mode, it is recommended to install your Ubuntu in Bios mode but if it's installed in EFI, so do the same with Ubuntu. To Check if your Windows is installed in EFI, use the combination windows + r then enter the command msinfo32 as below.

Grub2 also supports installation on many operating systems such as Ubuntu, Linux distributions and including Windows. This article will guide you how to install Grub2 from Windows. AIO Boot also uses Grub2, which saves you a lot of time.

Download

You can download Grub2 source code for all platforms here. For Windows, you should download the latest version of Grub2 here. It supports Windows 7, 8, 8.1 and Windows 10, not yet tested on Windows XP.

Once downloaded, you need to extract the downloaded file above. Here I will extract the grub-2.02-for-windows directory to the C: drive.

Install Grub2

We will now start installing Grub2. You can install Grub2 for USB, or HDD, or even a memory card.

  1. Run Command Prompt under Admin and go to the grub-2.02-for-windows directory that you extracted above.
  2. Check the number of hard disk you will install, be it USB or HDD. Run diskmgmt.msc to open Disk Management.
  3. Grub2 for Windows supports installation and boot on three platforms: i386-pc, x86_64-efi and i386-efi. If you want to boot Grub2 in UEFI mode, you need to create a partition formatted as FAT32.
  4. Install Grub2 for BIOS (i386-pc):
    • Number 2 in the above command is the number of the hard disk that we checked in step 2.
    • G: is the drive of one of the partitions of the hard disk above.
  5. Install Grub2 for UEFI 64-bit (x86_64-efi):
  6. Install Grub2 for UEFI 32-bit (i386-efi):

    For UEFI, you need to specify a drive of the FAT32 partition at the –efi-directory parameter. If it does not support UEFI, Grub2 will report an error: grub-install.exe: error: F: doesn’t look like an EFI partition.

  7. Output results:
  8. If you want to change the path of the grub directory, change the value of the –boot-directory parameter. For example, if you want the grub directory located in YourName, use –boot-directory=G:YourName.
  9. You have now completed the installation of Grub2. Please restart your computer for testing.

Configuration

The configuration file for Grub2 is grub.cfg, which is stored in the grub directory. This file includes all Grub2 configurations, including interface, fonts and menus.

You can create this file for yourself. Or download my grub.cfg file here and copy it into the grub directory.

Examples

Here I will open the grub.cfg file to add two menus: Restart and Power Off.

Wish success!

Active2 years, 8 months ago

I am having trouble figuring out how to have grub installed on a floppy in a way that it automatically boots a modified Ubuntu 12.04 CD on startup. I will settle for knowing some commands at the grub promptif automation is asking for the impossible.

The CD is bootable, but the system this is made for doesn't have a BIOS option to boot from CD (or USB), it can only boot from floppy or hard drive.

Background:

This is a system located remotely, and I would like to have something where I can tell the owner if there are problems: insert floppy and CD and reboot. The modifications to the CDs are such that openssh-server is installed, my public ssh key in /root/.ssh/authorized_keys2, ssh is listening on an additional port number as those < 1024 are blocked by the local provider and the system retrieves a page on my server (so I can find the IP address to connect to for remote maintenance). The CD works fine when testing in a VirtualMachine. There is a keyboard and monitor and I can ask the owner to type in a few commands.

I first looked at using grub2 but there are many incorrect how-to about them and the command-line options for grub2 seem to have been changed a lot of times (--diet and --overlay, often mentioned, are no longer there).

There is a bug report about grub2 output not fitting on floppy and that was closed recently. So I build grub2 from the repository (version 2.0) including the required new version of xorriso. The result of

is a 4.4Mb Image, which of course does not fit on a floppy at all, so I dropped that as a viable path to explore.

Windows

I have tried a grub legacy on floppy (0.97), but cannot use find from the grub prompt to find anything on the CD, nor use something chainloader (hd1). The grub (0.9x) manual has nothing to say about booting an iso image.

I rather not install something on the hard drive and go the boot route FD -> HD -> CD as this whole setup is needed in the first place if the hard drive has problems.

hildred
4,9282 gold badges21 silver badges40 bronze badges
AnthonAnthon
63.8k18 gold badges116 silver badges182 bronze badges
Windows

3 Answers

An better alternative to all in one boot floppy is probably to use BCDL. The bootable CD loader automaticaly boots the first CDROM. The problem is that its CD driver is no longer up to date, so you need to upgrade VIDE-CDD.SYS on the floppy with e.g. XCDROM.SYS taken from here.

(Only tried with a virtual machine, not with a real FDD).

Grub2 Install Usb

ZeldaZelda

Have you looked at The All In One Boot Floppy? It can boot a CD with a few menu selections.

It using Smart Boot Manager underneath so you can look at that to make something without (or with less) interaction.

ZeldaZelda

For motherboards made prior to 2002, their BIOS's will neither see nor boot from CD. Between 2002 and 2005, the BIOS can at least see the CD. If you have the newer mobo, then you can get GRUB to boot the CD. An easy way is to put GRUB4DOS on a system DOS disk and edit the MENU.LST file to create a menu. If you have an older mobo, like mine, you will need to boot Linux from the floppy to access the CD. Some of the options are TOMSRTBT (aged but can fit in an oversized disk (1.7MB), or Basic Linux (2 floppies). The best solution, which requires work, is make your own kernel and initrd from a recent distro release with only the stuff you need. You may get them small enough to fit on a standard floppy.

DuaneDuane

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