Ubuntu Server installed from USB puts GRUB on the USB drive instead of the hard disk

25,605

Solution 1

You can manually install GRUB onto a device if it was installed to the wrong place by issuing

sudo grub-install /dev/sdX

after booting and logging into your Ubuntu installation if that is even possible (as it seems from your question).

However if it's not possible to boot the OS you can use "Rescue a broken system" at the USB drive's startup menu to install GRUB. Just follow the instructions to set up keyboard and timezone and then mount your root partition. Then when asked choose to Execute a shell in /dev/sdXY. If you have created a separate partition which shall be mounted at /boot you have to mount it manually using that shell (else the installation of GRUB won't work as expected because it will not find your kernel image):

mount /boot

And then install GRUB using:

grub-install /dev/sdX

Then exit the shell (Ctrl+D) and choose reboot from the menu. Now everything should work as expected.

side note:
The Ubuntu Desktop Edition provides an advanced configuration option (which lets you set where GRUB is installed to) right before installing the OS. But I couldn't find an equivalent option in the Server Edition's installation process and it seems to always install GRUB to the first disk device. Or maybe I also just overlooked it.

Solution 2

Simplest way to do this on ubuntu server installer (works at least on 14.04)

  • At question "Do you want to install GRUB on master record", answer NO
  • you will be prompted where to install GRUB instead, type "/dev/sdb"

Solution 3

Had the same problem. Found a simple solution for Ubuntu Server 10.04 installation from USB pen.

  1. Start the installation from USB pen boot
  2. Select (country).archive.ubuntu.com
  3. After setting Clock remove USB pen
  4. Continue installation without USB
  5. GRUB gets installed automatically on the right disk
Share:
25,605

Related videos on Youtube

Admin
Author by

Admin

Updated on September 17, 2022

Comments

  • Admin
    Admin over 1 year

    I've just tried installing Ubuntu Server onto my new PC. The PC doesn't have a CD ROM drive, just USB, so I used a USB installation of Ubuntu Server.

    When I install it, it allocates dev/sda as being my USB pen, and dev/sdb as my hard drive.

    I set up my partitions on the hard drive including boot and swap partitions, yet at the end of the installation, Ubuntu installs GRUB on my USB pen, so the system won't boot unless I boot from my USB pen.

    How can install GRUB to the hard drive so I can remove my USB pen completely?

  • Peter
    Peter over 11 years
    Thank you Dirk. This fixed my problem. Would you also happen to know how to restore the original USB boot menu? When booting off the USB I no longer get the menu that presents options such as: Run off USB, Install to hard disk, Memory check, etc. I think I made the bootable USB from pendrivelinux so I suppose I can repeat that process. However, it would be nice to not have to repeat it just to restore the boot loader/menu.
  • Hannes R.
    Hannes R. almost 10 years
    Seems this is still an issue, with Ubuntu server 14.04. Simplest way around it is like this: At question: "Do you want to install GRUB on master record?" answer NO. You will then be prompted where to install GRUB instead. Answer "/dev/sdb" there.
  • Håkon K. Olafsen
    Håkon K. Olafsen almost 10 years
    @HannesR. This worked for me, you should write a proper answer!
  • Håkon K. Olafsen
    Håkon K. Olafsen almost 10 years
    How do you delete the USB-drive from that list?
  • cjstehno
    cjstehno over 8 years
    I tried this approach with server 15.10 and get a black screen on reboot. I am thinking that once I remove the USB drive the hard drive is /dev/sda again rather than /dev/sdb when the USB drive is plugged in... so now it is not where it thinks it should be. I am a novice at this stuff so I could completely off base. I will try @Bram's approach below.