It is currently Mon, 25 Sep 2023 11:20:15 GMT



 
Author Message
 ...dup2: Bad file descriptor [FAILED] .../dev/null: Read-only file system
Hi,
Read lots of Dejanews (er Google) posts regarding failed initialization
scripts in /etc/rc.d.

The RedHat guides were informative about the sequence of how to boot up a
running system.

After Lilo and the kernel pass control to init something gets out of whack.
It seems that /etc/rc.d/rc.sysinit can't do its job right, which is really
weird. I was using my 6.9 (Pinstripe) edition of RedHat when one day the
Acer Extensa 670CDT notebook decided to go into its BIOS. Upon reboot the
system hasn't been able to boot into multiuser mode.

Here's my observations, but without a cure yet:

Reinstalled via "Update" my system using an installation CDROM.
    Reboot:   ...dup2: Bad file descriptor
Ran "Expert" mode in CDROM and fscked the unmounted filesystem
    Reboot:   ...dup2: Bad file descriptor
Ran command prompt from anoter distro's CDROM & fscked again:
    Reboot:   ...dup2: Bad file descriptor
Rebooted and dropped into single user mode, mounted the installation CDROM
and remounted the filesystem read-write; & ran `rpm -vv -i --force
/mnt/cdrom/RedHat/RPMS/base*rpm
    Reboot:   ...dup2: Bad file descriptor
Curioristy began to set in so I remounted as read-write the filesystem and
manually started the various services in /etc/rc.d/init.d/* . These scripts
including the last one, linuxconf, returned [OK]. My prompt reading
root@(none). Startx works. In a Gnome-terminal I reboot the system using
`shutdown -r now`.
    Reboot: ...dup2: Bad file descriptor.
Noticing that most of the /etc/ scripts mention RedHat 6.0, I transfer a
etc_rh6.0.tgz tarball by sneakernet via a floppy. With a backup etc.tgz made
I copy etc_rh6.0/rc.d/* over to /etc.
    Reboot:   ...dup2: Bad file descriptor.
Since that didn't work I restored the backup etc.tgz scripts I made, so I
could keep looking for a solution.

It appears that rc.sysinit has NOT been able to complete its job: Viewing a
boot screen I see that rc.sysinit fails at `action "Mounting proc
filesystem" mount -n -t proc /proc /proc` with all the next action
statements of the /etc/rc.d/rc.sysinit script consecutively failing as well,
dumping me back into logging in single-user mode to continue. Other a
Dejanews report similar errors with commenters suggesting fscking from a
boot disk or CDROM:

[FAILED]

/etc/rc.sysinit: /dev/null: Read-only file system
/etc/rc.sysinit: /dev/null: Read-only file system

Remounting read-write the root file system, the /proc filesystem is able to
be mounted.
However, upon rebooting the proc file system is added to /etc/mtab as

none /proc /proc

The rhl-rg-6.2en guide states at "2. System Administration: The Boot
Process, Init, and Shutdown" states,  "Init [first] runs
/etc/rc.d/rc.sysinit, which sets your path, sets up networking if necessary,
starts swapping, checks the filesystems, and so on. Basically, rc.sysiit is
taking care of everything that your system needs to have done at system
initialization." The guide goes on to say that Init implements the
/etc/inittab file for description of how to setup each runlevel.

The manual 8 page for init suggests not using 0 (halt), 6 (reboot), or 1
(single user). So I've set linuxconf runlevel to 5

Could someone tell me which rpm from the installation CDROM will replace the
/etc/rc.init scripts?



 Mon, 27 Oct 2003 03:02:33 GMT   
 ...dup2: Bad file descriptor [FAILED] .../dev/null: Read-only file system
Here's what my /etc/mtab & /etc/fstab say:

/etc/mtab:
/dev/hda1  /  ext2  rw 0 0
none /dev/pts  devpts  rwgid=5,mode=620 0 0
none /proc proc rw 0 0

/etc/fstab:
/dev/hda1     /                                  ext2          defaults
1 1
/dev/cdrom  /mnt/cdrom                 iso9660  noauto,owner,ro 0 0
/dev/fd0       /mnt/floppy_msdos    msdos     noauto,owner,rw 0 0
/dev/fd0       /mnt/floppy_unix         ext2         noauto,owner,rw 0 0
/proc            /proc                            proc        defaults
0 0

Any help is appreciated!

Brian

