Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just spend all day on trying to get my system to boot again, I'm getting a bit desperate...snif. The setup is as follows:

  • a debian installed in a luks encrypted usb hard disk with lvm volumes for system and swap
  • a usb stick with an ext partion for /boot, with grub installed to the mbr of this stick

Ok, so I was stupid enough not to have a backup of the usb stick and now I lost it.

So I set off recreating /boot on another stick with great difficulty. This is what I have so far booting from a live cd:

# mount everything so we can chroot
vgchange -a y
mount /dev/lvm/system /mnt

# the stick for /boot
mount /dev/sdf1 /mnt/boot
mount -o bind /dev     /mnt/dev
mount -o bind /dev/pts /mnt/dev/pts
mount -o bind /proc    /mnt/proc
mount -o bind /sys     /mnt/sys

chroot /mnt

# get some kernel files in boot
rm /initrd.img
dpkg -i /var/cache/apt/archives/linux-image3.xxxx.deb

apt-get purge   grub-pc
apt-get install grub-pc

# here is the first problem. The usb stick I formatted with palimpsest 
# (mbr) and created an ext2 primary partition on it. Grub complains that 
# 'your embedded area is exceptionally small, core.img won't fit in it..'

# start over:
fdisk /dev/sdf
o (reformat with dos partition table)
n (new partition)
1 (partition number 1)
2 (set the starting cylinder to 2 in order to have more space behind mbr)
+100MB (size)
w (write results

mkfs -t ext2 /dev/sdf1

# now grub installation works.

When I reboot, I do get grub, but drops to rescue mode with unknown filesystem

>insmod ext2
hd0 (have nothing but the usb stick on this machine)
>ls hd0
unknown filesystem
> ls (hd0,0/1/msdos1)
all give: no such partition   

I have been faffing around for hours now, trying on other machines, trying to change /boot/grub/device.map mainly with /dev/disk/by-id/xxx:0 and xxx:0-part1.

No avail, wherever I boot all disks are "unknown filesystem", and all attempts to check a partition give "no such partition" both on the usb stick and on other drives in the machines I test on.

The problem is that I don't find any details about the inner workings of grub. I don't even know if device.map is read on boot at all, or if that plays only by the time grub.cnf is being parsed (and thus /boot/grub has already been found). I have the impression that nothing is being read from my stick except the core.img right after the mbr, however I have no idea how core.img knows which partitions to boot from, is that hardcoded in on install? Is the device.map thus important to get right on running grub-install? I also don't know if the partition should be bootable, I suppose not since grub is installed to the drive, but I find little info about all these more detailed issues.

Any ideas to get this working are greatly appreciated.

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.