How can I use the installer to manually boot into a system without GRUB installed?

5,250

Don't use the Mac-specific installer. Use the normal (server, desktop) installer, install the system using all the defaults (except avoid LVM), and then reboot.

Boot off the USB installer again, but when you see the GRUB menu, press C to bring up the GRUB console.

Finding your installation's drive

At the GRUB console, do

grub> ls
(memdisk) (hd0) (hd0,msdos) (hd1) (hd2) (hd2,gpt3) (hd2,gpt2) (hd2,gpt1)

You may not get exactly the same results as this, but you'll have some options. You want to look for your new installation, not the installer/live system. I suggest finding a partition with your new user's home directory on it:

grub> ls (hd2,gpt2)/home
jason/

Keep trying this pattern until you find it.

Finding your installation's boot partition

If you know you installed everything to one partition, you're done — just use the result from the last step, the (hdX,gptY). If you didn't, or you're unsure, keep the hdX part, but go through all the gptY options looking for a /boot/grub directory:

grub> ls (hd2,gpt1)/boot/grub
error: file `/boot/grub' not found.

Nope, not that one.

grub> ls (hd2,gpt2)/boot/grub
unicode.pf2 [...] grub.cfg

Found it!

Now you want to set this as your root for further commands:

grub> set root=(hd2,gpt2)

Figuring out the boot command

I found that the only way to boot properly was to use the UUID of the drive (ie. no shortcuts with /dev/sdaX!) - so let's get that:

grub> ls -l (hd2,gpt2)
        Partition hd2,gpt2: Filesystem type ext* [...snip...] UUID e86c20b9-83e1-447d-a3be-d1ddaad6c4c6 - Partition start at [...]

Note the UUID string! Yours will be different. Now tell GRUB where Linux is:

grub> linux /boot/vmlinuz[...tab here!...].efi.signed root=UUID=<the UUID from above>

The GRUB console can do tab completion, so if you just type out the vmlinuz part and hit tab, then hit . and tab again... you won't have to type out the whole filename. But do make sure the .efi.signed bit is there! And yes, you will have to type out that whole UUID.

Now set the initrd (initial RAM disk):

grub> initrd /boot/initrd[...tab here!...]

Booting

Type:

grub> boot

You should find yourself booted into your installation!


I'm no GRUB wizard, so I'd welcome any tips on how to trim this down. Especially the UUID part, that is a little bit heinous.

Share:
5,250

Related videos on Youtube

detly
Author by

detly

Updated on September 18, 2022

Comments

  • detly
    detly over 1 year

    For the sake of experimentation, I am trying to document a minimal procedure for a pure EFI boot of 14.04 on a Mac Mini.

    This involves installing a base system (using the Mac-flavoured server install ISO) to the hard drive, but NOT installing GRUB to the MBR. GRUB is installed to the first partition of the hard drive, but until I manually set up the EFI boot partition, the system will be unbootable.

    Is there a way to use the bootloader on the USB installer to boot into the installed system manually? I have access to "advanced options" (ie. the bootloader command line) on the installer, but I don't know what bootloader it is, and so I can't find full documentation for it.

    • muru
      muru over 9 years
      The bootloader is probably SYSLINUX. So you could try the 64-bit Ubuntu Desktop version which boots via GRUB, and then use the GRUB shell to manually boot.
    • detly
      detly over 9 years
      @muru Thanks, that helps. It looks like there's a lot of extra options for the installer itself, but I suspect I need a lower-level SYSLINUX command, not an installer option.
    • detly
      detly over 9 years
      @muru - I found a non-Mac installer and used that. The whole thing works much better.
    • muru
      muru over 9 years
      Excellent. The mac versions of the image have are all legacy boot and so continue to use Syslinux, whereas the normal 64-bit versions support UEFI and use Grub. Its to do with some weirdness in the Mac's implementation of uefi.
    • detly
      detly over 9 years
      @muru - I think the "weirdness" you're referring to is that it insists on looking for an HFS+ partition, and having that "bless" utility. I'm hoping to write up a minimal procedure for this so that it can be fixed in the future.
  • muru
    muru over 9 years
    The kernel root parameter is supposed to support /dev/sdXY. Did you get kernel panic with that?
  • detly
    detly over 9 years
    @muru - No, I just ended up at a prompt that said (initramfs). I tried just about everything for that root param. When I'm actually booted, it's /dev/sda2 (that contains /boot/grub, the EFI partition is /dev/sda1). Since GRUB saw it as (hd2,gpt2), I also tried /dev/sd[abc]2. Only the root=UUID=... form worked (and that's what's in /boot/grub/grub.cfg).
  • Dan Roberts
    Dan Roberts about 8 years
    thank you, this was very helpful. I just installed ubuntu on a sony vaio and can just not get grub or similar options to function due to UEFI and whatever else is going on. I read descriptions of how to manually boot from grub console but didn't know what paths to use so your explanations really helped.