Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have grub2 installed on a usb flash drive.
Along with a minimal installation of ubuntu server 10.04 LTS.

This was created using the debootstrap utility.

However, now I'm trying to make it boot and having trouble getting it to do so.

The thumb drive has a single ext2 primary partition on it and I've copied the bootloader onto it along with the kernel and kernel modules that I need and the grub.d scripts.

I thought since this is a thumb drive I should probably use uuid's instead of device names.

Anyway, when it tries to boot grub2 is throwing it back to the rescue prompt with this error.

error: no such device: 792f......aaee3

So I ran the ls command like so:

grub rescue> ls
(hd0) (hd0,msdos1)

That's confusing. is grub2 assuming the first partition is msdos and not ext2? could that be why it's not starting? I recall seeing somewhere that some bios's treat thumb drives as floppy drives and make the first partition msdos? is that what's going on here?

EDIT:

Interestingly, Ubuntu's make startup disk produced exactly the same error. However, I'm not 100% on this because when I ran it, it failed to install the bootloader. So I installed it manually with the command "grub-install /dev/sdb"

Update1:

I discovered that because I created the grub.cfg on another system that it had hd1 in all the entries. So I changed it to hd0.

Now I noticed that I can run these commands at the rescue prompt.

ls (hda,1)/

I decided to try

insmod normal normal

And sure enough it came up with the menu and I was able to select a menu item and boot linux.

Now, how do I fix the "no such device" error. The uuid of /dev/sda1 is definately what it is.

Update2:

Ok this is really weird. I pulled the flash drive out and plugged it back into my other computer. blkid is saying the following:

/dev/sdb1: LABEL="Transcend" UUID="597D-50B2" TYPE="vfat" 
/dev/sda5: UUID="0c81f24b-edeb-4be9-9859-074f3783e618" TYPE="swap" 

Firstly, /dev/sda1 is not showing up. Could that be something to do with it being on LVM?

Secondly, the UUID for sdb1 my trancend thumb drive is short? and it's different to what it was earlier. How did that happen? Are UUID's generated once when the filesystem is created or are they re-generated sometimes by some utilities that I may have run?

Update3: The UUID changed back to normal once I unmounted the drive and remounted it. Maybe that's a bug in Kubuntu 11.10 (my desktop machine).

share|improve this question
    
The msdos1 in grub's notation means it's the first partition of an old MSDOS-like partition table (as opposed to a GPT). I can't answer your real question, though. –  elmicha Mar 7 '12 at 20:21

2 Answers 2

up vote 2 down vote accepted

Fixed it.

In case anyone is wondering. This is what I did to get it operating.

Thumb drive appears as /dev/sdb

Run these commands

sudo mount /dev/sdb1 /mnt
for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt/$i;  done
sudo chroot /mnt
grub-install /dev/sdb
update-grub

Then edit /boot/grub/grub.cfg Changed all lines that say (hd1,1) to (hd0,1)

Then run...

exit
for i in /dev/pts /dev /proc /sys; do sudo umount /mnt/$i ; done

Next.

  1. List item
  2. Totally power down the server.
  3. Pull the power cords out. Wait 10s.
  4. Plug power back in.
  5. Insert Thumb drive and power on.
  6. Linux now boots fully from the thumb drive.

It seems that there were two problems. They were to do with having the wrong device referenced in grub.cfg (i.e. hd1 should be hd0).

Secondly, a bug in the server bios. It kept referring to a uuid for a filesystem on a different thumb drive that I'd be earlier playing with. Warm reboot seemed to keep that uuid in there. A cold boot fixed it.

share|improve this answer
    
Thanks dude this helped me out. I don't think I would have figured it out –  acidzombie24 Aug 11 '13 at 23:26

Similar error, my fault was that after I created the filesystem, I did not reread the partition table again by the kernel.

Solution reboot/reread the partition table and do:

generate the config again

grub-mkconfig > /boot/grub/grub.cfg

reinstall with new config

grub-install
share|improve this answer

Your Answer

 
discard

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

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