You are not logged in.

#1 2013-02-08 10:36:00

sjltaylor
Member
From: London
Registered: 2013-02-08
Posts: 4
Website

chroot command not found

I get the above error message and I don't understand why.
Steps to reproduce:

cd /
mkdir -p mydir/bin
cp -r /usr/bin/* /mydir/bin/

observe that this command:

/mydir/bin/bash

successfully gets us into a next shell. exit that shell

but here's the thing:

chroot /mydir /usr/bin/bash
 => chroot: failed to run command ‘/usr/bin/bash’: No such file or directory

why can't usr/bin/bash be found under /mydir when run with chroot?

Offline

#2 2013-02-08 10:56:12

valr
Member
From: Belgium
Registered: 2012-01-08
Posts: 62

Re: chroot command not found

Well, I don't remember by heart (and can't check now), but isn't the command relative to the new root directory ? So,

chroot /mydir /bin/bash

Offline

#3 2013-02-08 11:07:14

sjltaylor
Member
From: London
Registered: 2013-02-08
Posts: 4
Website

Re: chroot command not found

sorry, correction to the original post to include the /usr subtree

cd /
mkdir -p mydir/usr/bin
cp -r /usr/bin/* /mydir/usr/bin/

The problem remains

[ / ]# tree mydir
mydir
└── usr
    └── bin
        └── bash

[root /]# chroot /mydir /usr/bin/bash 
chroot: failed to run command ‘/usr/bin/bash’: No such file or directory

Last edited by sjltaylor (2013-02-08 11:13:55)

Offline

#4 2013-02-08 11:14:48

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,042

Re: chroot command not found

Yeah, but you copied everything into /mydir/bin.  /usr/bin/bash doesn't exist under the new root.

Edit: nevermind, you changed your post

Last edited by jakobcreutzfeldt (2013-02-08 11:15:10)

Offline

#5 2013-02-08 11:19:12

valr
Member
From: Belgium
Registered: 2012-01-08
Posts: 62

Re: chroot command not found

Okay, but what's /usr/bin/bash.
Arch is preparing the transition from /bin to /usr/bin iirc so is /usr/bin/bash a symlink to /bin/bash ?
In such a case, not visible from chroot.

Offline

#6 2013-02-08 11:32:21

sjltaylor
Member
From: London
Registered: 2013-02-08
Posts: 4
Website

Re: chroot command not found

 /bin/bash 

is a symlink to

/usr/bin/bash
[root /]# stat /usr/bin/bash
  File: ‘/usr/bin/bash’
  Size: 738008    	Blocks: 1456       IO Block: 4096   regular file
Device: ca00h/51712d	Inode: 32381       Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2013-02-07 21:10:42.000000000 +0000
Modify: 2013-01-27 00:22:36.000000000 +0000
Change: 2013-02-07 21:10:42.000000000 +0000
 Birth: -
[root /]# stat /bin/bash
  File: ‘/bin/bash’ -> ‘../usr/bin/bash’
  Size: 15        	Blocks: 0          IO Block: 4096   symbolic link
Device: ca00h/51712d	Inode: 26          Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2013-02-07 21:10:42.000000000 +0000
Modify: 2013-01-27 00:22:36.000000000 +0000
Change: 2013-02-07 21:10:42.000000000 +0000
 Birth: -

Offline

#7 2013-02-08 14:23:45

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: chroot command not found

You have no libraries and no linker to with which to invoke bash in your chroot.

Offline

#8 2013-02-08 15:19:19

sjltaylor
Member
From: London
Registered: 2013-02-08
Posts: 4
Website

Re: chroot command not found

how do I fix that?

Offline

#9 2013-02-08 17:54:10

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: chroot command not found

I suggest you use a tool like pacstrap to create a proper chroot.

Offline

Board footer

Powered by FluxBB