Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 18040 - sysvinit failure; "/dev/null: Read-only file system"
Summary: sysvinit failure; "/dev/null: Read-only file system"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Docs Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-23 08:23 UTC by D Wollmann
Modified: 2003-06-24 06:01 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description D Wollmann 2003-03-23 08:23:12 UTC
For reasons I can't even recall, my personal gentoo system
ended up with an ext3 root filesystem and the other
filesystems using reiserfs. For the sake of consistency I
decided to switch / to reiserfs. The conversion went smoothly
until I attempted to reboot. sysvinit failed with (from
handwritten notes):

INIT (version number)...
/sbin/rc: line 1: /dev/null: Read-only file system
/sbin/rc: line 1: /dev/null: Read-only file system
/sbin/rc: line 1: /dev/null: Read-only file system
Gentoo Linux; http://www.gentoo.org/
Copyright...

7G[ oops ]g /proc...
 * The "mount" command failed with error:
 line 1: /dev/null: Read-only file system
 * Since this is a critical task, startup cannot continue.
Give root password for maintenance
(or type Control-D for normal startup):

By remounting / rw and manually mounting the proc, devfs and tmpfs
(/mnt/.init.d) filesystems and starting devfsd, then mounting
the remaining unmounted partitions and activating swap I was
able to bring the system to a mostly functional state after
running /sbin/rc single, then /sbin/rc default.

The problem appears to be that /sbin/rc's try() function
redirects mount's stdout to /dev/null while the root filesystem
is still mounted read-only (even though mount is
invoked with the -n option so as not to attempt writing to
/etc/mtab on a read-only mounted filesystem).


Changing /sbin/rc:17 from:
    errstr="$((eval $*) 2>&1 >/dev/null)"
to:
    errstr="$(eval $*)"
permits successful completion of sysvinit (but
outputs junk on the console).


Behavior is identical for both kernels:
ck-sources 2.4.20-r4
gentoo-sources 2.4.19-r10


Installed baselayout:
sys-apps/baselayout 1.8.5.8


$ emerge info
Portage 2.0.47-r10 (default-x86-1.4, gcc-3.2.2, glibc-2.3.1-r2)
=================================================================
System uname: 2.4.20-ck4 i686 Pentium III (Coppermine)
GENTOO_MIRRORS="ftp://ftp.gtlib.cc.gatech.edu/pub/gentoo 
ftp://csociety-ftp.ecn.purdue.edu/pub/gentoo 
ftp://mirror.iawnet.sandia.gov/pub/gentoo 
http://www.ibiblio.org/pub/Linux/distributions/gentoo"
CONFIG_PROTECT="/etc /var/qmail/control /usr/kde/2/share/config /etc/env.d
/etc/postfix /usr/X11R6/lib/X11/xkb /usr/kde/3.1/share/config
/usr/kde/3/share/config /usr/share/config"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
PORTDIR="/usr/portage"
DISTDIR="/usr/portage/distfiles"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/usr/var/tmp"
PORTDIR_OVERLAY="/usr/local/portage"
USE="x86 apm avi encode gif jpeg libg++ mikmod mpeg ncurses nls pdflib png
quicktime spell xml2 xmms xv zlib gtkhtml gdbm berkdb tetex svga guile mysql gpm
tcpd pam libwww ssl python imlib oggvorbis motif cdr scanner X gtk gnome bonobo
kde qt arts esd crypt mmx 3dnow sse cups tcltk opengl sdl dga oss perl readline
truetype mozilla java slang -alsa"
COMPILER="gcc3"
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium3 -O3 -pipe"
CXXFLAGS="-march=pentium3 -O3 -pipe"
ACCEPT_KEYWORDS="x86"
MAKEOPTS="-j3"
AUTOCLEAN="yes"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
FEATURES="sandbox ccache buildpkg"

/etc/fstab:

