[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Chrooting an emulated binary?
Put a shell in the chroot area. Put some utils
(ktrace/truss, etc). These are TEMPORARY.
Now chroot into it with the shell.
chroot PATH /bin/sh
now try to start your program.
When/if you get it working, REMOVE the shell and utils you
no longer need.
It's just easier to debug interactively.
Quoting C. Bensend (benny@bennyvision.com):
> Hey folks,
>
> I have set up linux emulation on 3.3-STABLE as of May 23rd. It
> works perfectly - my Neverwinter Nights server comes up just fine. Yes,
> I'm an addict. :)
>
> However, since this machine is going out into the untamed wilderness
> eventually, I'd like to be able to chroot the server. I don't run it
> unattended (only when we fire up a gaming night), and I know that since there
> are shells in /usr/local/emul/redhat the point is mostly moot. I'm aware
> that there isn't a lot of benefit. It's become more of a "I wonder if I can"
> sort of thing.
>
> So, using chrootuid from the ports tree, I try to fire it up:
>
> chrootuid /usr/local/emul/redhat nwn /home/nwn/start-nwn
> Segmentation fault
>
> 'start-nwn' is just a simple sh script that sets all my options
> before firing up the server. OK, so I get a segfault. Taking a look at
> the ktrace (only the last few lines shown, full dump on request):
>
> 3777 chrootuid NAMI "/home/nwn/start-nwn"
> 3777 chrootuid NAMI "/bin/sh"
> 3777 chrootuid NAMI "/emul/svr4/lib/ld-linux.so.2"
> 3777 chrootuid NAMI "/emul/linux/lib/ld-linux.so.2"
> 3777 bash NAMI "/lib/ld-linux.so.2"
> 3777 bash EMUL "native"
> 3777 bash RET execve 0
> 3777 bash CALL getuid
> 3777 bash RET getuid 1009/0x3f1
> 3777 bash CALL getgid
> 3777 bash RET getgid 1009/0x3f1
> 3777 bash CALL getlogin(0x480a28cc,0xcfbfd414)
> 3777 bash RET getlogin 0
> 3777 bash CALL setlogin(0x480a28cc)
> 3777 bash RET setlogin -1 errno 1 Operation not permitted
> 3777 bash CALL ktrace(0xcfbfd1e4,0x4809b7f0,0,0x480a28cc)
> 3777 bash RET ktrace -1 errno 2 No such file or directory
> 3777 bash PSIG SIGSEGV SIG_DFL code 1 addr=0x0 trapno=1
> 3777 bash PSIG SIGSEGV SIG_DFL code 0 addr=0x0 trapno=0
> 3777 bash NAMI "bash.core"
>
> Could someone a little more familiar with chroot processes and/or
> linux emulation interpret the last dozen or so lines? I understand that
> it's bash that's dying (the user nwn's shell), but I'm not really sure
> why. Limitation of the bash in the linux stuff, perhaps?
>
> Running the start-nwn script as user nwn non-chrooted works fine.
>
> Thanks for any tips/tricks/cluebats,
>
> Benny
>
>
> --
>
> God is dead and I don't feel all too well either.... -- Ralph Moonen