I'm having trouble understanding the tty options. Help.

As far as I can tell, all (standard, like when you pop open a new window, and also the ones any given script which forked/running on its own and not in an actual tty interfaces with) pttys in linux ultimately talk to one singular instance of a “Server Emulator” on the other end of their respective virtual “Teletype Connections.” Using this option starts a new “Server Emulator” private to the container? Is that right? And the (not-yet-working) value is the maximum number of terminal emulators it allows? Or all virtual TTY links, including between forking and forked processes? Or the maximum number of PTTYs using linux commands and connecting to the “Server emulator” at once, including scripts?

This is the number of sandboxed host ptty instances (do these get replaced with connections to the guest “TTY Server Emulator” instance, if lxc.pty.max is set?) LXC sends to the client to potentially use as its own ttys? Is that right? So this should ideally be set to, in Ubuntu for example, 8, becuase that’s how many standard ttys exist in a typical Ubuntu client?


Where the sandboxed host ptty instances LXC sends to the client to potentially use as its own ttys live on the client. This one I think I get, but how does can it block guest upgrades in its normal, default locations? Is it a refusal to allow the client package updater to write to them (or their backend infrastructure somewhere?) If so, how do the symlinks they recommend avoid getting overwritten with non-emulated ones by the package upgrader and thereby fucked up?

Thanks in advance for all the help, guys! I appreciate your patience in dealing w/ clusless noobs like yours truly.

Note the this limitation is not implemented yet part of lxc.pty.max.

In short you have devpts mounted on /dev/pts in the container. This can have a limited number of devices through a mount option but it’s a bit pointless as you can just mount another instance of it and get whatever number of devices you want.

Anyway, /dev/pts only shows you devices for that container. Opening ptmx lets you allocate a new pair with one side being the tty master and the other side the tty slave. The master side is given to you as an fd, the slave shows up as a file in /dev/pts.

lxc.tty.max controls the number of pts devices that are allocated for use as regular /dev/ttyX devices. That’s effectively used by lxc-console outside of the container and by the init system and getty inside the container. Those are always allocated from the host and the slave side is what’s passed into the container.

lxc.tty.dir controls where those tty devices should be mounted into. If you have an init system that may dislike /dev/ttyX being a bind-mount, then you can set that to have them elsewhere and get a symlink instead.