Cannot execute init.d/rc

Hi,

I tried o log on my linux machine using putty and the password for the root was not recognized. Then i turned off the server and when i turned it on i got the message "Cannot execute /etc/init.d/rc".

What might have happened? How do I fix this?

Thanks.
se_1581Asked:
Who is Participating?
 
jazzIIIloveConnect With a Mentor Commented:
Please send your damned inittab...
Could you right the exact error on the screen (if you write, please rewrite, i am lost here)

and follow this, its first page is taking backup, second page may resemble your problem...

http://www.linuxdevcenter.com/pub/a/linux/2001/11/29/UserModeLinux.html?page=2
0
 
jazzIIIloveCommented:
Hi there;

Check if you have execute permission on that path...

Best regards...
0
 
se_1581Author Commented:
I cannot login on the server anymore. how do I do that?
Thanks.
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
jazzIIIloveCommented:
???
what command you executed?
0
 
jazzIIIloveCommented:
well, have you given execution permission to /etc/init.d/rc?
0
 
jazzIIIloveCommented:
#chmod -R 755 /etc
0
 
se_1581Author Commented:
it booted it up and now i only have on the screen:

(none) login:

i put the root or any other command but nothing is happening.
0
 
jazzIIIloveCommented:
i was about to write don't boot!
0
 
jazzIIIloveCommented:
Then, now,reboot into the recovery mode and run the command above...
0
 
Duncan RoeSoftware DeveloperCommented:
Is that  the real message - no typos? ("Cannot execute /etc/init.d/rc") Had you been editing /etc/inittab?
When you are physically at the console, you can get a shell prompt by appending this string to the boot line (the boot line is usually just the kernel name):
   init=/bin/bash
I.e. space then string with no spaces. That will run /bin/bash as process 1 instead of running init - so nothing that init normally does will get done. You will be root. You will not be asked for a password. Carefully examine /etc/init.d/rc - does it have execute permission? Is it an executable program or shell, or is it a directory? Or is it not there at all?
When was /etc/inittab last modified? Are there errors in it?
Have a look around and post back with what you find - unless of course you fix it straight away
0
 
jazzIIIloveCommented:
AFTER TRYING ABOVE COMMAND, if fails, boot the live cd, open a console and execute 'fdisk -l' that should give you an output like as snippet:

We are interested in the Linux partition on /dev/hda3 in snippet, yours may differ of course. Then execute:
#mkdir /mnt
#mount /dev/hda3 /mnt
#chmod -R 755 /mnt/etc

IAfter that you can reboot without livecd and i got very stressed here....
   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        3681    29567601    7  HPFS/NTFS
/dev/hda2            3682        3749      498015   82  Linux swap / Solaris
/dev/hda3            3750        8783    40435605   83  Linux

Open in new window

0
 
jazzIIIloveCommented:
when your boot loader starts push tab, and type in your default os with init 3. For example "Linux init 3" this will pass an option to the kernel to enter runlevel 3. If you still can't get to a prompt, then you'll need to use a live cd or you can use the installation cd...
0
 
se_1581Author Commented:
here is the last 3 lines from the error

INIT: entering runlevel 2
INIT: cannot execute "/etc/init.d/rc"
(none) login:

at this point I cannot do anything.

no one change anything /etc.inittab
0
 
jazzIIIloveCommented:
Did you try
<<AFTER TRYING ABOVE COMMAND, if fails, boot the live cd, open a console and execute 'fdisk -l' that <<should give you an output like as snippet:......
.....


0
 
jazzIIIloveCommented:
ok...if the post
<<After trying blablaa

doesn't work...

Replace /etc/init.d/rc from cd to the specifiec destination(/etc/init.d/rc)
0
 
jazzIIIloveCommented:
Tell me your progress please...
0
 
se_1581Author Commented:
everything else failed. i am trying with knoppix your solution right now
0
 
se_1581Author Commented:
Unbelievable... Knoppix doesn't load. it gets to Probing SCSI... eata.o and it stops.

Any ideas?
0
 
jazzIIIloveCommented:
0
 
jazzIIIloveCommented:
0
 
se_1581Author Commented:
the last post worked great. i'm loading knoppix  now
0
 
jazzIIIloveCommented:
yes?
0
 
se_1581Author Commented:
the fdisk command didn't, my knoppix is in german and from the translation it means /dev/sda could not be found
0
 
jazzIIIloveCommented:
<<the fdisk command didn't, my knoppix is in german and from the translation it means /dev/sda could
<<not be found

Haven't you got debian?

apply cat /proc/partitions please...
0
 
jazzIIIloveCommented:
oh sorry, can you open the system with live cd? right?
0
 
se_1581Author Commented:
I can open the system with live cd. i checked the permissions for /etc/init.d/rc. any other ideas?

Thanks.
0
 
jazzIIIloveCommented:
so, you open the system...you execute fdisk -l? cat /proc/partitions?
What about partitions? They are still intact?
0
 
jazzIIIloveCommented:
AFTER TRYING ABOVE COMMAND, if fails, boot the live cd, open a console and execute 'fdisk -l' that should give you an output like as snippet:

We are interested in the Linux partition on /dev/hda3 in snippet, yours may differ of course. Then execute:
#mkdir /mnt
#mount /dev/hda3 /mnt
#chmod -R 755 /mnt/etc

e.g.
    Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        3681    29567601    7  HPFS/NTFS
/dev/hda2            3682        3749      498015   82  Linux swap / Solaris
/dev/hda3            3750        8783    40435605   83  Linux
 
After that you can reboot without livecd and i got very stressed here....
0
 
se_1581Author Commented:
fdisk -l  will not work

cat /proc/partitions show my partitions. everything looks ok. i went through the files and they are ok.
0
 
jazzIIIloveCommented:
I am really really tired and stressed here...Please give any detail you encountered starting from your question and the process you take upto here...

For example:
have you installed Debian with SATA based RAID?
could you post here /etc/mkinitrd/mkinitrd.conf file

Now, i am going bed...

Best regards...
0
 
jazzIIIloveCommented:
ok..ok
0
 
jazzIIIloveCommented:
ok...now please check the permissions of the path...
0
 
jazzIIIloveCommented:
and change nothing post here the permissions...
0
 
Duncan RoeSoftware DeveloperCommented:
"Your Knoppix is in German"
Go back to the site. Click on the UK / US composite flag. Download an English-language one.
0
 
se_1581Author Commented:
i set the permission again

i also copied rc and rcS from live cd to the harddrive

because one of the partitions was at 99% full i deleted some files

...and still the same problem: cannot execute /etc.init.d/rc

any other ideas?

thanks
0
 
jazzIIIloveCommented:
my god...anythin you want to add as a comment...because let me say you are/were on the edge of losing your data...
!!!!!!First Please take a backup...!!!!!
Then: check this:
http://www.linuxmint.com/forum/viewtopic.php?f=46&t=17453
0
 
se_1581Author Commented:
i created a rc file from your link and i got the same error. Why can't be executed, the permissions are there?
0
 
Duncan RoeSoftware DeveloperCommented:
Post the contents of /etc/inittab. You need to discover how rc is invoked (e.g. rc 3, rc 5 &c. - or something different). Then bott with init=/bin/bash and try invoking it yourself - see what is the error
0
 
