Hide Forgot
Description of problem: `oc debug node/nodename — chroot /host somecommand` should exit with non-zero when the sub-command failed Version-Release number of selected component (if applicable): Client Version: 4.11.0-202204122151.p0.ge88515d.assembly.stream-e88515d How reproducible: Always Steps to Reproduce: Run command : `oc debug node/ip-10-0-52-208.us-east-2.compute.internal -- chroot /host datest` Actual results: 1. Sub command failed , but check the exit code is sitll 0: oc debug node/ip-xxxxx.compute.internal -- chroot /host datest Starting pod/ip-xxxxx.computeinternal-debug ... To use host binaries, run `chroot /host` chroot: failed to run command 'datest': No such file or directory Removing debug pod ... [root@localhost ~]# echo $? 0 Expected results: When the sub command failed , the exit code should non-zero Additional info:
Similar invocation but with oc rsh will indeed return non-zero exit code, so we should ensure both work similar.
checked with latest oc, the issue has fixed: oc debug node/yinzhou-0426-gstwh-master-0 -- chroot /host datest Warning: would violate PodSecurity "restricted:latest": host namespaces (hostNetwork=true, hostPID=true), hostPath volumes (volume "host"), privileged (container "container-00" must not set securityContext.privileged=true), allowPrivilegeEscalation != false (container "container-00" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "container-00" must set securityContext.capabilities.drop=["ALL"]), restricted volume types (volume "host" uses restricted volume type "hostPath"), runAsNonRoot != true (pod or container "container-00" must set securityContext.runAsNonRoot=true), runAsUser=0 (container "container-00" must not set runAsUser=0), seccompProfile (pod or container "container-00" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost") Starting pod/yinzhou-0426-gstwh-master-0-debug ... To use host binaries, run `chroot /host` chroot: failed to run command 'datest': No such file or directory Removing debug pod ... error: non-zero exit code from debug container [root@localhost ~]# echo $? 1 oc version --client Client Version: 4.11.0-202204260818.p0.g5c77c00.assembly.stream-5c77c00 Kustomize Version: v4.5.4
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Important: OpenShift Container Platform 4.11.0 bug fix and security update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2022:5069