Results 1 to 4 of 4

Thread: Mono C# In chroot

  1. #1
    Join Date
    Aug 2011
    Beans
    3

    Question Mono C# In chroot

    Hello,

    I 'd like to run some C# programs in a chroot. I copied the following inside my jail

    • My program (program.exe)
    • /bin/sh and libraries found by ldd
    • /bin/bash and libraries found by ldd
    • /usr/bin/mono
    • /usr/lib/mono


    When I try to run my program like this:
    Code:
    sudo chroot jail ./program.exe
    , I get the error message that this program does not exist. Mono C# does not do Dynamic Linking, so I cannot find the libraries on which my program depends, by using ldd. Could you please help me with that?

    Thanks

  2. #2
    Join Date
    May 2005
    Location
    Malvern, UK
    Beans
    246
    Distro
    Ubuntu

    Re: Mono C# In chroot

    A mono-created program relies upon the .NET framework being present. Also, by default Ubuntu won't know what to do with the program.exe file - you'd need to run it as "mono ./program.exe" - which, if you're running it from a chroot jail, might be tricky.

  3. #3
    Join Date
    Oct 2006
    Location
    /dev/null
    Beans
    1,574
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Mono C# In chroot

    Quote Originally Posted by Paris.K View Post
    Hello,

    I 'd like to run some C# programs in a chroot. I copied the following inside my jail

    • My program (program.exe)
    • /bin/sh and libraries found by ldd
    • /bin/bash and libraries found by ldd
    • /usr/bin/mono
    • /usr/lib/mono


    When I try to run my program like this:
    Code:
    sudo chroot jail ./program.exe
    , I get the error message that this program does not exist. Mono C# does not do Dynamic Linking, so I cannot find the libraries on which my program depends, by using ldd. Could you please help me with that?

    Thanks
    running Mono executables directly, as "./program.exe" (rather than as "mono program.exe") requires that /proc be mounted, and that the binfmt_misc kernel module be loaded, and that binfmt_misc be mounted to /proc/sys/fs/binfmt_misc, and that ':CLR:M::MZ::/usr/bin/mono:' be echoed into /proc/sys/fs/binfmt_misc/register

    It's automated by the binfmt-support package

    And I'd certainly not consider doing it inside a chroot. The Mono app deployment guidelines strongly caution against using "./foo.exe" rather than "mono foo.exe" precisely because it causes this kind of problem.
    Understanding is a three-edged sword: Your side, their side, and the truth

  4. #4
    Join Date
    Aug 2011
    Beans
    3

    Re: Mono C# In chroot

    I tried running the program in chroot like
    Code:
    mono Program.exe
    and it still needed /proc to be mounted. I did mount it and the new errors showed u. I finally got bored and quit

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •