[Lxc-users] LXC Without TTY. Why? SSH: PTY allocation request failed on channel 0

Osvaldo Filho arquivostcf at gmail.com
Mon Mar 29 01:09:28 UTC 2010


Environment:
Ubuntu 10.04 x64
lxc 0.6.5-1


SSH Problem: PTY allocation request failed on channel 0

Where is my tty?

lxc-ps --lxc

CONTAINER    PID TTY          TIME CMD
prizm1      1330 ?        00:00:00 init
prizm1      1406 ?        00:00:00 upstart-udev-br
prizm1      1420 ?        00:00:00 udevd
prizm1      1427 ?        00:00:00 getty
prizm1      1434 ?        00:00:00 getty
prizm1      1700 ?        00:00:00 sshd
prizm1      1702 ?        00:00:00 apache2
prizm1      1722 ?        00:00:00 getty
prizm1      1723 ?        00:00:00 apache2
prizm1      1724 ?        00:00:00 apache2
prizm1      1725 ?        00:00:00 apache2
prizm1      1726 ?        00:00:00 apache2
prizm1      1727 ?        00:00:00 apache2
prizm1      1903 ?        00:00:00 apache2

---------------------------------------------------
deskx at srv01:~$ cat (...)/rootfs/etc/init/lxc.conf
start on startup

task
pre-start script
mount -t proc proc /proc
mount -t devpts devpts /dev/pts
mount -t sysfs sys /sys
mount -t tmpfs varrun /var/run
mount -t tmpfs varlock /var/lock
mkdir -p /var/run/network
mkdir -p /var/run/sshd
touch /var/run/network/ifstate
touch /var/run/utmp
chmod 664 /var/run/utmp
chown root.utmp /var/run/utmp
if [ "$(find /etc/network/ -name upstart -type f)" ]; then
chmod -x /etc/network/*/upstart || true
fi
end script

script
start networking
initctl emit filesystem --no-wait
initctl emit local-filesystems --no-wait
initctl emit virtual-filesystems --no-wait
init 2
end script

------------------------------------------------
Script for correct /dev

#!/bin/bash

# bodhi.zazen's lxc-config
# Makes default devices needed in lxc containers
# modified from http://lxc.teegra.net/

ROOT=$(pwd)
DEV=${ROOT}/rootfs/dev
if [ $ROOT = '/' ]; then
printf "\033[22;35m\nDO NOT RUN ON THE HOST NODE\n\n"
tput sgr0
exit 1
fi
if [ ! -d $DEV ]; then
printf "\033[01;33m\nRun this script in rootfs\n\n"
tput sgr0
exit 1
fi
rm -rf ${DEV}
mkdir ${DEV}
mknod -m 666 ${DEV}/null c 1 3
mknod -m 666 ${DEV}/zero c 1 5
mknod -m 666 ${DEV}/random c 1 8
mknod -m 666 ${DEV}/urandom c 1 9
mkdir -m 755 ${DEV}/pts
mkdir -m 1777 ${DEV}/shm
mknod -m 666 ${DEV}/tty c 5 0
mknod -m 666 ${DEV}/tty0 c 4 0
mknod -m 666 ${DEV}/tty1 c 4 1
mknod -m 666 ${DEV}/tty2 c 4 2
mknod -m 666 ${DEV}/tty3 c 4 3
mknod -m 600 ${DEV}/console c 5 1
mknod -m 666 ${DEV}/full c 1 7
mknod -m 600 ${DEV}/initctl p
mknod -m 666 ${DEV}/ptmx c 5 2

exit 0

-----------------------------------------------
My config.lxc

lxc.utsname = prizm1
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.ipv4 = 192.168.1.13/24
lxc.network.hwaddr = 00:16:EC:7E:E5:19
lxc.network.name = eth0
lxc.mount = /home/lxc/prizm/fstab
lxc.rootfs = /home/lxc/prizm/rootfs

lxc.tty = 0
#lxc.pseudo = 1024

#lxc.cgroup.devices.deny = a # Deny all access to devices
# /dev/null and zero
lxc.cgroup.devices.allow = c 1:3 rwm
lxc.cgroup.devices.allow = c 1:5 rwm

# consoles
lxc.cgroup.devices.allow = c 5:1 rwm
lxc.cgroup.devices.allow = c 5:0 rwm
lxc.cgroup.devices.allow = c 4:0 rwm
lxc.cgroup.devices.allow = c 4:1 rwm
lxc.cgroup.devices.allow = c 4:2 rwm
lxc.cgroup.devices.allow = c 4:3 rwm

# /dev/{,u}random
lxc.cgroup.devices.allow = c 1:9 rwm
lxc.cgroup.devices.allow = c 1:8 rwm
# /dev/pts/* - pts namespaces are "coming soon"
lxc.cgroup.devices.allow = c 136:* rwm
lxc.cgroup.devices.allow = c 5:2 rwm
# rtc
lxc.cgroup.devices.allow = c 254:0 rwm




More information about the lxc-users mailing list