I\'m experimenting with linux namespaces. Specifically the pid namespace.
I thought I\'d test something out with bash but run into this problem:
uns
This does not explain why this happens, but shows how to correctly launch a shell in a new pid namespace:
Use the -f flag to fork off the shell from unshare:
unshare -fp /bin/bash
You also need to pass the --mount-proc option to ensure that the shell will get PID 1 in the newly created namespace:
unshare -fp --mount-proc /bin/bash
Now run ps:
# ps
PID TTY TIME CMD
1 pts/1 00:00:00 bash
11 pts/1 00:00:00 ps