title: What possible reasons could block a virtual terminal on Linux?
body: <p>Or is it possible at all that some process or something else could block a virtual terminal? Or what could be a reason that an application hangs when trying to access the VT1?</p>
  
  <p>It seems, while that is happening, it is hanging in the function <code>ioctl</code>. Especially, this is the code which fails:</p>
  
  <pre><code>int vtno = 1;
  const char* vtname = "/dev/tty1";
  
  int fd = open(vtname, O_RDWR|O_NDELAY, 0);
  
  if (ioctl(fd, VT_ACTIVATE, vtno) &lt; 0)
    printf("VT_ACTIVATE failed: %s\n", strerror(errno));
  
  if (ioctl(fd, VT_WAITACTIVE, vtno) &lt; 0)
    printf("VT_WAITACTIVE failed: %s\n", strerror(errno));
  </code></pre>
  
  <p>It hangs in the second <code>ioctl</code>. When I interrupt it, I get this message:</p>
  
  <pre><code>VT_WAITACTIVE failed: Interrupted system call
  </code></pre>
  
  <p>Also, while it is waiting there, if I do a <code>chvt 1</code> from another terminal, that also hangs.</p>