LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   [SOLVED] Slackware 13 on USB, kernel panic (https://www.linuxquestions.org/questions/slackware-14/%5Bsolved%5D-slackware-13-on-usb-kernel-panic-854609/)

galumph 01-06-2011 08:00 AM

[SOLVED] Slackware 13 on USB, kernel panic
 
I've always wanted to install Linux on a small USB drive and have it boot on any computer anywhere. I thought I'd give it try with Slackware, I ran through the installation process a couple of times to see that I got it right, and continued on to installing on my USB drive.
I've got a 4GB sd card + reader formatted like so:
sdb1: 256M -- swap
sdb2: 3.8G -- ext4
I installed a barebones Slackware 13.1 system to sdb2 (of course), downloaded and compiled grub using the LFS instructions (Never used LILO, and I don't intend on doing so now.):
Code:

# ./configure --prefix=/usr          \
            --sysconfdir=/etc      \
            --disable-grub-emu-usb  \
            --disable-grub-fstest  \
            --disable-efiemu
# make && make install
# cd /
# grub-install /dev/sdb
# grub-mkconfig -o /boot/grub/grub.cfg

I figured this would work just as running off of a hard drive, I but I guess I was wrong. On reboot, I get a nice grub boot screen, select the first option, and wham! Kernel panic.
Code:

VFS: Cannot open root device "sdb2" or unknown-block (0,0)
Please append a correct "root= " boot option; here are the available partitions:
0800        117220824 sda driver: sd
        0801        40131                sda1
        0802        530145                sda2
        0803        116647965        sda3
0b00        1048575 sr0 driver: sr
Kernel panic - not syncing: VFS: unable to mount root fs on unknown-block (0,0)
PID: 1, comm: swapper Not tainted 2.6.33.4 #1

grub *does* recognize my flash drive.
Here's what my /boot/grub/grub.cfg looks like: http://pastebin.com/g3SqDcPs
Any ideas? Because I'm out of my own, I've been messing around with it all afternoon with no avail. Maybe I need an initrd?


(NOTE: I'm looking to create a persistent filesystem, not a live one. Otherwise I'd just use the Slackware cd and UNetbootin)

adamk75 01-06-2011 08:39 AM

You need to use the huge kernel or use an initrd.

Adam

galumph 01-06-2011 09:02 AM

I made an initrd using 'mkinitrd -c -k 2.6.33.4 -m ext4' and added 'initrd /boot/initrd.gz' to each menuentry in grub's configuration file. Rebooted, and now I've got a new error:
Code:

/boot/initrd.gz: loading kernel modules from initrd image
mount: can't find /mnt in /etc/fstab
ERROR: no /sbin/init found on rootdev (or not mounted). Trouble ahead.
You can try to fix it (etc...)

I'd say I built it wrong. At least the kernel isn't "panicking" anymore :-P.

e, Forgot to mention that fstab is empty aside from the proc entry.

adamk75 01-06-2011 09:55 AM

Ummm... Is it possible to even get a linux installation to boot if /etc/fstab doesn't have an entry for / ?

Adam

galumph 01-06-2011 10:12 AM

I actually tried that once, and well, nope. Anyway, what entries should fstab have, can I just copy the fstab I have on sdb2 over to the initrd tree?

galumph 01-06-2011 11:33 AM

Some guy on #slackware said to take a look at '/usr/share/mkinitrd/mkinitrd_command_generator.sh'. I gave it a go, and I gave me this 'mkinitrd -c -k 2.6.33.4 -f ext4 -r /dev/sdb2 -m jbd2:mbcahe:ext4 -o /boot/initrd.gz' which generated a damn fine initrd. I don't get any more crap about /mnt not being in fstab. Now I've got a new set of errors, apparently, /dev/sdb1 and 2 don't exist. I'll try and find a way to "create" them, anyone know how that's done (pretty sure udev takes care of it)?

(NOTE: /dev is populated with devices, including sda1-3.)

e, Google says I need ehci_hcd and uhci_hcd, how do I add them to the initrd?
ee, Nevermind that, all I had to was add them to '-m jbd2:mbcahe:ext4'. I still get nothing though, dmesg says the drive is recognized, but it doesn't show up under dev.
eee, Got it working. Only me and my Google-fu. I found I needed to run the following:
Code:

# make the initrd with the usb modules
mkinitrd -c -k 2.6.33.4 -f ext4 -r /dev/sdb2 -m jbd2:mbcahe:ext4:usbcore:ehci-hcd:uhci:usb-storage -o /boot/initrd.gz
# this makes sure we wait 10 seconds for sdb2
echo "10" > /boot/initrd-tree/wait-for-root
# rebuild the ramdisk
mkinitrd

Now to clean this sucker up, install X, openbox, and some tools.

nsp 11-17-2011 10:11 PM

Thanks
 
Quote:

Originally Posted by galumph (Post 4215442)
Some guy on #slackware said to take a look at '/usr/share/mkinitrd/mkinitrd_command_generator.sh'. I gave it a go, and I gave me this 'mkinitrd -c -k 2.6.33.4 -f ext4 -r /dev/sdb2 -m jbd2:mbcahe:ext4 -o /boot/initrd.gz' which generated a damn fine initrd. I don't get any more crap about /mnt not being in fstab. Now I've got a new set of errors, apparently, /dev/sdb1 and 2 don't exist. I'll try and find a way to "create" them, anyone know how that's done (pretty sure udev takes care of it)?

(NOTE: /dev is populated with devices, including sda1-3.)

e, Google says I need ehci_hcd and uhci_hcd, how do I add them to the initrd?
ee, Nevermind that, all I had to was add them to '-m jbd2:mbcahe:ext4'. I still get nothing though, dmesg says the drive is recognized, but it doesn't show up under dev.
eee, Got it working. Only me and my Google-fu. I found I needed to run the following:
Code:

# make the initrd with the usb modules
mkinitrd -c -k 2.6.33.4 -f ext4 -r /dev/sdb2 -m jbd2:mbcahe:ext4:usbcore:ehci-hcd:uhci:usb-storage -o /boot/initrd.gz
# this makes sure we wait 10 seconds for sdb2
echo "10" > /boot/initrd-tree/wait-for-root
# rebuild the ramdisk
mkinitrd

Now to clean this sucker up, install X, openbox, and some tools.

I met almost the same problem. After trying several stupid tries, Google directed me here. Then I followed your steps and problem solved. Thank you!


All times are GMT -5. The time now is 09:13 AM.