Link to home
Start Free TrialLog in
Avatar of se_1581
se_1581

asked on

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.
Avatar of jazzIIIlove
jazzIIIlove
Flag of Sweden image

Hi there;

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

Best regards...
Avatar of se_1581
se_1581

ASKER

I cannot login on the server anymore. how do I do that?
Thanks.
???
what command you executed?
well, have you given execution permission to /etc/init.d/rc?
#chmod -R 755 /etc
Avatar of se_1581

ASKER

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.
i was about to write don't boot!
Then, now,reboot into the recovery mode and run the command above...
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
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

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...
Avatar of se_1581

ASKER

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
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:......
.....


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)
Tell me your progress please...
Avatar of se_1581

ASKER

everything else failed. i am trying with knoppix your solution right now
Avatar of se_1581

ASKER

Unbelievable... Knoppix doesn't load. it gets to Probing SCSI... eata.o and it stops.

Any ideas?
Avatar of se_1581

ASKER

the last post worked great. i'm loading knoppix  now
Avatar of se_1581

ASKER

the fdisk command didn't, my knoppix is in german and from the translation it means /dev/sda could not be found
<<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...
oh sorry, can you open the system with live cd? right?
Avatar of se_1581

ASKER

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

Thanks.
so, you open the system...you execute fdisk -l? cat /proc/partitions?
What about partitions? They are still intact?
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....
Avatar of se_1581

ASKER

fdisk -l  will not work

cat /proc/partitions show my partitions. everything looks ok. i went through the files and they are ok.
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...
ok..ok
ok...now please check the permissions of the path...
and change nothing post here the permissions...
"Your Knoppix is in German"
Go back to the site. Click on the UK / US composite flag. Download an English-language one.
Avatar of se_1581

ASKER

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
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
Avatar of se_1581

ASKER

i created a rc file from your link and i got the same error. Why can't be executed, the permissions are there?
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
bott - boot :(
Avatar of se_1581

ASKER

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

ASKER CERTIFIED SOLUTION
Avatar of jazzIIIlove
jazzIIIlove
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.

Avatar of se_1581

ASKER

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.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of se_1581

ASKER

i cannot just say

grub edit>init=/bin/bash

it says unrecognized command.

what am i doing wrong?
Avatar of se_1581

ASKER

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.
Avatar of se_1581

ASKER

the bin folder is empty. is it ok to copy the files from knoppix?
Avatar of se_1581

ASKER

i copied all the bin files from another debian server and it started. now is doing a forced check on one of the drives.
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...
Avatar of se_1581

ASKER

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.
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.