<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 05/22/2013 05:24 AM, Csisz&aacute;r Tam&aacute;s
      wrote:<br>
    </div>
    <blockquote cite="mid:519CB8E3.2010604@virtual-call-center.eu"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      Hi,<br>
      <br>
      I have a strange error on one of our servers when I use vzctl.
      There's a running host with a few VE-s and if I type <i>vzctl
        enter "CTID"</i> then I receive <i>enter into CT "CTID" failed</i>
      and no further messages. After a lot of debugging I realized that
      it works if I directly connect via the server's console, but if I
      login via ssh it gives the error.<br>
      The system parameters:<br>
      OS: CentOS release 6.4<br>
      Kernel: Linux vm4 2.6.32-042stab078.10 #1 SMP Wed May 8 19:45:03
      MSK 2013 x86_64 x86_64 x86_64 GNU/Linux&nbsp; <br>
      vzctl: vzctl-core-4.2-1.el6.x86_64<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; vzctl-4.2-1.el6.x86_64<br>
      <br>
      I've tried to reboot the system with different kernels, but the
      same error. There's another strange thing: we have another machine
      with the same kernel but I cannot reproduce the error there.<br>
      I've also tried to run vzctl with gdb and search in the source
      code, and there seems to be a problem around setting up the
      environment:<br>
      In src/lib/hooks_vz.c there's a function:<br>
      <br>
      <i>static int vz_env_create_ioctl(vps_handler *h, envid_t veid,
        int flags)</i><i><br>
      </i><i>{</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; struct vzctl_env_create env_create;</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int errcode;</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int retry = 0;</i><i><br>
      </i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; memset(&amp;env_create, 0, sizeof(env_create));</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; env_create.veid = veid;</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; env_create.flags = flags;</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; do {</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (retry)</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep(1);</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; errcode = ioctl(h-&gt;vzfd,
        VZCTL_ENV_CREATE, &amp;env_create);</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fprintf(stderr,"error code: %d\n",errcode);</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } while (errcode &lt; 0 &amp;&amp; errno == EBUSY
        &amp;&amp; retry++ &lt; ENVRETRY);</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (errcode &gt;= 0 &amp;&amp; (flags &amp;
        VE_ENTER)) {</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Clear supplementary group IDs */</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setgroups(0, NULL);</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Set personality PER_LINUX32 for i386
        based CTs */</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set_personality32();</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else{</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        fprintf(stderr,"%s,%d\n",strerror(errno),errno);</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return errcode;</i><i><br>
      </i><i>}</i><br>
      <br>
      The ioctl returns with an error: INVALID ARG. Also the vzct
      start/stop don't work.<br>
      I compared the two host's environment variables, but no
      difference.<br>
      <br>
    </blockquote>
    <br>
    Hmm, looks weird.<br>
    <br>
    The fact that it works from console and doesn't work from ssh is
    interesting. Maybe you should compare your environment from console
    and ssh.<br>
    <br>
    If you want I can take a look, email me privately.<br>
  </body>
</html>