Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running the following command on a 64 bit debian system.
chroot /xyz/abc update-rc.d ec2 start 2 3 4 5

I get "chroot: failed to run command `update-rc.d': Exec format error". I dont get this error when the command is executed on 32 bit system.

share|improve this question
Is update-rc.d a script or a program? – David Schwartz Nov 2 '12 at 23:30
update-rc.d is a command to install init scripts on the system. – user1060517 Nov 2 '12 at 23:33
Are you saying that you have a machine that can boot into either a 32-bit or a 64-bit version of the same OS? Or that your machine was loaded with the 32-bit version and you upgraded it to the 64-bit version? Or do you have two machines that are “identical” except for the OS? – Scott Nov 3 '12 at 0:47
Are you sure the 64-bit machine has a /xyz/abc/bin/update-rc.d file? (Or /xyz/abc concatenated with some other directory that’s in the search path.) If not, that’s your problem. If it exists, what happens if you try to run it directly, by the full pathname, without using chroot? (You might want to give it args that are unlikely to provoke it into actually doing anything; “–?” is probably safe.) – Scott Nov 3 '12 at 0:49
And, finally, the “dumb” question: is update-rc.d really a command name? Because the Unix/Linux convention is that names ending with “.d” are reserved for directories. Are you sure you don’t mean update-rc.d/ec2? – Scott Nov 3 '12 at 0:52

The update-rc.d is a perl script - you need to fix /usr/bin/perl in your chroot

share|improve this answer

So I figured out the problem, I was trying to run "chroot" on 64 bit system from a 32 bit machine. Mounting a 64bit FS on a 32 bit system worked, but chroot failed.

Works well if I do the same on the 64 bit FS. Thanks for all the answers.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .