Solved

Cannot execute init.d/rc

Posted on 2008-10-14
50
1,963 Views
Last Modified: 2013-12-16
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.
0
Comment
Question by:se_1581
  • 26
  • 18
  • 6
50 Comments
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22715568
Hi there;

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

Best regards...
0
 

Author Comment

by:se_1581
ID: 22715626
I cannot login on the server anymore. how do I do that?
Thanks.
0
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22715765
???
what command you executed?
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22715775
well, have you given execution permission to /etc/init.d/rc?
0
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22715790
#chmod -R 755 /etc
0
 

Author Comment

by:se_1581
ID: 22715801
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
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22715813
i was about to write don't boot!
0
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22715821
Then, now,reboot into the recovery mode and run the command above...
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 22715834
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
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22715846
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
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22715884
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
 

Author Comment

by:se_1581
ID: 22715944
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
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22715986
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
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22716014
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
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22716108
Tell me your progress please...
0
 

Author Comment

by:se_1581
ID: 22716118
everything else failed. i am trying with knoppix your solution right now
0
 

Author Comment

by:se_1581
ID: 22716212
Unbelievable... Knoppix doesn't load. it gets to Probing SCSI... eata.o and it stops.

Any ideas?
0
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22716261
0
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22716339
0
 

Author Comment

by:se_1581
ID: 22716431
the last post worked great. i'm loading knoppix  now
0
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22716583
yes?
0
 

Author Comment

by:se_1581
ID: 22716639
the fdisk command didn't, my knoppix is in german and from the translation it means /dev/sda could not be found
0
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22716874
<<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
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22716885
oh sorry, can you open the system with live cd? right?
0
 

Author Comment

by:se_1581
ID: 22716935
I can open the system with live cd. i checked the permissions for /etc/init.d/rc. any other ideas?

Thanks.
0
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22717029
so, you open the system...you execute fdisk -l? cat /proc/partitions?
What about partitions? They are still intact?
0
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22717047
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
 

Author Comment

by:se_1581
ID: 22717048
fdisk -l  will not work

cat /proc/partitions show my partitions. everything looks ok. i went through the files and they are ok.
0
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22717068
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
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22717073
ok..ok
0
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22717075
ok...now please check the permissions of the path...
0
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22717079
and change nothing post here the permissions...
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 22719441
"Your Knoppix is in German"
Go back to the site. Click on the UK / US composite flag. Download an English-language one.
0
 

Author Comment

by:se_1581
ID: 22721993
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
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22723637
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
 

Author Comment

by:se_1581
ID: 22724325
i created a rc file from your link and i got the same error. Why can't be executed, the permissions are there?
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 22725744
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
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 22725753
bott - boot :(
0
 

Author Comment

by:se_1581
ID: 22726136
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
 
LVL 12

Accepted Solution

by:
jazzIIIlove earned 300 total points
ID: 22726188
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
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22726397
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
 

Author Comment

by:se_1581
ID: 22726717
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
 
LVL 34

Assisted Solution

by:Duncan Roe
Duncan Roe earned 200 total points
ID: 22729150
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
 

Author Comment

by:se_1581
ID: 22730686
i cannot just say

grub edit>init=/bin/bash

it says unrecognized command.

what am i doing wrong?
0
 

Author Comment

by:se_1581
ID: 22730724
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
 

Author Comment

by:se_1581
ID: 22730955
the bin folder is empty. is it ok to copy the files from knoppix?
0
 

Author Comment

by:se_1581
ID: 22731698
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
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22739998
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
 

Author Comment

by:se_1581
ID: 22741116
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
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 22747495
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

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question