3

What's the best way to install Ubuntu without putting GRUB on the MBR? I would think I can install to another partition (logical?), and then install GRUB on a bootable USB. When I want to boot to Ubuntu, just plug in the USB.

Would this work? How can I get the installer to do that?

Bob
  • 31

5 Answers5

3

To do this you will need to set up the partitions for Ubuntu manually. I suggest you do this with Gparted after selecting "try Ubuntu". You should then go ahead and install Ubuntu but when Ubiquity asks how you want to install select "something else" and it will take you to the advanced mode.

You then need to specify the partitions manually, and also tell it where to install grub. Down the bottom of the advanced partitioner, you will it has probably defaulted to installing grub on /dev/sda. Change this to the correct device name for the USB you want to install grub to.

After installation the machine will only boot into Ubuntu when you boot grub off the USB drive; the MBR on the hard drive will not be changed.

fabricator4
  • 8,375
  • This is exactly what I want to do. I will try it. I didn't know that ubiquity lets you choose the place to install grub. Perhaps I've missed it in the past. Thanks! – Bob Nov 30 '12 at 21:49
1
bain
  • 11,260
0

Why don't you want to install GRUB on the MBR? If you're installing it beside another operating system, GRUB will pick it up and still give you the option to boot into that other operating system. Alternatively, you can choose to not install GRUB at all, and let the other bootloader handle things, though this may take some configuration in the other OS. The easiest and most common thing to do in a dual-boot situation is to just let the new bootloader nuke the old one and replace it.

That said, what you want to do probably won't work, anyway. If you could do what you wanted, then you'd end up with two bootloaders trying to fight for control. That's part of why there's a Master Boot Record (MBR) to begin with.

If you want to install Ubuntu, without wiping out your other OS, that's entirely doable in a number of different ways:

  1. Repartition the drive the other OS is on.
  2. Install on a different internal drive.
  3. Install to a USB flash drive and use the "Boot to USB" option in your boot options at POST time to boot to it the same way you'd boot to a CD.
Shauna
  • 3,024
  • 1
    Why don't you want to install GRUB on the MBR? Because I've been burned by this before. Granted it was an older version of Ubuntu, and a much older version of Windows - but I've had to spend hours trying to repair the MBR b/c Win wouldn't boot - it can be really finicky with stuff like this. – Bob Nov 30 '12 at 21:52
  • 1
    Grub replaces the MBR, as you know, however there should be no problems booting either Windows or Ubuntu from Grub. There are sometimes problems where the OS proper does not find the Windows boot partition however this can normally be fixed by running 'sudo update-grub' afterwards. – fabricator4 Dec 01 '12 at 07:59
  • two bootloader fighting for control? I doubt that, I think that is why there is a boot priority listing in the BIOS... – jiggunjer Jan 27 '16 at 05:26
  • It's likely more prone to happen on older systems and likely involves an autodetect setting in BIOS, but I've seen it happen. If I had to guess, I'd say it's probably a sort of race condition, where which one loads depends on which device the BIOS picks up first, and it may not always be the same (or expected) order. – Shauna Jan 28 '16 at 01:47
0

I've never tried, but I think it would work indeed.

As for the safest way of doing this, I'd say you need to create a partition (with partition magic or any other program) for ubuntu, by shrinking the windows one.

0

One option is the following:

  • Boot from Ubuntu CD or USB and make a backup copy of your MBR:
    sudo dd if=/dev/sda of=/path/to/old_mbr bs=446 count=1
    (replace /dev/sda with the actal device for your hard disk and /path/to/old_mbr with a file name and path to which you want to save the existing MBR)
  • Install Ubuntu, including GRUB in the MBR.
  • Again, make a backup copy of your MBR, this time with GRUB installed: sudo dd if=/dev/sda of=/path/to/grub_mbr bs=446 count=1
    (replace /dev/sda with the actal device for your hard disk and /path/to/grub_mbr with a file name and path to which you want to save the GRU MBR)
  • Restore the old MBR:
    sudo dd if=/path/to/old_mbr of=/dev/sda bs=446 count=1
    (replace /dev/sda with the actal device for your hard disk and /path/to/old_mbr with the path where you saved the old MBR)
  • Keep the backup copy of your GRUB. You can:
    • place it on a USB stick (dd should do the trick) to run GRUB when the stick is inserted
    • if you are running Windows, place it on your C: drive and add the following entry to boot.ini:
      C:\grub_mbr="Ubuntu"
      (again, change the file name as necessary)
      This will bring up the Windows boot menu on start, with Ubuntu as a separate entry. Choosing Ubuntu will then bring up GRUB and let you boot into Ubuntu. (OK, some may not like the idea of going through the Windows boot loader to bring up Linux, but it works.)
user149408
  • 1,431
  • This sounds a bit dangerous, copying the first 448 bytes of the disk will include the first partition-table-entry and the first two bytes of the second partition-table-entry. Copying them back after installation might lead to a heavy problems if the first and/or second partition have been changed during installation. ALso this will put Grub in the MBR, so this does not answer the question. – mook765 May 17 '17 at 06:04
  • It does temporarily install GRUB in the MBR but restores the old MBR, thus the final result of not having GRUB in the MBR is ultimately reached. As for the size, according to https://en.wikipedia.org/wiki/Master_boot_record#Sector_layout the first partition table entry begins at 446 (not 448—I’ll correct that). Depeding on the boot sector format used, anything shorter than 446 may cripple the boot loader. That said, as some boot managers support additional partition table entries before byte 446, it’s probably a good idea to partition your drive first, and only then mess with the MBR. – user149408 May 18 '17 at 21:38