Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nsenter: cannot open /proc/1/ns/cgroup: No such file or directory #2

Open
fabianbaier opened this issue Sep 17, 2019 · 5 comments
Open

Comments

@fabianbaier
Copy link

Hi,

I am getting nsenter: cannot open /proc/1/ns/cgroup: No such file or directory when following your steps.

Any idea why?

@wangdehu
Copy link

wsl?

@lweingart
Copy link

lweingart commented Dec 2, 2020

Yes, same issue with WSL.
My WSL Kali doesn't start anymore, with this error:
nsenter: cannot open /proc/20/ns/time: No such file or directory

Any idea as to why?

@ewoutvonk
Copy link

ewoutvonk commented Dec 3, 2020

I had a similar issue, I need the nsenter solution so I can inspect blockdevices on the k8s node.

Trying this on a recent kubernetes version on EKS, error message:

nsenter: cannot open /proc/1/ns/time: No such file or directory

Not exactly sure why it happens, but probably related to time namespaces not being available in the host kernel (https://man7.org/linux/man-pages/man1/nsenter.1.html).

So the script runs this command: "/nsenter", "--all", "--target=1", "--", "su", "-"

This is actually shorthand for: "/nsenter", "-m", "-u", "-i", "-n", "-p", "-C", "-U", "-T", "-r", "-w", "--target=1", "--", "su", "-"

The error above is caused the -T option, remove it if your kernel apparently does not support time namespaces (https://www.man7.org/linux/man-pages/man7/time_namespaces.7.html); not needed in my case anyway.

In my case, this triggered the next error:

nsenter: reassociate to namespace 'ns/user' failed: Invalid argument

This error is caused by -U (https://www.man7.org/linux/man-pages/man7/user_namespaces.7.html). Remove the option to get rid of the error and get a shell on the k8s node (at least in my case).

The -U is also probably not needed, as we're running a privileged pod, and nsenter drops to UID 0 and GID 0 by default (if I read the manpage correctly), and I'm able to run fdisk -l and lsblk as needed.

Edit: for the original issue (nsenter: cannot open /proc/1/ns/cgroup: No such file or directory), you would need to drop the option -C, probably because your host kernel does not support cgroup namespaces. I read somewhere that the default kernel on CentOS might not have it built in by default.

@bobbbay
Copy link

bobbbay commented May 26, 2021

wsl --shutdown
wsl

Fixed the problem for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@ewoutvonk @lweingart @fabianbaier @wangdehu @bobbbay and others