Duncan RoeSoftware DeveloperCommented:
bott - boot :(
0
 
se_1581Author Commented:
here is the inittab

how do i boot with init=bin/bash?
# /etc/inittab: init(8) configuration.
# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $
 
# The default runlevel.
id:2:initdefault:
 
# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
si::sysinit:/etc/init.d/rcS
 
# What to do in single-user mode.
~~:S:wait:/sbin/sulogin
 
# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.
 
l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin
 
# What to do when CTRL-ALT-DEL is pressed.
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
 
# Action on special keypress (ALT-UpArrow).
#kb::kbrequest:/bin/echo "Keyboard Request--edit /etc/inittab to let this work."
 
# What to do when the power fails/returns.
pf::powerwait:/etc/init.d/powerfail start
pn::powerfailnow:/etc/init.d/powerfail now
po::powerokwait:/etc/init.d/powerfail stop
 
# /sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
#  <id>:<runlevels>:<action>:<process>
#
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6
 
# Example how to put a getty on a serial line (for a terminal)
#
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100
 
# Example how to put a getty on a modem line.
#
#T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3

Open in new window

0
 
jazzIIIloveCommented:
Boot the system and select the normal boot menu from the list. Once selected, in the Boot Options box type

init=/bin/bash if you are using GRUB Boot loader

This will launch you straight into a Bash shell prompt which comes up even before the Single User mode loads and has the / root file system mounted.

Do a mount command to check if the root file system / is mounted as Read-Write. In my system, it indeed mounted as Read-Write.

0
 
se_1581Author Commented:
did you get the inittab, i posted a few post ago.

the error is this:

INIT: cannot execute "/etc/init.d/rcS"INIT: Entering runlevel: 2INIT: cannot execute "/etc/init.d/rc"Debian GNU/Linux 2.2 (none) ttys/0(none) login:

at this point it doesn't respond to anything.

now i am doing a backup, i will try tomorrow your suggestions.

thanks.
0
 
Duncan RoeConnect With a Mentor Software DeveloperCommented:
Yes your inittab is there - looks quite straightforward. The web page mentioned at http:#22726188 raises the huypothesis that perhaps shell scripts can't be executed because there is no /bin/bash, or maybe /bin/sh. In many distributions, sh is a symbolic link to bash.
How you boot with init=/bin/bash depends on which loader you have: the ones I know of are LILO and the legacy GRUB. With LILO, use the arrow keys to highlight the wanted kernel, hit space bar to get it on the prompt line, type "init=/bin/bash" and touch the Enter key. How you do it with GRUB I'm not sure - I haven't seen one for a long time but I think there's an option to append arguments.
If it turns out you no longer have /bin/bash, there are other shells which might be there: /bin/ksh or possibly /bin/pdksh gives you the Korn shell which is a Bourne-like shell having most of the features of bash. init=/bin/csh will get you the C shell, which is ... different. By the time you run out of possible shells, you are looking at a pretty badly damaged system. Unless sh exists, most scripts can't be executed because they start with the line "#!/bin/sh" which tells the operating system that the script is to be interpreted with the bin/sh shell. If you have bash but no sh, just re-make the symbolic link. If you have only ksh, make the symbolic link to that: ksh is a superset of sh but many programmers have gotten used to using bash extensions in /bin/sh scripts so YMMV.
0
 
se_1581Author Commented:
i cannot just say

grub edit>init=/bin/bash

it says unrecognized command.

what am i doing wrong?
0
 
se_1581Author Commented:
i tried to load as usual and I have some lines with the errors:

/bin/bash: No such file or directory

/bin/sh: no such file or directory

how do i restore the link? do i use live cd?

thanks.
0
 
se_1581Author Commented:
the bin folder is empty. is it ok to copy the files from knoppix?
0
 
se_1581Author Commented:
i copied all the bin files from another debian server and it started. now is doing a forced check on one of the drives.
0
 
jazzIIIloveCommented:
wow...so you solved it...When you copy it, it worked?
Please, write down each procedure, so other people may use this...

Far long thread here...
0
 
se_1581Author Commented:
I used the live cd to copy the files from the bin folder on the server. it worked, is running but is quite unstable. if a change the user to something else and come back to root it gives an error. mc is blocking from time to time but it works from command line. samba is working fine, apache is working. a re-installation will do the trick.

Thanks guys.
0
 
Duncan RoeSoftware DeveloperCommented:
You can expect instability if the binaries off the live CD were built for a newer version of glibc than you have. As you say - a reinstall will fix it.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.