option "root=" doesn't work with devfs device names

option "root=" doesn't work with devfs device names

Post by Per Lidé » Thu, 17 Oct 2002 21:50:10


The "root=" kernel option doesn't work when used together with devfs
device names, e.g. root=/dev/discs/disc0/part1.

in do_mounts.c:

static int __init root_dev_setup(char *line)
        int i;
        char ch;

        ROOT_DEV = name_to_kdev_t(line);

The call to name_to_kdev_t() should return 0 if the device name starts
with "/dev/" but was not found in root_dev_names[] (which is the case if
e.g.  root=/dev/discs/disc0/part1 is used as a kernel option). But instead
of returning 0, name_to_kdev_t() will treat "discs/disc0/part1" as a
hex-number, which results in "discs/disc0/part1" being passed to
simple_strtoul(). The returned value from name_to_kdev_t() will thus be
garbage, and later calls to create_dev() will fail to create the
appropriate devfs entries because ROOT_DEV is non-zero.

The end result is a kernel panic "VFS: Unable to mount root fs on ...".

This has been broken since 2.4.19.

The patch below fixes this problem. It would be nice if this problem was
solved before 2.4.20 was released.


--- linux-2.4.20-pre10/init/do_mounts.c.old     2002-10-09 23:04:59.000000000 +0200
+++ linux-2.4.20-pre10/init/do_mounts.c 2002-10-09 23:50:46.000000000

                } while (dev->name);
+               if (!(dev->name))
+                       return to_kdev_t(0);
        return to_kdev_t(base + simple_strtoul(line,NULL,base?10:16));

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


1. Why doesn't echo "text" 'command' "more text" work?

                 ^                                        ^
Wrong quotes, should be -
   echo "You have" `grep Subject: /usr/spool/mail/me | wc -l` "messages."
or -
   echo "You have `grep Subject: /usr/spool/mail/me | wc -l` messages."

But, another problem is, if you've no mail, /usr/spool/mail/me does not
exist, leading grep to say:
   grep: can't open /usr/spool/mail/me
Wc will still report 0.

You might try -
   sh -c 'echo "You have `grep 2>/dev/null Subject: /usr/spool/mail/me | wc -l` messages."'

Hope this helps.

2. lockups in booting with 386/387

3. Mapping to windows drive

4. FTP works, but "ls" or "dir" doesn't ???

5. Problems linux 1.3.76 & mke2fs

6. "-ma" option of rxvt 2.03 doesn't work

7. Textmode not restored on WD90C24, anybody have a fix?

8. Why "$ read name < file_name" doesn't work in sh script ?

9. named.conf "option forwarder" vs. resolv.conf "nameserver"?

10. Help: "su" for root doesn't work

11. """"""""My SoundBlast 16 pnp isn't up yet""""""""""""

12. ppp's "nat deny_incoming yes" option doesn't log denied packets ?