Skip to contentSkip to conversation

Can't mount USB partition as root

DISCUSSION Karel Kulhavý 6 participants 12 messages Dec 29, 2003 – Dec 30, 2003

lore
Share & tools
lore
#0 lore raw

Hello

I tried to boot Linux 2.6.0 kernel with option root=/dev/sda1 using Grub. The kernel otherwise works, mounts the sda1 partition (XFS) OK. When I boot the kernel with root=/dev/sda1 instead of root=/dev/hda4, I get "can't mount root VFS, kernel panic" or something like that.

Is it possible to boot kernel with root from /dev/sda1 (USB)? partition table: whole /dev/sda is one partition (sda1), type 83 (Linux). Tried also switching on and off hotplugging in kernel and it didn't help.

Cl<

#1 lore raw
Quoted 3 lines · On Dec-29 2003, Mon, 17:38 +0100 Karel Kulhavý <[email protected]> wrote:

Is it possible to boot kernel with root from /dev/sda1 (USB)? partition table: whole /dev/sda is one partition (sda1), type 83 (Linux). Tried also switching on and off hotplugging in kernel and it didn't help.

Well, is the device detected and the partition table scanned before the root mount is attempted?

I believe this should work given you've compiled in all the necessary code. Please capture the dmesg using serial console/netconsole/whatever and post it along with your .config.

Signature · 1 line
Tomas Szepe <[email protected]>
#2 lore raw
Quoted 9 lines · Tomas Szepe
Quoted 3 lines · On Dec-29 2003, Mon, 17:38 +0100 Karel Kulhavý <[email protected]> wrote:

Is it possible to boot kernel with root from /dev/sda1 (USB)? partition table: whole /dev/sda is one partition (sda1), type 83 (Linux). Tried also switching on and off hotplugging in kernel and it didn't help.

Well, is the device detected and the partition table scanned before the root mount is attempted?

The messages jump around fast and there is no possibility to scroll back once the kernel stops, but I am convinced that nothing is said about detecting the device.

However, if booting the kernel "normally", the device gets detected (later).

How do I use the console? Is it something like nullmodem cable console in Windows NT? I have given away my nullmodem cable to a friend for purpose of debugging NT kernel so what possibilities remain?

Cl<

#3 lore raw
Quoted 4 lines · On Dec-29 2003, Mon, 18:31 +0100 Karel Kulhavý <[email protected]> wrote:
Quoted 4 lines
Quoted 3 lines

Is it possible to boot kernel with root from /dev/sda1 (USB)? partition table: whole /dev/sda is one partition (sda1), type 83 (Linux). Tried also switching on and off hotplugging in kernel and it didn't help.

Quoted 8 lines
Quoted 2 lines

Well, is the device detected and the partition table scanned before the root mount is attempted?

The messages jump around fast and there is no possibility to scroll back once the kernel stops, but I am convinced that nothing is said about detecting the device.

However, if booting the kernel "normally", the device gets detected (later).

Sounds like an initrd to me. Are you using one?

Quoted 3 lines

How do I use the console? Is it something like nullmodem cable console in Windows NT? I have given away my nullmodem cable to a friend for purpose of debugging NT kernel so what possibilities remain?

Google around for "netconsole" or use 2.6.0-mm2, which has it included.

Signature · 1 line
Tomas Szepe <[email protected]>
#4 lore raw
In reply to Tomas Szepe
Quoted 10 lines
Quoted 3 lines

Is it possible to boot kernel with root from /dev/sda1 (USB)? partition table: whole /dev/sda is one partition (sda1), type 83 (Linux). Tried also switching on and off hotplugging in kernel and it didn't help.

Well, is the device detected and the partition table scanned before the root mount is attempted?

I believe this should work given you've compiled in all the necessary code. Please capture the dmesg using serial console/netconsole/whatever and post it along with your .config.

I did this with 2.4 a few months back. Basically all I did was add the same delay before mounting root as the kernel does with mounting a root floppy. Problem is the kernel is too fast for the usb code to find the disk.

I'v been wanting to ask this question. How can I make the kernel "sleep" for say 5 seconds (or pause or something, whatever is required to delay execution) to wait for the device to become available. I tried the same thing doing nfsroot with a cardbus nic which fails because the kernel doesn't see the card until after it attempted to mount /

Signature · 1 line
 Lab tests show that use of micro$oft causes cancer in lab animals
#5 lore raw

On Mon, 29 Dec 2003 13:38:12 -0500 Wakko Warner <[email protected]> wrote:

| > > Is it possible to boot kernel with root from /dev/sda1 (USB)?
| > > partition table: whole /dev/sda is one partition (sda1), type 83 (Linux).
| > > Tried also switching on and off hotplugging in kernel and it didn't help.
| > 
| > Well, is the device detected and the partition table scanned before the
| > root mount is attempted?
| > 
| > I believe this should work given you've compiled in all the necessary
| > code.  Please capture the dmesg using serial console/netconsole/whatever
| > and post it along with your .config.
| 
| I did this with 2.4 a few months back.  Basically all I did was add the same
| delay before mounting root as the kernel does with mounting a root floppy. 
| Problem is the kernel is too fast for the usb code to find the disk.
| 
| I'v been wanting to ask this question.  How can I make the kernel "sleep"
| for say 5 seconds (or pause or something, whatever is required to delay
| execution) to wait for the device to become available.  I tried the same
| thing doing nfsroot with a cardbus nic which fails because the kernel
| doesn't see the card until after it attempted to mount /

I posted a patch for 2.4.22 which someone tested and reported as working. The patch is here:
http://www.xenotime.net/linux/usb/usbboot-2422.patch

