[Lxc-users] What controls the pty terminal settings in a container?

Barry Jaspan barry.jaspan at acquia.com
Mon Sep 16 02:05:13 UTC 2013


If I run stty -a under lxc-execute without a contained root filesystem, I
get one set of terminal settings. If I bind-mount the host's root
filesystem and /dev and use that as the container's root fs, I get a
different set of terminal settings. The differences in the two sets of
settings are that with the contained root fs, the stty options icrnl, ixon,
isig, icanon, and echo are all off. This makes an interactive shell not
work very well. :-) Obviously I can run stty to change the terminal
settings, but I am wondering what controls the pty terminate settings when
lxc creates a contained root filesystem vs. when it does not.

Example on Ubuntu 12.04:

No contained root filesystem:

# cat test.cfg
lxc.utsname = mytest

# lxc-execute -n test -f test.cfg  -- stty -a
speed 38400 baud; rows 52; columns 204; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2
= <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon
-ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0
ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke

Contained root filesystem:

# mount --bind / /var/lib/lxc/container/testrootfs

# cat test.cfg
lxc.utsname = mytest
lxc.rootfs = /var/lib/lxc/container/testrootfs
lxc.mount.entry=/dev /var/lib/lxc/container/testrootfs/dev none rw,bind 0 0

# lxc-execute -n test -f test.cfg  -- stty -a
speed 38400 baud; rows 52; columns 204; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2
= <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon
-ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0
ff0
-isig -icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop
-echoprt echoctl echoke

Thanks,

Barry


-- 
Barry Jaspan
Senior Architect | Acquia <http://acquia.com>
barry.jaspan at acquia.com | (c) 617.905.2208 | (w) 781-313-8298

Acquia Dev Cloud: You build killer websites. We do the
rest.<http://www.acquia.com/dev-cloud><http://acquia.com/dev-cloud>
Acquia ranked #1 Software Vendor on the 2012 Inc
500<http://www.acquia.com/about-us/newsroom/press-releases/inc-magazine-unveils-31st-annual-list-america-s-fastest-growing>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20130915/67d106d8/attachment.html>


More information about the lxc-users mailing list