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

Bartosz Pierzchala bartosz.pierzchala at gmail.com
Tue Jun 1 09:38:18 UTC 2010


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 :

17    rt_sigaction(SIGWINCH, {0x401f40, [],
SA_RESTORER|SA_RESTART|SA_NODEFER, 0x7fcad974cf80}, NULL, 8) = 0
17    ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fffffffc230) = -1
ENOTTY (Inappropriate ioctl for device)
17    dup(2)                            = 3
17    fcntl(3, F_GETFL)                 = 0x8002 (flags O_RDWR|O_LARGEFILE)
17    fstat(3, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) = 0
17    ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fffffffbfe0) = -1
ENOTTY (Inappropriate ioctl for device)
17    mmap(NULL, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fcad9c87000
17    lseek(3, 0, SEEK_CUR)             = 0
17    write(3, "tcgetattr: Inappropriate ioctl for device\n", 42) = 42
17    close(3)                          = 0
17    munmap(0x7fcad9c87000, 4096)      = 0
17    exit_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-utils                2.88dsf-5  System-V-like utilities

sysvinit recommends no packages.

sysvinit suggests no packages.

-- no debconf information
-------------- next part --------------
17    execve("/sbin/startpar", ["startpar", "-p", "4", "-t", "20", "-T", "3", "-M", "start", "-P", "N", "-R", "2"], [/* 12 vars */]) = 0
17    brk(0)                            = 0x607000
17    mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fcad9c8a000
17    access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
17    mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fcad9c88000
17    access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
17    open("/etc/ld.so.cache", O_RDONLY) = 3
17    fstat(3, {st_mode=S_IFREG|0644, st_size=6427, ...}) = 0
17    mmap(NULL, 6427, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fcad9c86000
17    close(3)                          = 0
17    access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
17    open("/lib/libc.so.6", O_RDONLY)  = 3
17    read(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\0\0\350\373\24\0\0\0\0\0\0\0\0\0@\0008\0\n\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\0\0\0000\2\0\0\0\0\0\0000\2\0\0\0\0\0\0\10\0\0\0\0\0\0\0\3\0\0\0\4\0\0\0@\376\21\0\0\0\0\0@\376\21\0\0\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 \0\0\0\0\0\2\0\0\0\6\0\0\0@\333\24\0\0\0\0\0@\3334\0\0\0\0\0@\3334\0\0\0\0\0\340\1\0\0\0\0\0\0\340\1\0\0\0\0\0\0\10\0\0\0\0\0\0\0\4\0\0\0\4\0\0\0p\2\0\0\0\0\0\0p\2\0\0\0\0\0\0p\2\0\0\0\0\0\0D\0\0\0\0\0\0\0D\0\0\0\0\0\0\0\4\0\0\0\0\0\0\0\7\0\0\0\4\0\0\0 \247\24\0\0\0\0\0 \2474\0\0\0\0\0 \2474\0\0\0\0\0\20\0\0\0\0\0\0\0h\0\0\0\0\0\0\0\10\0\0\0\0\0\0\0P\345td\4\0\0\0\\\376\21\0\0\0\0\0\\\376\21\0\0\0\0\0\\\376\21\0\0\0\0\0<e\0\0\0\0\0\0<e\0\0\0\0\0\0\4\0\0\0\0\0\0\0Q\345td\6\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\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\0\0\0\0\0\0\0R\345td\4\0\0\0 \247\24\0\0\0\0\0 \2474\0\0\0\0\0 \2474\0\0\0\0\0\3408\0\0\0\0\0\0\3408\0\0\0\0\0\0\1\0\0\0\0\0\0\0\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\326\315\273B\3173)\337N\241\233\207c\364\221u\205\226\34\7\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0\22\0\0\0\0\0\0\0\363\3\0\0\t\0\0\0\0\1\0\0\16\0\0\0\0000\20D\240 \2\1\210\3\346\220\305E\214\0\300\0\10\0\5\200\0`\300\200\0\r\212\f\0\4\20\0\210D2\10.@\210P4, \16\"H&\204\300\214\4\10\0\2\2\16\241\254\32\4f\300\0\3002\0\300\0P\1 \201\10\204\v  ($\0\4 P\0\20X\200\312DB(\0\6\200\20\30B\0 @\200\0\tP\0Q\212@\20\0\0\0\0\10\0\0\21\20", 832) = 832
17    fstat(3, {st_mode=S_IFREG|0755, st_size=1379752, ...}) = 0
17    mmap(NULL, 3487784, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fcad971b000
17    mprotect(0x7fcad9865000, 2097152, PROT_NONE) = 0
17    mmap(0x7fcad9a65000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14a000) = 0x7fcad9a65000
17    mmap(0x7fcad9a6a000, 18472, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fcad9a6a000
17    close(3)                          = 0
17    mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fcad9c85000
17    mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fcad9c84000
17    arch_prctl(ARCH_SET_FS, 0x7fcad9c846f0) = 0
17    open("/dev/urandom", O_RDONLY)    = 3
17    read(3, "\202\240j\37\304\7\363", 7) = 7
17    close(3)                          = 0
17    mprotect(0x7fcad9a65000, 16384, PROT_READ) = 0
17    mprotect(0x7fcad9c8b000, 4096, PROT_READ) = 0
17    munmap(0x7fcad9c86000, 6427)      = 0
17    rt_sigaction(SIGUSR1, {0x401dd0, [USR1], SA_RESTORER|SA_RESTART, 0x7fcad974cf80}, {SIG_DFL, [], 0}, 8) = 0
17    rt_sigaction(SIGUSR2, {0x401dc0, [USR2], SA_RESTORER|SA_RESTART, 0x7fcad974cf80}, {SIG_DFL, [], 0}, 8) = 0
17    rt_sigaction(SIGCHLD, {SIG_DFL, [CHLD], SA_RESTORER|SA_RESTART, 0x7fcad974cf80}, {SIG_DFL, [], 0}, 8) = 0
17    open("/proc/stat", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
17    open("/proc/cpuinfo", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
17    getuid()                          = 0
17    open("/etc/init.d/.depend.start", O_RDONLY|O_NOATIME) = 3
17    fadvise64(3, 0, 0, POSIX_FADV_WILLNEED) = 0
17    fadvise64(3, 0, 0, POSIX_FADV_SEQUENTIAL) = 0
17    fadvise64(3, 0, 0, POSIX_FADV_NOREUSE) = 0
17    fcntl(3, F_GETFL)                 = 0x48000 (flags O_RDONLY|O_LARGEFILE|O_NOATIME)
17    brk(0)                            = 0x607000
17    brk(0x628000)                     = 0x628000
17    fstat(3, {st_mode=S_IFREG|0644, st_size=239, ...}) = 0
17    mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fcad9c87000
17    lseek(3, 0, SEEK_CUR)             = 0
17    read(3, "TARGETS = rsyslog killprocs bootlogs single cron rmnologin rc.local stop-bootlogd\nINTERACTIVE =\nsingle: killprocs bootlogs\ncron: rsyslog\nrmnologin: rsyslog bootlogs cron\nrc.local: rsyslog bootlogs cron\nstop-bootlogd: rsyslog bootlogs cron\n", 4096) = 239
17    read(3, "", 4096)                 = 0
17    fadvise64(3, 0, 0, POSIX_FADV_DONTNEED) = 0
17    close(3)                          = 0
17    munmap(0x7fcad9c87000, 4096)      = 0
17    open("/etc/rcN.d", O_RDONLY|O_DIRECTORY|O_NOATIME) = -1 ENOENT (No such file or directory)
17    open("/etc/rcN.d", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
17    open("/etc/rc2.d", O_RDONLY|O_DIRECTORY|O_NOATIME) = 3
17    fadvise64(3, 0, 0, POSIX_FADV_SEQUENTIAL) = 0
17    fadvise64(3, 0, 0, POSIX_FADV_NOREUSE) = 0
17    open("/etc/rc2.d", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
17    fcntl(4, F_GETFD)                 = 0x1 (flags FD_CLOEXEC)
17    getdents(4, /* 9 entries */, 32768) = 280
17    getdents(4, /* 0 entries */, 32768) = 0
17    close(4)                          = 0
17    fadvise64(3, 0, 0, POSIX_FADV_DONTNEED) = 0
17    close(3)                          = 0
17    open("/proc/meminfo", O_RDONLY)   = -1 ENOENT (No such file or directory)
17    rt_sigaction(SIGWINCH, {0x401f40, [], SA_RESTORER|SA_RESTART|SA_NODEFER, 0x7fcad974cf80}, NULL, 8) = 0
17    ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fffffffc230) = -1 ENOTTY (Inappropriate ioctl for device)
17    dup(2)                            = 3
17    fcntl(3, F_GETFL)                 = 0x8002 (flags O_RDWR|O_LARGEFILE)
17    fstat(3, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) = 0
17    ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fffffffbfe0) = -1 ENOTTY (Inappropriate ioctl for device)
17    mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fcad9c87000
17    lseek(3, 0, SEEK_CUR)             = 0
17    write(3, "tcgetattr: Inappropriate ioctl for device\n", 42) = 42
17    close(3)                          = 0
17    munmap(0x7fcad9c87000, 4096)      = 0
17    exit_group(1)                     = ?


More information about the Pkg-sysvinit-devel mailing list