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

2010-06-04 Thread Bartosz Pierzchala
stty -a doesn't output anything when it's being launched via init
scripts at boot time. It exits with exit code 1.

The system boots properly with startpar enabled when call to
tcgetattr() isn't a fatal error - as I've written before.

Peter, perhaps we could briefly describe the variable in your patch?

From OpenVZ's vzctl sources I can see that output file descriptor is a
pipe. I'll ask OpenVZ developers on their forum if that could be
changed to a pseudo terminal.

Thanks for your support.

2010/6/4 Petter Reinholdtsen p...@hungry.com:

 Can someone provide the output from 'stty -a' executed in a init.d
 script booted by OpenVZ, to help us figure out why OpenVZ fail?  It
 would give us some input on the state of the tty provided by OpenVZ.

 Happy hacking,
 --
 Petter Reinholdtsen





--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



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

2010-06-01 Thread Bartosz Pierzchala
Package: sysvinit
Version: 2.88dsf-5

After debootstraping testing/squeeze there's a problem when trying to
start it under OpenVZ. init starts but the rc scripts fail to properly
setup environment (run scripts from runlevel S and runlevel 2).
OpenVZ's vzctl enter VEID dies with the following error message:

# vzctl enter 1050
enter into VE 1050 failed
Unable to open pty: No such file or directory

(the above if caused by /dev/pts not being mounted)

I've narrowed the problem to startpar program which is used by init
scripts to run scripts for given runlevel in parallel. It seems that
startpar dies giving an error :

17rt_sigaction(SIGWINCH, {0x401f40, [],
SA_RESTORER|SA_RESTART|SA_NODEFER, 0x7fcad974cf80}, NULL, 8) = 0
17ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fffc230) = -1
ENOTTY (Inappropriate ioctl for device)
17dup(2)= 3
17fcntl(3, F_GETFL) = 0x8002 (flags O_RDWR|O_LARGEFILE)
17fstat(3, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) = 0
17ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fffbfe0) = -1
ENOTTY (Inappropriate ioctl for device)
17mmap(NULL, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fcad9c87000
17lseek(3, 0, SEEK_CUR) = 0
17write(3, tcgetattr: Inappropriate ioctl for device\n, 42) = 42
17close(3)  = 0
17munmap(0x7fcad9c87000, 4096)  = 0
17exit_group(1) = ?



I'm attaching full strace output of startpar.

I've browsed Debian's sysvinit source and found out this call to
tcgetattr():

///
 if (tcgetattr(0, tio))
   {
 perror(tcgetattr);
 exit(1);
   }
///

tio variable is later used to disable basic terminal output translation:
///
  tio.c_oflag = ~OPOST;
  if (tcsetattr(1, TCSANOW, tio))
perror(tcsetattr);
///

When I comment this code and rebuild the package then the virtual
environment boots
successfully. I suppose that OpenVZ's stdin/stdout for init
program isn't a regular terminal
and that's the cause of tcgetattr() failing.

Should it be a fatal error if a call to tcgetattr() fails? Maybe we
could just detect the case when tcgetattr() returns 0 and if such
thing occurs - omit using tcsetattr()?



There's also one note that adding:
CONCURRENCY=none
to /etc/default/rcS
makes the system boot properly.



Host node runs Lenny and it works well. Below is the information about
the container:

-- System Information:
Debian Release: squeeze/sid
 APT prefers testing
 APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-2-openvz-amd64
Locale: LANG=pl_PL, LC_CTYPE=pl_PL (charmap=ISO-8859-2)
Shell: /bin/sh linked to /bin/dash

Versions of packages sysvinit depends on:
ii  initscripts   2.88dsf-5  scripts for initializing and shutt
ii  libc6 2.10.2-9   Embedded GNU C Library: Shared lib
ii  libselinux1   2.0.94-1   SELinux runtime shared libraries
ii  libsepol1 2.0.40-2   SELinux library for manipulating b
ii  sysv-rc   2.88dsf-5  System-V-like runlevel change mech
ii  sysvinit-utils2.88dsf-5  System-V-like utilities

sysvinit recommends no packages.

sysvinit suggests no packages.

-- no debconf information
17execve(/sbin/startpar, [startpar, -p, 4, -t, 20, -T, 3, 
-M, start, -P, N, -R, 2], [/* 12 vars */]) = 0
17brk(0)= 0x607000
17mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
= 0x7fcad9c8a000
17access(/etc/ld.so.nohwcap, F_OK) = -1 ENOENT (No such file or directory)
17mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
= 0x7fcad9c88000
17access(/etc/ld.so.preload, R_OK) = -1 ENOENT (No such file or directory)
17open(/etc/ld.so.cache, O_RDONLY) = 3
17fstat(3, {st_mode=S_IFREG|0644, st_size=6427, ...}) = 0
17mmap(NULL, 6427, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fcad9c86000
17close(3)  = 0
17access(/etc/ld.so.nohwcap, F_OK) = -1 ENOENT (No such file or directory)
17open(/lib/libc.so.6, O_RDONLY)  = 3
17read(3, 
\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\0\1\0\0\0\320\353\1\0\0\0\...@\0\0\0\0\0\0\0\350\373\24\0\0\0\0\0\0\0\0\0@\0008\0\...@\0g\0f\0\6\0\0\0\5\0\0\0@\0\0\0\0\0\...@\0\0\0\0\0\0\0@\0\0\0\0\0\0\\2\0\0\0\0\0\\2\0\0\0\0\0\0\10\0\0\0\0\0\0\0\3\0\0\0\4\0\...@\376\21\0\0\0\0\0@\376\21\0\0\0\...@\376\21\0\0\0\0\0\34\0\0\0\0\0\0\0\34\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0\1\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\227\24\0\0\0\0\0\310\227\24\0\0\0\0\0\0\0
 \0\0\0\0\0\1\0\0\0\6\0\0\0 \247\24\0\0\0\0\0 \2474\0\0\0\0\0 
\2474\0\0\0\0\0\230F\0\0\0\0\0\0\10\221\0\0\0\0\0\0\0\0