Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Installing Gentoo
  • Search

Booting from USB drive - grub question

Having problems with the Gentoo Handbook? If you're still working your way through it, or just need some info before you start your install, this is the place. All other questions go elsewhere.
Post Reply
Advanced search
16 posts • Page 1 of 1
Author
Message
epinefryna
n00b
n00b
Posts: 16
Joined: Thu Jan 27, 2005 4:57 pm

Booting from USB drive - grub question

  • Quote

Post by epinefryna » Sun Jul 03, 2005 10:52 am

Hi
I have read all what I found on this forum and other places... and I will probably be able to do all the things to make my gentoo USB HDD bootable as soon as you help me to set up grub on it :-)))

I installed gentoo from Knoppix following Handbook but just with one reiserfs partition on USB drive + swap.

my Knoppix /mnt dir looks like that:

Code: Select all

auto  
cdrom  
floppy  
gentoo     < here is my gentoo   uba1 is mounted here
sda1     < this is my internal hard drive with NTFS winshit on it - I dont want to touch it.
sda5     <  second NTFS  partition on internal hd
sdb1     <  one extra USB drive with NTFS partition
uba1     < second extra USB drive mounted as /mnt/gentoo    < here I've installed gentoo
uba2     <  linux swap for gentoo
uba3     < small spare partition FAT32
Now I'm ready to install grub and try to configure it to boot from USB drive.
when I run grub and enter

Code: Select all

grub> root (hd [TAB key]
 Possible disks are:  hd0 hd1
I guess these are my internal drive and the other USB which were maped as
/mnt/sda1 (grub drive hd0,0 )
/mnt/sdb1 (grub drive hd1,0 )
, am I right?
So what to do to force grub to see my gentoo USB drive so I can install grub on it?

thanks in advance
Bart
There is no spoon.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56088
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Sun Jul 03, 2005 11:24 am

epinefryna,

Grub can only 'see' drives that the BIOS 'sees'.
If the BIOS cannot detect a drive you cannot boot from it with anything becase the first step is always for the BIOS to load the Mast Boot Record.

Why is one of your USB drives called /dev/sdb and the other called /dev/uba ?
Are they both connected ?
The BIOS/GRUB will only see the connected drives.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
epinefryna
n00b
n00b
Posts: 16
Joined: Thu Jan 27, 2005 4:57 pm

  • Quote

Post by epinefryna » Sun Jul 03, 2005 11:49 am

I have two external USB drives connected, both I can see, mount partitions and so.
Let's call them Windows one and Gentoo one.
I found the difference in dmesg when I connect them

For Gentoo one:

Code: Select all

usb 1-8: new high speed USB device using ehci_hcd and address 7
ubb: device 7 capacity nsec 58605120 bsize 512
ubb: device 7 capacity nsec 58605120 bsize 512
 ubb: ubb1 ubb2 ubb3
When Knoppix boots it assignes uba when I disconnect and conncet again it's mapped as ubb - not a big deal.

And for Windows one:

Code: Select all

usb 1-6: new high speed USB device using ehci_hcd and address 8
scsi1 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 8
usb-storage: waiting for device to settle before scanning
  Vendor: TOSHIBA   Model: MK6022GAX         Rev: HB00
  Type:   Direct-Access                      ANSI SCSI revision: 00
SCSI device sdb: 117210240 512-byte hdwr sectors (60012 MB)
sdb: assuming drive cache: write through
SCSI device sdb: 117210240 512-byte hdwr sectors (60012 MB)
sdb: assuming drive cache: write through
 sdb: sdb1
Attached scsi disk sdb at scsi1, channel 0, id 0, lun 0
usb-storage: device scan complete
So for my understanding one is recognized as any USB device and second one is seen as hardrive and is mapped to scsi.
is there any software way to make the Gentoo disk to be seen as scsi?

And why one is seen as scsi and one as usb - good question :-)))
There is no spoon.
Top
epinefryna
n00b
n00b
Posts: 16
Joined: Thu Jan 27, 2005 4:57 pm

chroot /mnt/gentoo /bin/bash- SOLVED

  • Quote

Post by epinefryna » Sun Jul 03, 2005 12:09 pm

now I know.
it's the external enclosure (cheap CompUSA OEM product ;-) ) which causes this problem.
I swaped the harddrives and now it's recognized as scsi correct way.
I'm able to install grub on it.

thanks guys
Bart
There is no spoon.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56088
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Sun Jul 03, 2005 12:15 pm

epinefryna,

Your CompUSA OEM enclosure probably provides a VendorID and DeviceID that usb-storage does not recognise, so its not treated as a usb-storage device. It will need a entry in the usb-stroage unusual devices list to make it work.
There may be one on the web already. It will be in the form of a patch to the kernel. Google on the Product and DEvice IDs you get from lsusb for the device.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
zweigart
n00b
n00b
User avatar
Posts: 31
Joined: Fri Jun 24, 2005 9:31 am

  • Quote

