[libvirt] [PATCH] lxc: Don't make container's TTY a controlling TTY

Daniel P. Berrange berrange at redhat.com
Wed Nov 18 11:32:55 UTC 2015

On Tue, Jun 23, 2015 at 03:18:53PM +0200, Richard Weinberger wrote:
> Userspace does not expect that the initial console
> is a controlling TTY. systemd can deal with that, others not.
> On sysv init distros getty will fail to spawn a controlling on
> /dev/console or /dev/tty1. Which will cause to whole container
> to reboot upon ctrl-c.
> This patch changes the behavior of libvirt to match the kernel
> behavior where the initial TTY is also not controlling.
> The only user visible change should be that a container with
> bash as PID 1 would complain. But this matches exactly the kernel
> be behavior with intit=/bin/bash.
> To get a controlling TTY for bash just run "setsid /bin/bash".
> Signed-off-by: Richard Weinberger <richard at nod.at>
> ---
>  src/lxc/lxc_container.c | 14 +-------------
>  1 file changed, 1 insertion(+), 13 deletions(-)

I checked with a systemd init and with bash as init, and it works as

ACK & pushed to master

|: 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 :|

More information about the libvir-list mailing list