Saturday, March 19, 2016

boot - Missing Operating System on USB drive


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


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!


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...