Take the 2-minute tour ×
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.

Question

I have a working chroot environment (inittab, fstab, init.d/rcS set up), a kernel, and grub2 installed. What more do I need to get my system working?

Background/Specifics

For educational purposes, I set out to put together a small linux environment that I can boot into and have a running shell.

Using Virtualbox I attached a virtual machine to two hard drives (with just one partition each). The first one has Debian installed, and on the second one I built a small chroot environment with Busybox, using this article. I also set up inittab, fstab, init.d/rcS, and most of the other filesystem related stuff as directed in the article, although I didn't do anything on the second page related to genfromfs and syslinux because I figured I wasn't making a bootable floppy.

To figure out how to get my chroot system to boot, I found this post, and I ran grub-install --root-directory=/mnt /dev/sdb. At the end it said it completed with no errors.

Then I created a new virtual machine, this time with the second hard drive as its only hard drive, and started it. It gave me a grub prompt, so then I googled some more, and I typed in

set root=(hd0,msdos1)
linux /vmlinuz
boot

I had read that initrd/initramfs is optional, so I decided to overlook it for now. I built the linux kernel using make defconfig and make and copied over the bzImage under the x86 directory after the build.

However, soon I get a screen that hangs:

[ 0.74.. ] md: autorun ...
[ 0.74.. ] md: ... autorun DONE.
[ 0.74.. ] Root-NFS: no NFS server address
[ 0.74.. ] VFS: Unable to mount root fs via NFS, trying floppy.
[ 0.74.. ] VFS: Cannot open root device "(null)" or unknown-block(2,0)
[ 0.74.. ] Please append a correct "root=" boot option; here are the avaialbe partitions:
[ 0.74.. ] 0800  ... sda driver: sd
[ 0.74.. ] 0801 ... sda1 ...
[ 0.74.. ] 0b00 .. sr0 driver: sr ..
[ 0.74.. ] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
[ 0.74.. ] Pid: 1, comm: swapper/0 Not tainted 3.2.6 #1
[ 0.75.. ] Call Trae:
[ 0.75.. ]  [<c16..>] panic+0x57/0x157
[ 0.75.. ]  [<c18..>] mount_block_root+0x125/0x1a7
[ 0.75.. ]  [<c10..>] ? sys_mknod+0x27/0x30
.. a few more lines of call trace ...

I left some numbers out and the last few lines out because I had to type them in by hand, so if you need them let me know and I'll post them.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You need to specify the root= parameter in grub. The kernel is looking for the wrong root device, and so you get that 'unknown-block' error. I can see it properly detects your hard drive, so in grub you should use a line such as:

linux /vmlinux root=/dev/sda1
share|improve this answer
add comment

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.