3

This question already has an answer here:

I'm trying to install the minimal Ubuntu installation on a USB drive (complete install, not a live boot). After installation, however, when I try to boot from the USB, I get "Missing operating system".

I think there might be a problem with grub, but I don't know how to fix it. I've done an install to an USB before which messed up the main grub file, so I don't want to do that.

This is the output of fdisk -l pertaining to the USB drive:

Disk /dev/sdc: 4027 MB, 4027580416 bytes
124 heads, 62 sectors/track, 1023 cylinders, total 7866368 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x73a571aa

Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     7616511     3807232   83  Linux
/dev/sdc2         7618558     7864319      122881    5  Extended
/dev/sdc5         7618560     7864319      122880   82  Linux swap / Solaris

Also, my boot partition may not be labeled as bootable, based on this output. Please help!

Update

I followed Terrance's suggestion, so /dev/sdc1 is now labeled as a boot partition. However, the drive still won't boot.

I am not asking for how to install Ubuntu to a USB drive, I'm asking for help fixing a USB which I've already installed Ubuntu to.

Update

Terrance's updated answer solved it for me. Just a note, to get it working on my USB I had to create a /boot/extlinux/syslinux.cfg file containing:

PROMPT 0
TIMEOUT 50
DEFAULT arch

LABEL arch
        LINUX ../vmlinuz-4.4.0-45-generic
        APPEND root=UUID=[The USB UUID]
        INITRD ../initrd.img-4.4.0-45-generic

marked as duplicate by David Foerster, Fabby, Eric Carvalho, WinEunuuchs2Unix, Zanna Nov 6 '16 at 23:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • How exactly are you trying to install Ubuntu? – David Foerster Nov 4 '16 at 22:50
  • 1
    On the contrary: you've installed Ubuntu without any boot files... Easier to restart the installation like above. – Fabby Nov 4 '16 at 23:12
  • In the installer I selected the grub installer. Performing an ls boot in the USB drive gives abi-4.4.0-45-generic initrd.img-4.4.0-45-generic config-4.4.0-45-generic System.map-4.4.0-45-generic grub vmlinuz-4.4.0-45-generic – jpyams Nov 4 '16 at 23:23
  • @jpyams I updated my answer a bit to hopefully help install the extlinux boot files as well. – Terrance Nov 4 '16 at 23:41
4

You can set the boot flag on the first partition of your USB drive by typing in the following from a terminal window:

sudo parted /dev/sdc set 1 boot on

Also try installing extlinux and the syslinux-common for putting the boot files on the USB drive. From the terminal, type in:

sudo apt install extlinux syslinux-common

After those are installed, have your USB drive in and type in:

sudo mkdir -p /mnt/USB/boot/extlinux
sudo extlinux --install /mnt/USB/boot/extlinux

or whatever the mount point is to your USB drive like /media/username/1001-BAAB/boot/extlinux

Then you should install the mbr code to the USB drive with the following command: Don't worry, this will not overwrite the USB drive.

dd if=/usr/lib/EXTLINUX/mbr.bin of=/dev/sdc bs=440 count=1

Make sure that /dev/sdc is your USB drive.

More info can be found here: http://shallowsky.com/linux/extlinux.html

From the manpage for extlinux:

NAME
       extlinux  -  install  the SYSLINUX bootloader on a ext2/ext3/ext4/btrfs
       filesystem

Hope this helps!

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