can't exec /bin/sh for /etc/rc: no such file or directory

Hello guys,

I own a VPS and I had a problem with it. I type in ee /etc/rc.conf" and it said
Code:
command ee doesn't exist
or something like that. Even the command to start mysql didn't work. I typed reboot and after that I waited like 10 minutes and saw that my VPS didn't start. I logged into my control panel and I saw the error
Code:
can't exec /bin/sh for /etc/rc: no such file or directory
.

ed8fb.png


P.S: I sent a ticket to my hosting company and they said that they don't offer support for FreeBSD.
 
Re: can't exec /bin/sh for /etc/rc: no such file or director

Is there anything in /etc/? Maybe it is not mounted, or even deleted.
 
Re: can't exec /bin/sh for /etc/rc: no such file or director

I booted it with single user , and i got in my console :
Enter full pathname of shell or RETURN for /bin/sh:
 
Re: can't exec /bin/sh for /etc/rc: no such file or director

Is it mounting the correct root filesystem? Are you sure it's /dev/vtbd0p2?

Try dropping to the loader prompt and getting a listing of devices (I think ? will show the list of commands, and there's a list devices command in there). Then set the mountroot option to a different device. Guessing there will be at least a /dev/vtbd0p1 that you can try.
 
Re: can't exec /bin/sh for /etc/rc: no such file or director

Sorry, but how I do that? :D
P.S: You mean booting in loader prompter mode, and then lsdev and set currdev=device?
 
Re: can't exec /bin/sh for /etc/rc: no such file or director

That's a good sign. Now look in /etc with ls /etc. If there are files in there, does /etc/rc exist?
 
Re: can't exec /bin/sh for /etc/rc: no such file or director

phoenix said:
Is it mounting the correct root filesystem? Are you sure it's /dev/vtbd0p2?

Try dropping to the loader prompt and getting a listing of devices (I think ? will show the list of commands, and there's a list devices command in there). Then set the mountroot option to a different device. Guessing there will be at least a /dev/vtbd0p1 that you can try.

p1 is usually the bootcode partition.
 
Re: can't exec /bin/sh for /etc/rc: no such file or director

wblock@ said:
That's a good sign. Now look in /etc with ls /etc. If there are files in there, does /etc/rc exist?

I typed ls /etc and I got an error:
Code:
can't exec ls /etc for single user: No such file or directory
can't exec /bin/sh for single user: No such file or directory

That's the same error when I type for example cd /etc in normal booting mode .
 
Re: can't exec /bin/sh for /etc/rc: no such file or director

That's an odd error message. Wait, when it said Enter full pathname of shell or RETURN for /bin/sh:, did you press Enter? Do that first, then it should go into a root shell. Then try ls.
 
Re: can't exec /bin/sh for /etc/rc: no such file or director

wblock@ said:
That's an odd error message. Wait, when it said Enter full pathname of shell or RETURN for /bin/sh:, did you press Enter? Do that first, then it should go into a root shell. Then try ls.
I pressed returned and typed ls and after 40 seconds it said
Code:
can't exec /bin.sh for /etc/rc: No such file or directory
and after another 30 seconds it said
Code:
Enter full pathname of shell or RETURN for /bin/sh:
 
Re: can't exec /bin/sh for /etc/rc: no such file or director

That's not good. Any chance you have backups?
 
Re: can't exec /bin/sh for /etc/rc: no such file or director

No .. I want backup on my MySQL but I think no chance to get it. And how did this problem happen? From what?

P.S: Do I have a chance to get a backup from my MySQL?
 
Re: can't exec /bin/sh for /etc/rc: no such file or director

@phoenix's suggestion to look at the partition layout is worthwhile. A physical machine could be booted from a CD or USB stick. With a VPS, it probably depends on what the provider offers.
 
Last edited by a moderator:
Re: can't exec /bin/sh for /etc/rc: no such file or director

wblock@ said:
Is there anything in /etc/? Maybe it is not mounted, or even deleted.
Out of curiosity: how would you boot a system with a mount-on /etc anyway? Is that possible in any(sane) way?

And one possible solution for the OP: if the syetem is destroyed beyond repair, you may be able to reclaim your database by doing a new install and be extra careful not to format the partition that database was on, do not do a newfs on these. Simply extract the installation archives again, and you may be able to reboot the system to a point where you can reclaim the database. And back it up at once. I had to do something like this once, it worked then, but I do not know if it will today. So if you have reached the point that you want to give up and re-install, there is this (maybe slim) chance to get the machine going again, even when you cannot boot it from USB or DVD rescue mediums.

Or you can kindly ask the provider of the VPS if you can obtain a dd dump of the disk image on a drive you send them. Some do this, and I would wager that a add-on in beverages may help you in this (as - send some SD cards for storage and some nice scotch. That would work on me.
 
Re: can't exec /bin/sh for /etc/rc: no such file or director

SirFulgeruL said:
And how did this problem happend ? From what ?
Even the VPS servers can have faulty disk drives, and even failing mirrors. There were cases like this in the last month, one of my favorite podcasters had to restore a lot of stuff because the mirror in distribution machine failed like that, and quietly too.

But that would maybe some add-on to the loader concept of FreeBSD. Browsing file systems from the loader is nice, now we need some netcat build in so a rescue of files can be done from the loader.
 
Re: can't exec /bin/sh for /etc/rc: no such file or director

@Crivens: you're right, it's probably not possible to boot without /etc being present for fstab.

As far as adding to the loader, I'd rather just boot into mfsBSD. When the original system is having major problems, best to use a separate system to check it. Come to think of it, mfsBSD could be one of the best reasons to justify multiboot in the present era. I have it on my PXE server for the same kind of availability.
 
Last edited by a moderator:
Re: can't exec /bin/sh for /etc/rc: no such file or director

Thanks guys for your help . I decided to reinstall my Dedicat server. .
 
Re: can't exec /bin/sh for /etc/rc: no such file or director

Remember, if you can skip the format operation, the file could be recovered.
 
Back
Top