Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
show 4 more comments

2 Answers

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

share|improve this answer
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.