bullno1 / hako

A minimal sandboxing tool
BSD 2-Clause "Simplified" License
10 stars 0 forks source link

execve("/bin/sh") failed: No such file or directory #1

Open biopsin opened 3 years ago

biopsin commented 3 years ago

Hi, was just browsing around and got curious.. But no matter what I try it's always the same issue.

execve("/bin/sh") failed: No such file or directory

Followed and also tried the example, I'm using toybox, but that should not matter.)

bullno1 commented 3 years ago

Can you give a detailed step-by-step instruction of how to reproduce this problem?

biopsin commented 3 years ago

I follow the usage https://github.com/bullno1/hako#creating-a-sandbox exactly, where I do diviate is in the init file where I substitute busybox with toybox and I exec hako-run as doas instead of sudo for the mount to happen, thats it.. (Edit: I also get same issue using busybox)

bullno1 commented 3 years ago

Is your toybox statically linked?

"No such file or directory" just means the file could not be found.

Can you create a VM image of your environment?

Alternatively, an strace -f of the hako-run command would help.

biopsin commented 3 years ago

Tested both dynamic and the attached trace is against static. Seems it's not mounting, even the init file has 755 bit set, checking with mount after. trace file @ https://tknk.io/CEGS (link expires in one month)

bullno1 commented 3 years ago

I notice this:

[pid 5108] mount("none", "/media/store/Tmp/sandbox/bin/toybox", NULL, MS_RDONLY|MS_REMOUNT|MS_BIND, NULL) = 0

What is the exact content of your init script?

biopsin commented 3 years ago
#!/bin/sh -e
mount -o ro,bind /media/store/Tmp/toybox-x86_64 ./bin/toybox
bullno1 commented 3 years ago

Where did you get your toybox? I tried using the one from here http://landley.net/toybox/bin/toybox-x86_64, and it works fine. See https://github.com/bullno1/hako/tree/toybox.

cd sandbox
sudo ./start

You will get a toybox shell. Most commands don't seem to work well in that shell though, could be something with toybox itself. You can also run busybox with: sudo ./start /bin/busybox sh.

biopsin commented 3 years ago

Yes the same, static binary from https://landley.net/toybox/bin/ , while the shared installed using voidlinux. I will test again this weekend and see if I figure out what the issue is at my end. Thank you for your time testing it on your end, I'll close this issue after I make it or not as it's a user error on my part somewhere.