Monday, May 6, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 12632  / 1 Year ago, tue, april 18, 2023, 12:03:43

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).


More From » grub2

 Answers
7

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.


[#39962] Tuesday, April 18, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
utilitere

Total Points: 394
Total Questions: 110
Total Answers: 114

Location: Solomon Islands
Member since Wed, Mar 29, 2023
1 Year ago
;