You are not logged in.

#1 2015-03-04 19:14:08

emk
Member
Registered: 2010-05-11
Posts: 39

LXC Container login on host tty

I want create a full system lxc container with a gui and log in to it on one of the host's tty (using CTRL+ALT+Fn). I have set up lxc as per the wiki and I can login into container (its debian sid) and ssh into it and install software. What I'm having trouble doing is getting it to present a login at the host tty. I'm trying to set this up for F7 since that is not used by systemd. Has anybody been able to do this?

My config file:

# Template used to create this container: /usr/share/lxc/templates/lxc-debian
# Parameters passed to the template:
# For additional config options, please look at lxc.container.conf(5)
# lxc.network.type = empty
lxc.rootfs = /var/lib/lxc/Mycont/rootfs

# Common configuration
lxc.include = /usr/share/lxc/config/debian.common.conf

# Container specific configuration
lxc.utsname = Mycont
lxc.arch = amd64
lxc.tty = 3 
lxc.cap.drop = mknod
lxc.pts = 1024
lxc.kmsg = 0
lxc.autodev = 1

#networking
lxc.network.type=veth
lxc.network.link=br0
lxc.network.ipv4=10.0.0.100
lxc.network.ipv4.gateway=10.0.0.1
lxc.network.flags=up
lxc.network.name=enp3s0
lxc.network.mtu=1500

#cgroups
lxc.cgroup.devices.deny = a # Deny all access to devices
lxc.cgroup.devices.allow = c 1:3 rwm # dev/null
lxc.cgroup.devices.allow = c 1:5 rwm # dev/zero
lxc.cgroup.devices.allow = c 5:1 rwm # dev/console
lxc.cgroup.devices.allow = c 5:0 rwm # dev/tty
#lxc.cgroup.devices.allow = c 4:0 rwm # dev/tty0
lxc.cgroup.devices.allow = c 4:7 rwm # dev/tty7
lxc.cgroup.devices.allow = c 1:9 rwm # dev/urandom
lxc.cgroup.devices.allow = c 1:8 rwm # dev/random
lxc.cgroup.devices.allow = c 136:* rwm # dev/pts/*
lxc.cgroup.devices.allow = c 5:2 rwm # dev/pts/ptmx

tty setup in the container's rootfs/dev/

crw-rw-rw-  1 root tty  5,  0 Jan 14 01:03 tty
crw-------  1 root tty  4,  0 Jan 14 01:03 tty0
crw-r--r--  1 root root 4,  1 Mar  2 14:26 tty1
crw-r--r--  1 root root 4,  2 Mar  2 14:26 tty2
crw-r--r--  1 root root 4,  3 Mar  2 14:26 tty3
crw-r--r--  1 root root 4,  4 Mar  2 14:26 tty4
crw-r--r--  1 root root 4,  7 Mar  3 15:34 tty7

tty setp in the container /dev when its running:

crw-rw-rw-  1 root root   5, 0 Mar  4 18:52 tty
crw--w----  1 root tty  136, 0 Mar  4 18:52 tty1
crw--w----  1 root tty  136, 1 Mar  4 18:52 tty2
crw--w----  1 root tty  136, 2 Mar  4 18:52 tty3
crw-rw-rw-  1 root root   1, 9 Mar  4 18:52 urandom

note that tty7 is not created in the running container's /dev even though it is in the container's rootfs/dev

thanks

Offline

Board footer

Powered by FluxBB