[Pkg-sysvinit-devel] Bug#584102: OpenVZ vzctl enter dying with: Unable to open pty: No such file or directory; problem with tcgetattr() and startpar

Petter Reinholdtsen pere at hungry.com
Fri Jun 4 07:05:57 UTC 2010


I had a closer look at the source, and suspect a patch like this might
solve it, by running all scripts sequencially if the tty is strange.

Index: startpar.c
===================================================================
--- startpar.c  (revision 1898)
+++ startpar.c  (working copy)
@@ -631,6 +631,7 @@
   char *prev_level = getenv("PREVLEVEL");
   char *run_level = getenv("RUNLEVEL");
   char *splashopt = 0;
+  int notty = 0;

   (void)signal(SIGUSR1, sighandler_preload);
   (void)signal(SIGUSR2, sighandler_nopreload);
@@ -813,8 +814,7 @@

   if (tcgetattr(0, &tio))
     {
-      perror("tcgetattr");
-      exit(1);
+      notty = 1;
     }
   if (ioctl(0, TIOCGWINSZ, &wz) == 0)
     wzok = 1;
@@ -904,6 +904,11 @@
                  }
                  p->splashadd = calcsplash(num, argc, splashopt);
                  p->num = num++;
+                  if (notty)
+                    {
+                      interactive_task = p;     /* no tty, treat as interactive */
+                      continue;
+                    }
                  if (interactive_task)
                    continue;                   /* don't start this here */
                  run(p);

Anyone able and willing to test if it solve the problem for OpenVZ?

Happy hacking,
-- 
Petter Reinholdtsen





More information about the Pkg-sysvinit-devel mailing list