<p>I have read many links similar to my issue, but none of them were helping me to resolve the issue.</p>
<p><strong>Similar Links</strong>:</p>
<ol>
<li><a href="https://github.com/containerd/containerd/issues/7219" rel="noreferrer">Failed to exec into the container due to permission issue after executing 'systemctl daemon-reload'</a></li>
<li><a href="https://github.com/opencontainers/runc/issues/3551" rel="noreferrer">OCI runtime exec failed: exec failed: unable to start container process: open /dev/pts/0: operation not permitted: unknown</a></li>
<li><a href="https://stackoverflow.com/questions/73379718/ci-runtime-exec-failed-exec-failed-unable-to-start-container-process-open-de">CI runtime exec failed: exec failed: unable to start container process: open /dev/pts/0: operation not permitted: unknown</a></li>
<li><a href="https://github.com/moby/moby/issues/43969" rel="noreferrer">OCI runtime exec failed: exec failed: unable to start container process: open /dev/pts/0: operation not permitted: unknown</a></li>
<li><a href="https://bbs.archlinux.org/viewtopic.php?id=277995" rel="noreferrer">Fail to execute docker exec</a></li>
<li><a href="https://github.com/docker/for-linux/issues/246" rel="noreferrer">OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused &quot;open /proc/self/fd: no such file or directory&quot;: unknown</a></li>
</ol>
<p><strong>Problem Description</strong>:</p>
<p>I have created a new Kubernetes cluster using <code>Kubespray</code>. When I wanted to execute some commands in one of containers I faced to the following error:</p>
<h6>Executed Command</h6>
<pre class="lang-bash prettyprint-override"><code>kubectl exec -it -n rook-ceph rook-ceph-tools-68d847b88d-7kw2v -- sh
</code></pre>
<h6>Error:</h6>
<blockquote>
<p>OCI runtime exec failed: exec failed: unable to start container process: open /dev/pts/1: operation not permitted: unknown
command terminated with exit code 126</p>
</blockquote>
<p>I have also logged in to the node, which runs the pod, and try executing the container using <code>docker exec</code> command, but the error was not changed.</p>
<p><strong>Workarounds</strong>:</p>
<ul>
<li><p>As I have found, the error code (126) implies that the permissions are insufficient, but I haven't faced this kind of error (like executing <code>sh</code>) in Docker or Kubernetes.</p>
</li>
<li><p>I have also checked whether <code>SELinux</code> is enabled or not (as it has been said in the 3rd link).</p>
<pre class="lang-bash prettyprint-override"><code>apt install policycoreutils
sestatus
# Output
SELinux status:                 disabled
</code></pre>
</li>
<li><p>In the 5th link, it was said to check whether you have updated the kernel, and I didn't upgrade anything on the nodes.</p>
<pre class="lang-bash prettyprint-override"><code>id; stat /dev/pts/0
# output
uid=0(root) gid=0(root) groups=0(root)
  File: /dev/pts/0
  Size: 0               Blocks: 0          IO Block: 1024   character special file
Device: 18h/24d Inode: 3           Links: 1     Device type: 88,0
Access: (0600/crw-------)  Uid: (    0/    root)   Gid: (    5/     tty)
Access: 2022-08-21 12:01:25.409456443 +0000
Modify: 2022-08-21 12:01:25.409456443 +0000
Change: 2022-08-21 11:54:47.474457646 +0000
 Birth: -
</code></pre>
</li>
<li><p>Also tried <code>/bin/sh</code> instead of <code>sh</code> or <code>/bin/bash</code>, but not worked and the same error occurred.</p>
</li>
</ul>
<p>Can anyone help me to find the root cause of this problem and then solve it?</p>

Mostafa Ghadimi
<p>This issue may relate to docker, first drain your node.</p>
<pre><code>kubectl drain &lt;node-name&gt;
</code></pre>
<p>Second, SSH to the node and restart docker service.</p>
<pre><code>systemctl restart docker.service
</code></pre>
<p>At the end try to execute your command.</p>