/dev/hda2               /boot           ext3            noauto,noatime  0 0
/dev/hda1               /               reiserfs        noatime,notail  0 1
/dev/hda3               none            swap            sw              0 0
/dev/hda5               /tmp            reiserfs        noatime,notail  0 1
/dev/hda6               /var            reiserfs        noatime,notail  0 1
/dev/hda7               /home           reiserfs        noatime,notail  0 1
/dev/hda8               /usr            reiserfs        noatime,notail  0 1
/dev/cdroms/cdrom0      /mnt/cdrom      iso9660         user,noauto,ro  0 0
/dev/cdroms/cdrom1      /mnt/cdrom2     iso9660         user,noauto,ro  0 0
/dev/fd0                /mnt/floppy     msdos           user,noauto     0 0
proc                    /proc           proc            defaults        0 0
tmpfs                   /dev/shm                tmpfs           defaults 0 0
Comment 1 Martin Holzer (RETIRED) gentoo-dev 2003-03-23 08:43:42 UTC
did you enable reiserfs into you kernel (not as module) ?
Comment 2 D Wollmann 2003-03-23 15:51:23 UTC
Yes, reiserfs support is built in on both kernel builds.
Comment 3 Martin Schlemmer (RETIRED) gentoo-dev 2003-03-23 16:01:36 UTC
Problem most probably that with the conversion, the device nodes in /dev/ got
nuked.  You should be able to fix it via one of two ways:

1)  add 'devfs=mount' to you kernel parameters

2)  boot with kernel parametes 'devfs=nomount init=/bin/bash rw', and then
    run:

   # /usr/sbin/MAKEDEV generic-i386

    Note that you may have to mount /usr if on diff partition.

Option 2 should get your system to a more 'normal' state.

Comment 4 Martin Holzer (RETIRED) gentoo-dev 2003-03-23 16:26:53 UTC
i think this is a duplicate of bug #18057
Comment 5 D Wollmann 2003-03-23 17:17:00 UTC
Martin,

Thanks, the problem is solved.

For what it's worth, I searched bugzilla and forums before posting this
bug, but didn't find any comments that offered a solution.

I went with option #2:

2)  boot with kernel parameters 'devfs=nomount init=/bin/bash rw', and then
    run:
    ...

For the benefit of others who might encounter similar problems,
before I was able to mount my /usr partition I had to create
the device nodes with mknod(1). My /usr is the fourth in the
extended partition. I wasn't sure if the /dev/hda inode was
required or not, so I created it just to be thorough:

mknod /dev/hda b 0 3 0
mknod /dev/hda8 b 0 3 8


It also seems important to mount /proc before
running MAKEDEV, since MAKEDEV extracts device
information from the /proc tree.

mount -t proc none /proc


The command to create the default device nodes:

cd /dev && /usr/sbin/MAKEDEV generic-i386


It's also worth noting that when booted with init=/bin/bash,
bash doesn't print a prompt until the user presses ENTER.


post mortem:

What confused me about this situation was the devfs documentation,
which implies that with devfs there is no longer a need for
MAKEDEV. Had I looked more carefully at the situation before the
conversion I would have realized that gentoo's sysvinit assumes
that there are on-disk device inodes in /dev before mounting the
devfs filesystem.

It might be helpful to add a note to the gentoo install page
(http://www.gentoo.org/doc/en/gentoo-x86-install.xml) explaining
that in the absence of the devfs=mount boot option, the on-disk
inodes are still a requirement, perhaps with a link to a page
explaining how to create them when necessary.
Comment 6 Martin Schlemmer (RETIRED) gentoo-dev 2003-03-24 13:45:45 UTC
Glad you got it working.

> What confused me about this situation was the devfs documentation,
> which implies that with devfs there is no longer a need for
> MAKEDEV. Had I looked more carefully at the situation before the
> conversion I would have realized that gentoo's sysvinit assumes
> that there are on-disk device inodes in /dev before mounting the
> devfs filesystem.

All Gentoo systems will still have the device nodes, we just want the
dependency to be not so great.

> It might be helpful to add a note to the gentoo install page
> (http://www.gentoo.org/doc/en/gentoo-x86-install.xml) explaining
> that in the absence of the devfs=mount boot option, the on-disk
> inodes are still a requirement, perhaps with a link to a page
> explaining how to create them when necessary.

Right.  Can somebody in docs add something like:

  Please note that you should verify that your (unmounted) /dev is populated
  with device nodes if you decide not to let the kernel mount devfs, or not
  to use devfs in general.  You can recreate them (be sure that /dev is not
  mounted) by running:

    # cd /dev; /usr/sbin/MAKEDEV generic-i386

  This is for x86, if you have another arch, you will need to use the command
  specific to that arch ....

Comment 7 John Davis (zhen) (RETIRED) gentoo-dev 2003-06-24 06:01:59 UTC
I could see something like this in the unofficial FAQ (wiki). Could someone please add this to the wiki?