3

How can I use a USB flash drive to boot Linux from a partition on (another) hard drive?

I'm trying to install Linux on an encrypted partition on the hard drive (using LVM on LUKS).

Since /boot must be on a separate, unencrypted partition, I would like to store it on a USB flash drive.

My plan was to install GRUB (2) to the flash drive (/dev/sdb) and boot Linux from it's MBR, or if the drive was unplugged simply boot Windows from the hard drive's (/dev/sda) MBR.


I installed GRUB (2) to /dev/sdb, but when I tried to boot from the flash drive I got the following message:

Grub Loading

After a couple of seconds I got an additional message:

Read Error

For testing purposes, I tried to delete the contents of /boot, and I got the same message after booting again from the flash drive.


PARTITIONING DETAILS

/dev/sda (Hard Drive):

MBR: Windows Bootloader
/dev/sda1 - Windows System Partition
/dev/sda2 - Windows Boot Partition
/dev/sda3 - Windows Data Partition
/dev/sda4 - Linux partition

/dev/sdb (USB Flash Drive):

MBR: GRUB
/dev/sdb1 - Linux /boot Partition

GRUB DETAILS

/etc/default/grub:

GRUB_CMDLINE_LINUX="cryptdevice=/dev/disk/by-uuid/$SDA4_UUID:vg root=/dev/mapper/vg-root resume=/dev/mapper/vg-swap cryptkey=/dev/disk/by-uuid/$SDB1_UUID:ext2:/key"
..
GRUB_DISABLE_LINUX_UUID=true

Installation command

grub-install --target=i386-pc --recheck /dev/sdb

I'm using Arch Linux.

2
  • Did you include the USB hook in your mkinitcpio.conf before generating your intrd?
    – jasonwryan
    Commented Nov 2, 2012 at 21:57
  • Yes I did. As well as all other necessary hooks (usb, encrypt, lvm2, ...).
    – Mark Will
    Commented Nov 2, 2012 at 22:12

2 Answers 2

1

Have you tried

grub-install --target=i386-pc --recheck /dev/sdb1

Note the /dev/sdb1 which appears to be your USB device.

MBR: GRUB
/dev/sdb1 - Linux /boot Partition

Maybe try this :

title Start Ubuntu from USB DISK (PC)
root (cd)
kernel /boot/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper noprompt cdrom-detect/try-usb=true persistent
initrd /boot/initrd.lz
boot
1
  • Getting the following messages: warning: File system 'ext2' doesn't support embedding [...] Embedding is not possible [...]. --force does not help either - error: blocklists are invalid.
    – Mark Will
    Commented Nov 2, 2012 at 22:15
0

Two things: could you wipe the usb key first? I'm getting the impression a laconic "read error" message comes from older versions of grub.

Have you checked the contents of your grub.cfg? GRUB_DISABLE_UUID_LINUX may not do what you want where there are multiple drives (it will pass a device node name). I would rerun update-grub with that line commented out.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .