0

I have been following these instruction on how to create a live CD of my current ubuntu 14.04 installation. When i try to runsudo chroot ${WORK}/rootfs /bin/bash where WORK=/some/dir/that/REALLY/exist

I get an error that bin/bash is not file or directory. I can ls /bin and i see a file called bash, but cant open it, telling me that it is not a text file(makes sense).

none@none-ubuntu:/$ sudo chroot ${WORK}/rootfs /bin/bash
chroot: failed to run command ‘/bin/bash’: No such file or directory

bash file is there since i can see it on ls

none@none-ubuntu:/$ ls /bin
bash                  fgconsole   nc                       sed
bunzip2               fgrep       nc.openbsd               setfacl
...(lot more files here)......

and since i was asked about the permissions

none@none-ubuntu:/$ ls -l /bin
total 9880
-rwxr-xr-x 1 root root 1017016 Απρ  24  2014 bash
-rwxr-xr-x 1 root root   31152 Οκτ  21  2013 bunzip2
-rwxr-xr-x 1 root root 1918032 Νοέ  14  2013 busybox

I have been looking around the web, but unfortunately using "no such file or directory" comes up with a lot of unrelated posts

edit:

none@none-ubuntu:/$ ls -l ${WORK}/rootfs/bin
total 9866
-rwxrwx--- 1 root vboxsf 1017016 Απρ  24  2014 bash
-rwxrwx--- 1 root vboxsf   31152 Οκτ  21  2013 bunzip2


 none@none-ubuntu:/$ ldd ${WORK}/rootfs/bin/bash
 linux-vdso.so.1 =>  (0x00007fff183fe000)
 libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f4569d8e000)
 libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4569b8a000)
 libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f45697c4000)
 /lib64/ld-linux-x86-64.so.2 (0x00007f4569fce000)

none@none-ubuntu:/$ ls -l ${WORK}/rootfs/lib
total 304
drwxrwx--- 1 root vboxsf     0 Ιούλ 23  2014 apparmor
drwxrwx--- 1 root vboxsf  8192 Ιούλ 23  2014 brltty
drwxrwx--- 1 root vboxsf     0 Ιούλ 23  2014 crda
drwxrwx--- 1 root vboxsf 36864 Ιούλ 23  2014 firmware
drwxrwx--- 1 root vboxsf     0 Ιούλ 23  2014 hdparm
drwxrwx--- 1 root vboxsf     0 Ιούλ 23  2014 ifupdown
drwxrwx--- 1 root vboxsf  4096 Ιούλ 23  2014 init
-rwxrwx--- 1 root vboxsf 71512 Δεκ  24  2013 klibc-P2s_k-gf23VtrGgO2_4pGkQgwMY.so
-rwxrwx--- 1 root vboxsf 27392 Ιαν   9  2014 libip4tc.so.0.1.0
-rwxrwx--- 1 root vboxsf 31520 Ιαν   9  2014 libip6tc.so.0.1.0
-rwxrwx--- 1 root vboxsf  5816 Ιαν   9  2014 libiptc.so.0.0.0
-rwxrwx--- 1 root vboxsf 47712 Ιαν   9  2014 libxtables.so.10.0.0
drwxrwx--- 1 root vboxsf     0 Ιούλ 23  2014 linux-sound-base
drwxrwx--- 1 root vboxsf     0 Ιούλ 23  2014 lsb
drwxrwx--- 1 root vboxsf     0 Απρ  10  2014 modprobe.d
drwxrwx--- 1 root vboxsf     0 Ιούλ 23  2014 modules
drwxrwx--- 1 root vboxsf     0 Ιούλ 23  2014 modules-load.d
drwxrwx--- 1 root vboxsf     0 Ιούλ 23  2014 plymouth
drwxrwx--- 1 root vboxsf     0 Ιούλ 23  2014 recovery-mode
drwxrwx--- 1 root vboxsf     0 Ιούλ 23  2014 resolvconf
drwxrwx--- 1 root vboxsf  4096 Ιούλ 23  2014 systemd
drwxrwx--- 1 root vboxsf  4096 Μάρ  22  2014 terminfo
drwxrwx--- 1 root vboxsf  4096 Ιούν  2 13:10 udev
drwxrwx--- 1 root vboxsf  4096 Ιούλ 23  2014 ufw
drwxrwx--- 1 root vboxsf 28672 Ιούν  7 22:08 x86_64-linux-gnu
drwxrwx--- 1 root vboxsf 24576 Ιούλ 23  2014 xtables

Update

Thank you all for the help and information provided. Unfortunately i could complete this task. It seems that the solution must have been the creation of a Virtual drive(as suggested by Germar). Did that and did the whole process from the beginning. but when i had to apt-get while chroot, i was getting errors saying that it cant connect to the ppa site. while trying to fix that with some things found on the internet, the VM stoped working and now doesnt boot at all! I guess that the best way to create a live cd from an installation of ubuntu on the hard drive is to actually have ubuntu on the hard drive and not on some VM.

Thanks again(not sure if i should delete this or not, but i will keep it for future reference)

  • 2
    The error says bin/bash, the correct path is /bin/bash .... – heemayl Jun 7 '15 at 21:00
  • @heemayl edit it. didnt copy paste the error, small typo. did try to execute it with out the slash anyway:) – Skaros Ilias Jun 7 '15 at 21:02
  • please edit your question and copy-paste the relevant commands and outputs (errors) from terminal..it would be easier to get the idea.. – heemayl Jun 7 '15 at 21:04
  • Well what about the permissions ? Did you ever change ownership of /bin/bash ? – Sergiy Kolodyazhnyy Jun 7 '15 at 21:08
  • @Serg no, but i do sudo, shouldn’t that be enough? – Skaros Ilias Jun 7 '15 at 21:22
2

errno codes sometimes aren't very specific. As well as possibly meaning that the specific file at hand (/bin/bash) doesn't exist, when executing a program "No such file or directory" (ENOENT) can also mean that its ELF interpreter doesn't exist, or that one of the shared libraries it needs doesn't exist. I suspect that /lib or /lib64 inside the chroot environment you're building is broken somehow, perhaps because symlinks are pointing to the wrong places.

Try ls -l $WORK/lib64/ld-linux-x86-64.so.2, and if it reports a symlink then try likewise for whatever the target of that symlink is except relative to $WORK (so if ls says that the link points to /lib/x86_64-linux-gnu/ld-2.19.so, then you'd run ls -l $WORK/lib/x86_64-linux-gnu/ld-2.19.so). Repeat for the various library paths under /lib listed in the output of ldd until you find the thing that's actually missing in the context of the chroot.

  • ls -l $WORK/lib64/ld-linux-x86-64.so.2 returned 'no such file or directory' .there is a lib64 folder but its empty. i ls the lib folder, will update the question – Skaros Ilias Jun 7 '15 at 23:03
  • There's no obvious reason for it to be empty given the rsync command in the original forums post you cited. You should look into why it apparently didn't get copied from your original system; perhaps repeating the rsync will help, or perhaps you used some slightly different set of options. – Colin Watson Jun 8 '15 at 15:00
  • I will first try to see if the use of virtual drive might solve the problem, and if it does not, i was planning to re do the whole procedure. Just bit busy with other projects right now, will try it as soon as i can – Skaros Ilias Jun 8 '15 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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