news:9dc66r$bud$1@hatathli.csulb.edu...



 Mon, 27 Oct 2003 03:27:58 GMT   
 ...dup2: Bad file descriptor [FAILED] .../dev/null: Read-only file system
Hi,
Anyone have any ideas how to fix this? See original post for system setup
info.

I hazard to guess that the system bootup scripts are failing due to a
non-fscked, non-mounted /proc read-only filesystem. dup2 errors result
because rc.sysinit finds that the  /proc directory is empty. The system will
not proceed to multiuser unless it has a clean (fsck'ed) filesystem. Running
top and df fails as well since these programs depend on pulling information
from the /proc directory, stating "Error: /proc must be mounted      To
mount /proc at boot you need an /etc/fstab line like:   /proc  /proc   proc
defaults     In the meantime, mount /proc /proc -t proc

Looking at the dup2 error, "Bad file descriptor", it seems that since proc
wasn't mouted there are no virtual files to get a valid file description.
And thus, the error, "Bad file descriptor".

I'm not sure of the booting sequence of programs other than what the rhl
guide mentions 1) Lilo 2) Kernel 3) Init 4) rc.sysinit.  But since the
filesystem remains "Read-only" it may be that there is a broken script
between Init and rc.sysinit. I think maybe that this has to do with mounting
the system read-only first for auto-fscking and then remounting the as
writable so that rc.sysinit can mount and get file descriptors from the
/proc directory.

What scripts are run between Init and rc.sysinit? Before rc.sysinit mounts
/proc it does:

1) # Rerun ourselves through initlog
        if [ -z "$IN_INITLOG"]; then
       [ -f /sbin/initlog ] && exec /sbin/initlog &INITLOG_ARGS -r
/etc/rc.sysint
       fi

2) # If we're using devfs, start devfsd now -- we need the old device names
      [ -e /dev/.devfsd -a -x /sbin/devfsd ] && /sbin/devfsd /dev

3) # Set the path
    PATH=/bin:/sbin:/usr/bin:/usr/sbin
    export PATH
4) # Read in config data.
    if [ -f /etc/sysconifg/network ]; then
    .  /etc/sysconfig/network
    else
    NETWORKING=no
    HOSTNAME=localhost
    fi

5) # Source functions
    .   /etc/init.d/functions

6) # Print a banner. ;)
    echo -en "\t\t\tWelcome to "
   [ "$BOOTUP" != "serial" ] && echo -en \\033[1;31m"
    echo -en "Red Hat"
   [ "$BOOTUP" != "serial" ] && echo -en \\033[0;39m"
   echo " Linux"
    if [ "$PROMPT" != "no" ]; then
    echo -en "\t\tPress 'I' to enter interactive startup."
    echo
    sleep 1
   fi

7) # Fix console loglevel
/bin/dmesg -n $LOGLEVEL

# Mount /proc (done here so volume labels can work with fsck)
action "Mounting proc filesystem" mount -n -t proc /proc /proc

And here's where the dup2 errors occur.  The only place dup2 occurs in /etc
is in /etc/ltrace.conf:  ; unistd.h ... int dup2(int, int);  The comment
occurs in /usr/include/unistd.h: /* Duplicate FD to FD2, closing FD2 and
making it open on the same file. */  extern int dup2(int __fd, int __fd2)
__THROW;

Any help is appreciated!

Brian
[root@(none) /proc]#



 Mon, 27 Oct 2003 05:57:48 GMT   
 ...dup2: Bad file descriptor [FAILED] .../dev/null: Read-only file system
What I have found is that the action() function in
/etc/rc.d/init.d/functions is behaving correctly by not allowing the system
to continue due to the "failure" flags being tripped due to problems of the
fsck scripts saying that the problems were encountered with the filesystem.
But, an unmounted, read-only filesystem should allow fsck, since that is
precisely the right way to use fsck.

Any help is appreciated as I'm not found of the says, "Physican, heal
thyself".

Brian Wildasinn



 Wed, 29 Oct 2003 13:54:01 GMT   
 
   [ 4 post ] 

Similar Threads

1. kernel: Cannot read proc file system: 9 - Bad file descriptor

2. dup2: bad file descriptor, please help

3. Mounting proc filesystem dup2: Bad file descriptor

4. Mounting proc filesystem dup2: bad file descriptor

5. Mounting proc filesystem dup2: bad file descriptor?

6. dup2: bad file descriptor.

7. /dev/ttyp?...login failed...Read-only file system


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software