--
~Randy

#6 lore raw
In reply to Karel Kulhavý

You'll need to load the usb modules using initrd ramdisk, then switch root to the usb device to continue booting the system.

Thanks,
Jeff
[ [email protected] ]

Quoted 18 lines · On Mon, 29 Dec 2003, [iso-8859-2] Karel Kulhav� wrote:

Hello

I tried to boot Linux 2.6.0 kernel with option root=/dev/sda1 using Grub. The kernel otherwise works, mounts the sda1 partition (XFS) OK. When I boot the kernel with root=/dev/sda1 instead of root=/dev/hda4, I get "can't mount root VFS, kernel panic" or something like that.

Is it possible to boot kernel with root from /dev/sda1 (USB)? partition table: whole /dev/sda is one partition (sda1), type 83 (Linux). Tried also switching on and off hotplugging in kernel and it didn't help.

Cl<
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#7 lore raw
Quoted 3 lines · Jeff Chua

You'll need to load the usb modules using initrd ramdisk, then switch root to the usb device to continue booting the system.

This is the problem #2. I am not able to remount /. "device or resource busy". How do I remount the "/"?

Cl<

#8 lore raw
Quoted 5 lines · On Dec-29 2003, Mon, 18:33 +0100 Karel Kulhavý <[email protected]> wrote:
Quoted 2 lines

You'll need to load the usb modules using initrd ramdisk, then switch root to the usb device to continue booting the system.

This is the problem #2. I am not able to remount /. "device or resource busy". How do I remount the "/"?

/sbin/mount -o remount,rw /

Signature · 1 line
Tomas Szepe <[email protected]>
#9 lore raw
Quoted 2 lines
Quoted 2 lines

This is the problem #2. I am not able to remount /. "device or resource busy". How do I remount the "/"?

I think you're looking for
chroot NEWROOT [COMMAND...]
or
pivot_root new_root put_old
here...

Greetings,

Michael

#10 lore raw
In reply to Tomas Szepe
Quoted 10 lines · Tomas Szepe
Quoted 5 lines · On Dec-29 2003, Mon, 18:33 +0100 Karel Kulhavý <[email protected]> wrote:
Quoted 2 lines

You'll need to load the usb modules using initrd ramdisk, then switch root to the usb device to continue booting the system.

This is the problem #2. I am not able to remount /. "device or resource busy". How do I remount the "/"?

/sbin/mount -o remount,rw /

bash-2.05b# mount
/dev/hda4 on / type xfs (rw)
none on /dev type devfs (rw)
none on /proc type proc (rw)
none on /dev/pts type devpts (rw)
/dev/hda1 on /boot type ext2 (rw,noatime)
none on /dev/shm type tmpfs (rw)
bash-2.05b# mount -o remount,rw /dev/sda1 /
bash-2.05b# mount
/dev/hda4 on / type xfs (rw)
^^^^^^^^^
none on /dev type devfs (rw)
none on /proc type proc (rw)
none on /dev/pts type devpts (rw)
/dev/hda1 on /boot type ext2 (rw,noatime)
none on /dev/shm type tmpfs (rw)

bash-2.05b# mount --version
mount: mount-2.12
bash-2.05b# cat /proc/version
Linux version 2.6.0 (root@oberon) (gcc version 3.3.2 20031022 (Gentoo Linux 3.3.2-r3, propolice)) #4 Mon Dec 29 12:20:39 MET 2003

When doing find / after that, the IDE disk goes crazy, not the USB one. So that mount doesn't lie and nothing is really remounted (and no error message issued). Is this how things are supposed to work?

Cl<

#11 lore raw
Quoted 35 lines · On Dec-30 2003, Tue, 10:10 +0100 Karel Kulhavý <[email protected]> wrote:
Quoted 10 lines · Tomas Szepe
Quoted 5 lines · On Dec-29 2003, Mon, 18:33 +0100 Karel Kulhavý <[email protected]> wrote:
Quoted 2 lines

You'll need to load the usb modules using initrd ramdisk, then switch root to the usb device to continue booting the system.

This is the problem #2. I am not able to remount /. "device or resource busy". How do I remount the "/"?

/sbin/mount -o remount,rw /

bash-2.05b# mount
/dev/hda4 on / type xfs (rw)
none on /dev type devfs (rw)
none on /proc type proc (rw)
none on /dev/pts type devpts (rw)
/dev/hda1 on /boot type ext2 (rw,noatime)
none on /dev/shm type tmpfs (rw)
bash-2.05b# mount -o remount,rw /dev/sda1 /
bash-2.05b# mount
/dev/hda4 on / type xfs (rw)
^^^^^^^^^
none on /dev type devfs (rw)
none on /proc type proc (rw)
none on /dev/pts type devpts (rw)
/dev/hda1 on /boot type ext2 (rw,noatime)
none on /dev/shm type tmpfs (rw)

bash-2.05b# mount --version
mount: mount-2.12
bash-2.05b# cat /proc/version
Linux version 2.6.0 (root@oberon) (gcc version 3.3.2 20031022 (Gentoo Linux 3.3.2-r3, propolice)) #4 Mon Dec 29 12:20:39 MET 2003

Quoted 3 lines

When doing find / after that, the IDE disk goes crazy, not the USB one. So that mount doesn't lie and nothing is really remounted (and no error message issued). Is this how things are supposed to work?

As others have said, you need to either

a) patch your kernel to wait for the usb disk to be detected. (Your only choice w/o an initrd.)

b) modify your initrd to mount the usb disk and pivot_root(2).

Signature · 1 line
Tomas Szepe <[email protected]>