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?


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.

|improve this answer|||||
  • 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. – Peter Dec 22 '12 at 20:03
  • 4
    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. – Hannes R. Jul 31 '14 at 13:04
  • 2
    @HannesR. This worked for me, you should write a proper answer! – Håkon K. Olafsen Aug 15 '14 at 7:45

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"
|improve this answer|||||
  • 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. – cjstehno Dec 20 '15 at 15:55

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
|improve this answer|||||

During the installation process at the disk allocation step, there should be an option to select disks you want to have involved in the installation. Delete the USB drive from the list there.

Also, you could check if your BIOS uses a specific drive order to boot from. Set the Hard Drive above the USB drive and boot from the pen drive using the boot menu. (Usually invoked by pressing a certain key during the boot process like F11)

|improve this answer|||||
  • How do you delete the USB-drive from that list? – Håkon K. Olafsen Aug 15 '14 at 8:03

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.