Post by zweigart » Thu Jul 07, 2005 8:28 am

Hi !
Think I've the same kind of problem

I'm in big big trouble trying to install Gentoo on my external USB Hdisk:

First of all: my goal is to install Gentoo AND grub on the external drive, so that nothing is changed on my PC when the USB disk is not connected ( I have kids using Windows WP on this machine...)

So I installed Gentoo on the USB disk using the live CD.
- I followed all the steps as described in the gentoo install howto
/dev/sda1 as /boot partition (e2fs)
/dev/sda2 as swap
/dev/sda3 as / partition (e3fs)
- compiled my kernel (didn't use genkernel)
file systems are in the kernel and not as modules
- made grub-install on /dev/sda

Problems come when I try to boot, after having installed grub on /sda: (my grub is v0.94)

My grub.conf:

Code: Select all

default 0
	timeout 20
	vga 0x317  splash=verbose
	splashimage=(hd0,0)/grub/splash.xpm.gz

	title=Windows XP
	root (hd1,0)
	map (0x81) (0x80)
	map (0x80) (0x81)
	makeactive
	chainloader +1

	title=linux-gentoo
	root(hd0,0)
	kernel /kernel-2.6.11-gentoo-r3
	real_root /dev/sda3
Booting Windows: everything OK
Booting Linux: Error 27: Unrecognized command !!
I tried to edit my grub.conf via 'e' in grub and use the tab completion: I obtained
grub > real_root=/ [TAB]
possible files are lost+found boot .keep kernel-2.6.11-gentoo-r3 config-2.6.11-gentoo-r3 grub
?????????????? HELP !!!!!
Should I make a symlink /boot --> / ?

I have also tried to replace the line real_root by
root=(hd0,2)
The machine boots up but freezes on a kernel panic
VFS: cannot open root device "<NULL>" or unknown-block(8,3)
Please append a correct "root=" boot option
Kernel panic: not syncing: VFS: unablke to mount root fs on unknown-block(8,3)
And I'm frozen: cannot even stop my computer with the normal switch !! I have to switch off the alimentation !!!

What can I do please ?
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56088
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Thu Jul 07, 2005 9:30 am

zweigart,

Code: Select all

kernel /kernel-2.6.11-gentoo-r3
real_root /dev/sda3
Is not right on several counts.

The kernel line is a single line, no matter how long it needs to be so

Code: Select all

kernel /kernel-2.6.11-gentoo-r3 real_root /dev/sda3
would be an improvement.

The real_root statement is only used when you use an initrd file as a fake root to get you going
The root (hdX,Y) syntax is used to describe partitions to grub, not to the kernel, which uses the term root
to describe the top of its filesystem tree.

What you need is

Code: Select all

kernel /kernel-2.6.11-gentoo-r3 root=/dev/sda3
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
zweigart
n00b
n00b
User avatar
Posts: 31
Joined: Fri Jun 24, 2005 9:31 am

  • Quote

Post by zweigart » Thu Jul 07, 2005 4:19 pm

Sorry doesn't work.

I tried your code

Code: Select all

kernel /kernel-2.6.11-gentoo-r3 root=/dev/sda3
but once again it boots (OK uncompressing the kernel ...etc) and freezes with the same kind of message, but the "unknown block" is not the same !

Code: Select all

VFS: cannot open root device "<NULL>" or unknown-block(0,0)
		Please append a correct "root=" boot option
		Kernel panic: not syncing: VFS: unable to mount root fs on unknown-block(0,0)
whats is this ?*!!@### unknown-block ???
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56088
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Thu Jul 07, 2005 4:50 pm

zweigart,

A few daft questions are in order.

Booting from a USB drive requires either a kerenl patch or an initrd.
The problem is that the USB subsystem is not normally initalised until well after the root filesystem is mounted.
Thats a problem if the root filesystem is on the USB which is not yet set up.

Since you are not using the initrd approach, I assumed you had the kernel patch. Do you?
You would know because its not part of gentoo-sources, unless its been added recently.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
zweigart
n00b
n00b
User avatar
Posts: 31
Joined: Fri Jun 24, 2005 9:31 am

  • Quote

Post by zweigart » Thu Jul 07, 2005 6:00 pm

Found that : http://www.xenotime.net/linux/usb/usbboot-2422.patch but for a 2.4 kernel :-(

I hoped there could be an other solution

You're talking about a initrd approach: Can I boot from the USB using initrd ? with grub ( or LILO) on the USB ?
Cause I've first tried to install genkernel, and it didn't work .
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56088
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Thu Jul 07, 2005 6:20 pm

zweigart,

I believe you can boot grub from the USB with an initrd but you will need a special initrd and init script.
Your usb modules will need to be in the initrd and the script will need to load and initalise them before it attempts to do the real_root=.
Your box must support booting from USB too.

It can be done. If there is a HOWTO, it will be on The Linux Documentaion Project website.
There may even be a Gentoo HOWTO, the topic comes up every few months.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
epinefryna
n00b
n00b
Posts: 16
Joined: Thu Jan 27, 2005 4:57 pm

  • Quote

Post by epinefryna » Tue Jul 12, 2005 8:48 pm

kernel /boot/kernel-2.6.12-gentoo-r3 rootdelay=10 root=/dev/sda1

In my case rootdelay option solves everything.... USB boots with no other tricks.

On my USB drive I created just two partitions / and swap so I do not have a separate /boot partition so my kernel is on /boot/kernel-blabla-r3

with 2.6.12r3 works perfectly.

Reagrds
Bart
There is no spoon.
Top
zweigart
n00b
n00b
User avatar
Posts: 31
Joined: Fri Jun 24, 2005 9:31 am

  • Quote

Post by zweigart » Mon Jul 18, 2005 1:11 pm

Thanks for your help, but I tried root delay and it didn't work on my system. My grub is on my scsi's MBR

I guess it's not a grub problem for I installed Debian Sarge on sda , with grub on sda's MBR and it worked fine. My gentoo "grub.conf" was correct, I mean that I used with debian the same grub.conf (in debian: menu.lst) that I had tried with gentoo and it booted as I expected.

As jmbsvicetto said, there might be a solution modifying initrd. It takes me some time to learn howto do this, for I'm a nooby. I read several solutions for my usb problem: they all suggest to add a delay for detection (ex using a patch, or a pause in linuxrc) , and insert a "sfdisk -R /dev/sda" in the linuxrc. Might be a solution because I noticed that in several installers that /sda was not detected at first run (ex in Mandriva) but only after having Re-read the partition table. Dont know why.
So I tried to edit initrd ( via mount -o loop): I was able to read linuxrc, and modify it, but had problems when trying to add libs in the /lib directory. sfdisk needs some libs that are not in the initrd (lib.so.2, libc.so.6) Not enough space in the device !!.

todo:
compare debian's linuxrc and initrd with gentoo's
learn howto build a genuine initrd without mkinitrd, and insert those damn'd libs.
... Well, first i'm learning howto make a "fully customized" initrd.
It will take some time, but I guess one day it will work.

Thanks for your help
Top
jmbsvicetto
Bodhisattva
Bodhisattva
User avatar
Posts: 4735
Joined: Wed Apr 27, 2005 4:33 pm
Location: Angra do Heroísmo (PT)

  • Quote

Post by jmbsvicetto » Mon Jul 18, 2005 1:35 pm

zweigart wrote:As jmbsvicetto said, there might be a solution modifying initrd.
Hi. If I like getting credit for helping people out, I don't want to receive it for other's work. :wink: You should be quoting NeddySeagoon as it was him who told you about initrd!
Good luck to solve your problem.
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Top
zweigart
n00b
n00b
User avatar
Posts: 31
Joined: Fri Jun 24, 2005 9:31 am

  • Quote

Post by zweigart » Tue Jul 19, 2005 8:00 am

Oooops !
:oops::oops:

I apologize. Really sorry !

Thank you NeddySeagoon for your help.

I hope I'll be able to publish a working solution soon.

Thanks again.
Top
zweigart
n00b
n00b
User avatar
Posts: 31
Joined: Fri Jun 24, 2005 9:31 am

  • Quote

Post by zweigart » Thu Jul 28, 2005 8:41 am

Hello

Made a little trip in the wonderful world of initrd and initramfs. Unuseful (except for knowledge of course) ! Gentoo's initrd is OK. But the grub.conf in the install manual doesn't fit my config:
- gentoo on an external USB 2.0 HD
- grub on the MBR of the USB external drive
- genkernel with udev
sda1: /boot
sda5: swap
sda6: /
sda7: /mnt/windows

I could finally boot modifying grub.conf as follows:

Code: Select all

default 	0
timeout		20

splashimage=(hd0,0)/grub/splash.xpm.gz

title		Windows XP
root		(hd1,0)
map		(0x81) (0x80)
map		(0x80) (0x81)
makeactive
chainloader		+1

title		-----------------------ReBoot
reboot

title		Linux Gentoo 2.6.11-r3
root		(hd0,0)
kernel	/kernel-2.6.11-gentoo-r3 doscsi udev root_delay=15 root=/dev/ram0 init=/linuxrc ramdisk=8192   real_root=/dev/sda6
initrd		/initrd-2.6.11-gentoo-r3
savedefault
boot
Booting or not seems to be "root_delay sensitive" on my machine. Had to fix it > 10 sec !. Guess it's because of some hardware detection system ( ??)
Anyhow it works fine.
Thanks again for your help
Top
Post Reply

16 posts • Page 1 of 1

Return to “Installing Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic