LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-03-2002, 08:10 PM   #1
justiceisblind
Member
 
Registered: Jan 2002
Location: Stevens Point, WI
Distribution: Mandrake 10.0 (P4 2.8 w/ HT, Radeon 9700 Pro, 80 GB/120GB HDDs)
Posts: 242

Rep: Reputation: 30
Question INIT: cannot execute "/etc/rc.d/rc.S


HELP!! I'm getting this error when I boot into linux:

INIT: cannot execute "/etc/rc.d/rc.S

The system then proceeds to boot, but when I try to login, I get an error that my filesystem isn't read write. When I boot it with the zipslack 8.0 bootdisk I get the same error but I can login and do most everything. Here's the contents of the rc.S file

#!/bin/sh
#
# /etc/rc.d/rc.S: System initialization script.
#
# Mostly written by: Patrick J. Volkerding, <volkerdi@slackware.com>
#

PATH=/sbin:/usr/sbin:/bin:/usr/bin

# Start devfsd if necessary
if [ -r /dev/.devfsd ]; then
if [ -x /sbin/devfsd ]; then
echo "Starting devfs daemon: /sbin/devfsd /dev"
/sbin/devfsd /dev
fi
fi

# enable swapping
/sbin/swapon -a

# Start update.
/sbin/update &

# Test to see if the root partition is read-only, like it ought to be.
READWRITE=no
if echo -n >> "Testing filesystem status"; then
rm -f "Testing filesystem status"
READWRITE=yes
fi

# Check the integrity of all filesystems
if [ ! $READWRITE = yes ]; then
/sbin/fsck -A -a
# If there was a failure, drop into single-user mode.
if [ $? -gt 1 ] ; then
echo
echo
echo "*******************************************************"
echo "*** An error occurred during the file system check. ***"
echo "*** You will now be given a chance to log into the ***"
echo "*** system in single-user mode to fix the problem. ***"
echo "*** Running 'e2fsck -v -y <partition>' might help. ***"
echo "*******************************************************"
echo
echo "Once you exit the single-user shell, the system will reboot."
echo

PS1="(Repair filesystem) \#"; export PS1
sulogin

echo "Unmounting file systems."
umount -a -r
mount -n -o remount,ro /
echo "Rebooting system."
sleep 2
reboot
fi
# Remount the root filesystem in read-write mode
echo "Remounting root device with read-write enabled."
/sbin/mount -w -v -n -o remount /
if [ $? -gt 0 ] ; then
echo
echo "Attempt to remount root device as read-write failed! This is going to"
echo "cause serious problems."
echo
echo "If you're using the UMSDOS filesystem, you **MUST** mount the root partition"
echo "read-write! You can make sure the root filesystem is getting mounted "
echo "read-write with the 'rw' flag to Loadlin:"
echo
echo "loadlin vmlinuz root=/dev/hda1 rw (replace /dev/hda1 with your root device)"
echo
echo "Normal bootdisks can be made to mount a system read-write with the rdev command:"
echo
echo "rdev -R /dev/fd0 0"
echo
echo "You can also get into your system by using a bootkernel disk with a command"
echo "like this on the LILO prompt line: (change the root partition name as needed)"
echo
echo "LILO: mount root=/dev/hda1 rw"
echo
echo "Please press ENTER to continue, then reboot and use one of the above methods to"
echo -n "get into your machine and start looking for the problem. "
read junk;
fi
else
echo "Testing filesystem status: read-write filesystem"
if cat /etc/fstab | grep ' / ' | grep umsdos 1> /dev/null 2> /dev/null ; then
ROOTTYPE="umsdos"
fi
if [ ! "$ROOTTYPE" = "umsdos" ]; then # no warn for UMSDOS
cat << EOF

*** ERROR: Root partition has already been mounted read-write. Cannot check!

For filesystem checking to work properly, your system must initially mount
the root partition as read only. Please modify your kernel with 'rdev' so that
it does this. If you're booting with LILO, add a line:

read-only

to the Linux section in your /etc/lilo.conf and type 'lilo' to reinstall it.

If you boot from a kernel on a floppy disk, put it in the drive and type:
rdev -R /dev/fd0 1

If you boot from a bootkernel disk, or with Loadlin, you can add the 'ro' flag.

This will fix the problem *AND* eliminate this annoying message. :^)

EOF
echo -n "Press ENTER to continue. "
read junk;
fi
fi

# remove /etc/mtab* so that mount will create it with a root entry
/bin/rm -f /etc/mtab* /etc/nologin /etc/shutdownpid

# mount file systems in fstab (and create an entry for /)
# but not NFS or SMB because TCP/IP is not yet configured
/sbin/mount -a -v -t nonfs,nosmbfs

# Clean up temporary files on the /var volume:
/bin/rm -f /var/run/utmp /var/run/*.pid /var/log/setup/tmp/*

# Looks like we have to create this.
cat /dev/null > /var/run/utmp

# Detect SGI Visual Workstation, since hwclock will make those freeze up:
if fgrep -l Cobalt-APIC /proc/interrupts 1> /dev/null 2> /dev/null ; then
echo "SGI Visual Workstation detected. Not running hwclock."
# Set the system time from the hardware clock using hwclock
elif [ -x /sbin/hwclock ]; then
echo "Setting system time from hardware clock."
if [ -e /etc/hardwareclock ]; then
HC=`cat /etc/hardwareclock | while read LINE ; do
if [ "$LINE" = "UTC" -o "$LINE" = "utc" ]; then
echo utc
break;
elif [ "$LINE" = "localtime" ]; then
echo localtime
break;
fi
done`
else
# Default to localtime if there is no /etc/hardwareclock:
HC=localtime
fi
# /sbin/hwclock --$HC --hctosys
# The line above *should* work with --localtime, but doesn't. Omitting
# the argument defaults it to localtime, so use that.
if [ "$HC" = "utc" ]; then
/sbin/hwclock --utc --hctosys
else
/sbin/hwclock --hctosys
fi
fi

if [ "$ROOTTYPE" = "umsdos" ]; then # we need to update any files added in DOS:
echo "Synchronizing UMSDOS directory structure:"
echo " umssync -r99 -v- /"
umssync -r99 -v- /
fi

# Setup the /etc/motd to reflect the current kernel level:
# THIS WIPES ANY CHANGES YOU MAKE TO /ETC/MOTD WITH EACH BOOT.
# COMMENT THIS OUT IF YOU WANT TO MAKE A CUSTOM VERSION.
echo "`/bin/uname -a | /bin/cut -d\ -f1,3`." > /etc/motd

# Configure ISA Plug-and-Play devices:
if [ -r /etc/isapnp.conf ]; then
if [ -x /sbin/isapnp ]; then
/sbin/isapnp /etc/isapnp.conf
fi
fi

# This loads any kernel modules that are needed. These might be required to
# use your CD-ROM drive, bus mouse, ethernet card, or other optional hardware.
if [ -x /etc/rc.d/rc.modules ]; then
. /etc/rc.d/rc.modules
fi

# Initialize PCMCIA devices:
#
# NOTE: This had been closer to the top of this script so that PCMCIA devices
# could be fsck'ed along with the other drives. This had some unfortunate
# side effects, however, since root isn't yet read-write, and /var might not
# even be mounted the .pid files can't be correctly written in /var/run and
# the pcmcia system can't be correctly shut down. If you want some PCMCIA
# partition to be mounted at boot (or when the card is inserted) then add
# the appropriate lines to /etc/pcmcia/scsi.opts.
#
if [ -x /etc/rc.d/rc.pcmcia ] ; then
. /etc/rc.d/rc.pcmcia start
fi

# Run serial port setup script:
# (CAREFUL! This can make some systems hang if the rc.serial script isn't
# set up correctly. If this happens, you may have to edit the file from a
# boot disk)
#
# . /etc/rc.d/rc.serial

# Carry an entropy pool between reboots to improve randomness.
# Load and then save 512 bytes, which is the size of the entropy pool.
if [ -f /etc/random-seed ]; then
echo "Using /etc/random-seed to initialize /dev/urandom."
cat /etc/random-seed >/dev/urandom
fi
dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null
 
Old 03-03-2002, 11:44 PM   #2
crabboy
Moderator
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
What are the permissions on the file?

They should be 755.
 
Old 03-04-2002, 04:48 PM   #3
justiceisblind
Member
 
Registered: Jan 2002
Location: Stevens Point, WI
Distribution: Mandrake 10.0 (P4 2.8 w/ HT, Radeon 9700 Pro, 80 GB/120GB HDDs)
Posts: 242

Original Poster
Rep: Reputation: 30
I'll try to chmod 755 /etc/rc.d/rc.S thanks.
 
Old 03-04-2002, 06:01 PM   #4
justiceisblind
Member
 
Registered: Jan 2002
Location: Stevens Point, WI
Distribution: Mandrake 10.0 (P4 2.8 w/ HT, Radeon 9700 Pro, 80 GB/120GB HDDs)
Posts: 242

Original Poster
Rep: Reputation: 30
I did a chmod 755 on the rc.S I get the same error. Just for kicks I tried to run the script. I can run all the other scripts in the /etc/rc.d folder but the rc.S when i type ./rc.S this is the error I get:

bash: ./rc.S: bad interpreter: No Such file or Directory.

I don't think this is very good. Any ideas on where I could get a new rc.S file without having to download the entire distro again??

Last edited by justiceisblind; 03-04-2002 at 06:05 PM.
 
Old 03-05-2002, 04:11 AM   #5
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 46
The error you are getting means that the first line points to an interpreter that doesn't exist. In your script that would be /bin/sh
You could change it to /bin/bash or you could make a symbolic link to bash:
ln -s /bin/bash /bin/sh

I guess the rest of the scripts all point to /bin/bash otherwise they would also cause problems.
 
Old 03-05-2002, 11:02 AM   #6
taz.devil
Senior Member
 
Registered: Nov 2001
Location: Wa. State
Distribution: Slackware
Posts: 1,261

Rep: Reputation: 45
The rc scripts all point to #!(/bin/sh), I'm guessing that something changed in the script that isn't allowing it to run at start. It can be something as simple as no carriage return at the end of the script to a symbol. If you need, I or someone else could easily send you a fresh rc.S to see if that helps.
 
Old 03-05-2002, 04:23 PM   #7
justiceisblind
Member
 
Registered: Jan 2002
Location: Stevens Point, WI
Distribution: Mandrake 10.0 (P4 2.8 w/ HT, Radeon 9700 Pro, 80 GB/120GB HDDs)
Posts: 242

Original Poster
Rep: Reputation: 30
That would be ever so helpful. My email address is justiceisblindfolded@hotmail.com
 
Old 03-08-2002, 10:54 PM   #8
justiceisblind
Member
 
Registered: Jan 2002
Location: Stevens Point, WI
Distribution: Mandrake 10.0 (P4 2.8 w/ HT, Radeon 9700 Pro, 80 GB/120GB HDDs)
Posts: 242

Original Poster
Rep: Reputation: 30
Hmm... I opened it in KDE's advanced editor, scrolled down to the bottom of the file and saved it again, and when I rebooted i didn't get the error. don't know what was wrong with it, but it works fine now.
 
Old 08-08-2002, 09:01 PM   #9
namelocr
LQ Newbie
 
Registered: Aug 2002
Posts: 6

Rep: Reputation: 0
I'm posting this whereever I see the 'bad interprer' question...hope it helps.

If you are using Linux 7.X, vim is the editor being used.
vim can save a file in both unix and dos format.
When saved in dos format, you will get the 'bad interpreter'
message when trying to run a script that uses the
"#!/path/to/interpreter becasue of the garbage chars in the
file (that vim doesn't show you unless you tell it to).
You can vim the file and issue ":set fileformat=unix" and save.

Try this and see if it fixes the issue.
 
Old 08-16-2002, 11:54 AM   #10
samboe
LQ Newbie
 
Registered: Aug 2002
Distribution: zipslack
Posts: 5

Rep: Reputation: 0
I am having a similar problem but I can't get zipslack to load at all. Is there anyway to edit the text in a "unix" format from dos?
 
Old 08-16-2002, 10:42 PM   #11
linuxcool
LQ Addict
 
Registered: Jun 2001
Posts: 1,183

Rep: Reputation: 47
Are you trying to edit the linux.bat file? If you are, you can use the msdos Notepad to edit it.
 
Old 08-17-2002, 10:38 AM   #12
samboe
LQ Newbie
 
Registered: Aug 2002
Distribution: zipslack
Posts: 5

Rep: Reputation: 0
actually I was refering to namelocr's post about using the vim editor (or vi, elvis, etc.)...

possibly editing rc.S or inittab

Last edited by samboe; 08-17-2002 at 04:24 PM.
 
Old 08-17-2002, 10:01 PM   #13
ksandre
LQ Newbie
 
Registered: Jul 2002
Location: New Hampshire, USA
Distribution: Slackware
Posts: 28

Rep: Reputation: 15
This script is in the "sysvinit.tgz" package of Slackware ["disk a1" on 8.0].

I recall having trouble due to the "devfs" section at the top. I didn't have that package configured and decided not to run it eventually. I commented out that whole first section.

Also, check to make sure you have at symlink between rc.0 and rc.6.

Just guessing. I looked at what you have pretty closely, and it seems to match mine, but it wouldn't hurt to obtain the package and reinstall that script, I guess. Another thing to check is your rc.serial since that can be problematic and is called by rc.S as well.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ZipSlack 10 + LOADLIN give error message(s) --INIT: Cannot execute "/sbin/agetty"-- dhv Slackware 9 07-24-2006 10:02 PM
INIT: cannot execute /sbin/agetty xrado Slackware 5 08-06-2005 04:44 AM
INIT: cannot execute "/etc/rc.d/rc.S" dufferin Slackware 11 11-27-2003 06:32 PM
Bootup error " INIT: Cannot execute .... Sifvion Slackware 2 10-02-2003 11:49 AM
Zipslack getting "Kernel panic: no init found. Try passing init= option to kernel" Sam Hobbs Linux - Newbie 4 03-28-2002 10:37 AM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration