# bad /dev PLEASE HELP!  [SOLVED]

## dinsmore

Hi, my lilo wasn't starting, so, as I usually do when this happens, I ran knoppix to chroot to my linux partition and 'lilo -v' on it.

As the knoppix cd that I had was an older version that I normally use,  it didn't detect my hdd as SATA, so instead of being /dev/sda, it was /dev/hda. In my /etc/lilo.conf file, all the info was as if my drive was /dev/sda.  So, when I ran lilo -v it returned an error, something like /dev/sda doesn't exist or something like that. So I assumed that it was using the /dev from the knoppix configuration. so I tried to symlink /dev/hda to /dev/sda. By a stupid mistake of mine, I ran 'rm /dev/sda /dev/sda2 /dev/sda3' (my partitions). And it erased them from my linux partition /dev.  So, I want to know how to update my devfs (udev), or add the necessary nodes.

I'm in a hurry now, so I'm sure I've missed something, so please tell me if you need any extra info. gotta go, thanks!Last edited by dinsmore on Sat Aug 05, 2006 5:54 pm; edited 2 times in total

----------

## NeddySeagoon

dinsmore,

Both udev and devfs will create the nodes for you at boot time.

Are you really using devfs ?

It was removed from the kernel at 2.6.13.

If you run a static /dev then you need to use mknod to create the /dev entries

See man mknod for the syntax and /usr/src/linux/Documentation/devices.txt for the major and minor device numbers you will need.

----------

## dinsmore

the problem is, that I can't boot right now, it gives me a kernel panic :S  Something about a bad boot root= argument, so I'll try using mknod from a newer version of knoppix that i found now, that detects my hdd as sda now :P 

You're wright, I don't use devfs, I don't know why I said that :S, I'm currently running udev, so I know that the nodes should be created at boot time, but as I said, I can't boot, so I don't know what to do.

Thanks, I'll post again with results :PLast edited by dinsmore on Thu Aug 03, 2006 5:42 am; edited 1 time in total

----------

## dinsmore

I tried with mknod, reading the man page, I saw that I needed the major and minor number. So I looked for them in the /usr/src/linux/Documentation/devices.txt, but I don't know where the numbers are :S. All I saw was that sda is marked as '0 = sda  description', maybe the numers are 0 ??

I tried 'mknod /dev/sda b 0 0, chmod'ed it to 0644,  and when I tried lilo -v, and said permission denied. Then tried fdisk /dev/sda and told me that it couldn't open the device.

Any ideas? I'm clueless right now :S

EDIT:  I realized that the major number was actually 8, so the command that I tried now is 'mknod /dev/sda b 8 0' and 'mknod /dev/sda1 b 8 1' 'mknod /dev/sda2 8 2', and so on 'til /dev/sda4.  Still, when I try fdisk /dev/sda or lilo -v it doesn't work  :S

I don't know what else to do.  I saw there's something called makedev, but it isn't in portage  :Sad:    (I'm doing all this from knoppix, mounting the linux partition, chrooting and working from there)

----------

## NeddySeagoon

dinsmore,

What do you have in your grub.conf?

What is the exact text of your kernel panic message ?

To make /dev/ nodes persist over reboots, you need to use the udev tarball. Thats set in /etc/conf.d/rc ... but you shouald not need it.

----------

## dinsmore

I don't use grub, but here's my lilo.conf file:

```

# $Header: /var/cvsroot/gentoo-x86/sys-boot/lilo/files/lilo.conf,v 1.2 2004/07/18 04:42:04 dragonheart Exp $

# Author: Ultanium

#

# Start LILO global section

#

# Faster, but won't work on all systems:

#compact

# Should work for most systems, and do not have the sector limit:

lba32

# If lba32 do not work, use linear:

#linear

# MBR to install LILO to:

boot = /dev/sda

#map = /boot/System.map

# If you are having problems booting from a hardware raid-array

# or have a unusual setup, try this:

#disk=/dev/ataraid/disc0/disc bios=0x80  # see this as the first BIOS disk

#disk=/dev/sda bios=0x81                 # see this as the second BIOS disk

#disk=/dev/hda bios=0x82                 # see this as the third BIOS disk

# Here you can select the secondary loader to install.  A few

# examples is:

#

#    boot-text.b

#    boot-menu.b

#    boot-bmp.b

#

#install = /boot/boot-menu.b   # Note that for lilo-22.5.5 or later you

                              # do not need boot-{text,menu,bmp}.b in

                              # /boot, as they are linked into the lilo

                              # binary.

#menu-scheme=Wb

prompt

# If you always want to see the prompt with a 15 second timeout:

#timeout=150

#delay = 50

# Normal VGA console

#vga = normal

# VESA console with size 1024x768x16:

#vga = 791

#

# End LILO global section

#

#

# Linux bootable partition config begins

#

image = /boot/linux-2.6.17.6

   root = /dev/sda3

   label = Gentoo

   read-only # read-only for checking

#

# Linux bootable partition config ends

#

#

# DOS bootable partition config begins

#

other = /dev/sda2

   label = Windows

#

# DOS bootable partition config ends  

#

```

The kernel panic message is:

```

VFS: Cannot open root device "303" or unknown-block (3,3)

Please append a correct "root=" boot option

Kernel Panic - not syncing: VFS: Unable to mount root fs or unknown-block (3,3)

```

----------

## NeddySeagoon

dinsmore,

```
unknown-block (3,3)
```

is /dev/hda3. Your kernel can find your root partition but not read what it finds.

Your root filesystem type is missing from your kernel. It must not be a module.

----------

## dinsmore

But I don't need it to find /dev/hda3, I need it to find /dev/sda3. 

What do you mean my root filesystem type is missing from my kernel? I dind't know I had to compile it as a module (I don't even know for sure what I'm talking about compiling) What would you suggest to do then?

----------

## dinsmore

----------

## Corona688

Do NOT compile it as a module, it must be built in unless you're using something crazy like an initrd.

Your kernel understanding how to use your hard drive controller is not enough, it must understand how to use the filesystem on your root partition, i.e. ReiserFS or ext3 or whatever.

This can't even have anything to do with your device nodes.  The root partition is mounted before those are considered.

----------

## NeddySeagoon

dinsmore,

Since your kernel is looking for /dev/hda3, rather than /dev/sda3, I guess you made a typo in lilo.conf, fixed it then failed to run /sbin/lilo, to upate lilo on the MBR.

You will need /boot mounted for this.

Forget what I said about filesystems for now. Getting non zero numbers un unknown-block (x,y) normaly indicates filesystem issues but probably not in your case.

----------

## dinsmore

Aham, I tried to 'lilo -v' again with the lilo.conf fixed (sda instead of hda), but it says that it can't open /dev/sda... :S

So what you say is that I need /boot mounted for that. I forgot that /boot needs mounting, I thought it was just a directory in my linux partition. :P

Ok, I'll try and post the results. Thanks.

----------

## dinsmore

Ok, I'm glad to say tham I'm posting from linux now...  :Very Happy: 

I tried again running lilo -v after chrooting to my linux partition from knoppix and it sill didn't work, it said that it couldn't open the device. So I copied the lilo.conf from my linux partition to the knoppix system after mounting /dev/sda1 in /boot (/boot from the knoppix system). Copied the kernel bzimage to the knoppix /boot too, and ran lilo -v...   Worked!  :Very Happy: 

So, thanks for everything, you'll be hearing from me with yet another dumb problem.  lol

----------

