Sukadev Bhattiprolu
2012-May-16 22:44 UTC
[libvirt-users] lxc: Add /dev/tty to lxcContainerPopulateDevices() ?
Hi, src/lxc/lxc_container.c:lxcContainerPopulateDevices() has this table of devices that are automatically created when an lxc container is started. const struct { int maj; int min; mode_t mode; const char *path; } devs[] = { { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_NULL, 0666, "/dev/null" }, { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_ZERO, 0666, "/dev/zero" }, { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_FULL, 0666, "/dev/full" }, { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_RANDOM, 0666, "/dev/random" }, { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_URANDOM, 0666, "/dev/urandom" }, }; Can we add '/dev/tty' to this list ? We were trying to run 'smbpasswd -a user' inside a container without /dev/tty and the fopen("/dev/tty", "w+") in smbpasswd made /dev/tty a regular file, breaking man(1), less(1), and ofcourse smbpasswd :-) Sure we can add /dev/tty to container's rc.local or something, but wouldn't it be in the same category as say, /dev/null or /dev/zero ? Sukadev
Daniel P. Berrange
2012-May-17 08:01 UTC
[libvirt-users] lxc: Add /dev/tty to lxcContainerPopulateDevices() ?
On Wed, May 16, 2012 at 03:44:19PM -0700, Sukadev Bhattiprolu wrote:> Hi, > > src/lxc/lxc_container.c:lxcContainerPopulateDevices() has this table > of devices that are automatically created when an lxc container is > started. > > const struct { > int maj; > int min; > mode_t mode; > const char *path; > } devs[] = { > { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_NULL, 0666, "/dev/null" }, > { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_ZERO, 0666, "/dev/zero" }, > { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_FULL, 0666, "/dev/full" }, > { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_RANDOM, 0666, "/dev/random" }, > { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_URANDOM, 0666, "/dev/urandom" }, > }; > > Can we add '/dev/tty' to this list ? > > We were trying to run 'smbpasswd -a user' inside a container without > /dev/tty and the fopen("/dev/tty", "w+") in smbpasswd made /dev/tty > a regular file, breaking man(1), less(1), and ofcourse smbpasswd :-) > > Sure we can add /dev/tty to container's rc.local or something, but > wouldn't it be in the same category as say, /dev/null or /dev/zero ?No, we can't just pass in the host's /dev/tty device to the container. We need to virtualize it, but this is not really very easy todo if we need to take account of multiple consoles. Probably as a temporar hack, we can just symlink it to /dev/tty1 and try to figure out a proper fix later Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Reasonably Related Threads
- [PATCH 1/2] LXC: hostdev: introduce lxcContainerSetupHostdevCapsMakePath
- Re: Permission problem with /dev/net/tun
- [PATCH 2/2] LXC: hostdev: parent directroy for hostdev atomically
- 1.2.7 and 1.2.8 fail to start container: libvirt_lxc[4904]: segfault at 0 ip ...error 4 in libc-2.17.so[
- Re: [PATCH 2/2] LXC: hostdev: parent directroy for hostdev atomically