Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Running native i386 linux binaries

    Reply
    Page 8 of 20 | Prev |   6     7   8   9     10   18 | Next | Last
    Megaltariak | # 71 | 2010-11-23, 20:44 | Report

    The problem did not seem to be the chroot but the way that I use binfmt, it is strange because the commands

    mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
    echo ':i386:M::\x7fELF\x01\x00\x00\x00\x00\x00\x00\x00\ x00\x00\x00\x00\x02\x00\x03:\xff\xff\xff\xff\xff\x fe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff \xff:/home/user/qemu-i386:' >/proc/sys/fs/binfmt_misc/register

    did not return errors.
    What could be wrong here ?

    Edit: wait, the command

    echo ':i386:M::\x7fELF\x01\x00\x00\x00\x00\x00\x00\x00\ x00\x00\x00\x00\x02\x00\x03:\xff\xff\xff\xff\xff\x fe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff \xff:/home/user/qemu-i386:' >/proc/sys/fs/binfmt_misc/register

    don't prints on stderr but returns an error code of 1
    strace says:
    write(1, ":i386:M::\\x7fELF\\x01\\x00\\x00\\x00"..., 179) = -1 EINVAL (Invalid argument)

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by Megaltariak; 2010-11-23 at 21:17.

     
    Megaltariak | # 72 | 2010-11-23, 23:38 | Report

    Ok I got binfmt working by googling a bit about it and paste:
    Code:
    echo ":qemu-i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff\xff:/home/user/qemu-i386:" > /proc/sys/fs/binfmt_misc/register
    But now I have a problem with the chroot itself:

    Code:
    chroot ./
    chroot: cannot execute /bin/bash: No such file or directory
    
    file bin/bash
    bin/bash: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.8, dynamically linked (uses shared libs), stripped
    
    (On my PC):
    ldd /media/00558657-94dd-411e-9a75-b5ad64e5e8dc/bin/bash
    	libncurses.so.5 => /lib/libncurses.so.5 (0x00848000)
    	libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0x00432000)
    	libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x009dd000)
    	/lib/ld-linux.so.2 (0x0011a000)
    
    ls -l lib/libncurses.so.5 lib/tls/i686/cmov/libdl.so.2 lib/tls/i686/cmov/libc.so.6
    lrwxrwxrwx 1 root root 17 2010-11-07 18:06 lib/libncurses.so.5 -> libncurses.so.5.6
    lrwxrwxrwx 1 root root 14 2010-11-07 18:06 lib/tls/i686/cmov/libc.so.6 -> libc-2.8.90.so
    lrwxrwxrwx 1 root root 15 2010-11-07 18:06 lib/tls/i686/cmov/libdl.so.2 -> libdl-2.8.90.so
    All theses symlinks are valid so it is not a library problem.
    I can even chroot in this path with my PC with sshfs but not directly in my N900. (Only executables that use static library works on my N900)

    Edit | Forward | Quote | Quick Reply | Thanks

     
    TiagoTiago | # 73 | 2011-01-12, 13:33 | Report

    As soon as you guys manage to get some GUI programs, or at least some famous closed source binaries, running could you please start posting Youtube vids and stuff and linking here?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Applesaws | # 74 | 2011-03-07, 01:39 | Report

    I finally got binfmt to execute ld-linux.so.2 with qemu by using /x7fELF as the magic (instead of that whole long magic given in the tutorial) but now, it throws a no file or directory when I try chrooting (instead of an Exec format error). All the files exist, all the symlinks are valid, and executing bash outside of the chroot works. Anyone know why it's not working?
    Code:
    Nokia-N900:/.maewine# chroot .
    chroot: cannot execute /bin/sh: No such file or directory
    Nokia-N900:/.maewine# bin/sh
    /lib/ld-linux.so.2: No such file or directory
    Nokia-N900:/.maewine# file bin/sh
    bin/sh: symbolic link to `bash'
    Nokia-N900:/.maewine# file bin/bash
    bin/bash: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.15, dynamically linked (uses shared libs), stripped
    Nokia-N900:/.maewine# lib/ld-linux.so.2
    Usage: ld.so [OPTION]... EXECUTABLE-FILE [ARGS-FOR-PROGRAM...]
    <SNIP>
    Nokia-N900:/.maewine# lib/ld-linux.so.2 --library-path lib bin/bash
    Nokia-N900:/.maewine# ls
    bash: fork: Invalid argument
    Nokia-N900:/.maewine#

    Edit | Forward | Quote | Quick Reply | Thanks

     
    ZeNzO | # 75 | 2011-04-14, 16:15 | Report

    Just a quick question. How to run a native Linux i386 .bin app using qemu? I mean not windows so no wine is needed (I think).
    Any 'You're a real noob' tutorial? Please?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    azkay | # 76 | 2011-04-15, 01:06 | Report

    Originally Posted by damion View Post
    # HOWTO:

    # I've put hashes at the start of the line, so you could practically execute
    # This file and expect it to work to a degree.

    # bring up a terminal and from within /home/user (the default):

    wget http://a.trap.me.uk/qemu-i386
    chmod 755 ./qemu-i386

    # test it works

    ./qemu-i386

    # If this seems to output directions for use, this is working.

    sudo gainroot

    mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
    echo ':i386:M::\x7fELF\x01\x00\x00\x00\x00\x00\x00\x00\ x00\x00\x00\x00\x02\x00\x03:\xff\xff\xff\xff\xff\x fe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff \xff:/home/user/qemu-i386:' >/proc/sys/fs/binfmt_misc/register

    # Your phone can now execute arbitrary statically linked x86 binaries
    # or with some effort, (./ld-linux.so.2 --library-path `pwd` ./filename)
    # any x86 linux binary.

    # Set up the chroot with wine...

    # I tarred up /etc /usr/lib /usr/X11/lib /usr/X11/bin /usr/bin /lib /bin /sbin
    # from (it turns out) an old slackware 10.2 install that had had wine
    # installed at some point in the past, ~version 0.9.14.

    # extract the chroot in to /chroot (or wherever you want that has space)
    # ... actually DON'T use rootfs space, but I'll use /chroot for ease of
    # writing this.

    # as root

    cd /chroot
    mkdir -p proc dev tmp/.X11-unix
    chmod 777 tmp && chmod +t tmp
    # I can't remember the octal for sticky in one go

    # copy the phone's /dev, something like:

    tar cf blah.tar /dev && tar xf blah.tar

    # by default tar strips the leading / so this probably works.

    mount -o bind /tmp/.X11-unix tmp/.X11-unix
    mount -t proc none proc
    mount -t devpts dev/pts

    vi etc/mtab etc/passwd

    # ... edit to suit your needs. mtab should be small with mainly just /
    # referenced, in passwd put a user:29999 account

    # TEST full x86 chroot!!!

    chroot /chroot

    # You should see: bash-2.0# Or similar, and stuff like ls should work!

    su - user

    export DISPLAY=:0

    /usr/X11/bin/xterm

    # Oh I needed a symblink for X11 to X11R6 too, I also think I edited
    # /etc/ld.so.conf to contain X libs, also I lack terminal definition files
    # from that list of directories so I can't do some curses stuff.

    # After your success running xterm as x86, which itself fork()ed bash
    # again and showed a pretty impressive speed, you're 95% of the way
    # there.

    # Copy existing known .wine/ hierarchy ??? I think I happened to have
    # one in /home/damion from where I nabbed the x86 chroot stuff.

    # Then...

    wine-pthread ./sol.exe

    # Obviously you'll need sol.exe from XP or something and obviously you
    # can use whatever wine stuff you need, not just sol You need
    # wine-pthread, wine on its own segvs for me. I used to run wineserver
    # 1st, but wine-pthread can successfully fork wineserver within this
    # chroot without issue for me.

    # Profit.
    # I tarred up /etc /usr/lib /usr/X11/lib /usr/X11/bin /usr/bin /lib /bin /sbin
    # from (it turns out) an old slackware 10.2 install that had had wine
    # installed at some point in the past, ~version 0.9.14.

    # extract the chroot in to /chroot (or wherever you want that has space)
    # ... actually DON'T use rootfs space, but I'll use /chroot for ease of
    # writing this.

    I tar those from another system, then what? Where to I extract them? Whats the chroot? Where doesnt use rootfs space?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    azkay | # 77 | 2011-04-16, 05:16 | Report

    Code:
    Nokia-N900:/opt/chroot# chroot .                                                chroot: cannot execute /bin/sh: Exec format error
    Anyone?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    damion | # 78 | 2011-06-02, 12:22 | Report

    I'll run through my post again to confirm

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Graham Cobb | # 79 | 2011-06-03, 12:09 | Report

    Originally Posted by azkay View Post
    Code:
    Nokia-N900:/opt/chroot# chroot .                                                chroot: cannot execute /bin/sh: Exec format error
    Anyone?
    That error tells you there is something wrong with the value you put in /proc/sys/fs/binfmt_misc/register.

    I have not done this myself so I don't know if damion's instructions are correct but double check you did the mount command and the echo command correctly, and check that you actually have qemu-i386 at /home/user/qemu-i386 and it is executable.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    damion | # 80 | 2011-06-07, 12:12 | Report

    Having just cut and pasted from the above include, I can see spaces where there shouldn't be any between the single quotes in that echo line. Make sure when that line runs you don't have spaces.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to damion For This Useful Post:
    mece

     
    Page 8 of 20 | Prev |   6     7   8   9     10   18 | Next | Last
vBulletin® Version 3.8.8
Normal Logout