[lxc-users] color in console not working in unprivileged containers

Mark Constable markc at renta.net
Sun Mar 22 02:54:13 UTC 2015


On 22/03/15 02:12, Michael H. Warfield wrote:
> Append "linux" to the end of those lines in each file so it reads like
> this (for tty1.conf)
>
> exec /sbin/getty -8 38400 tty1 linux

Wonderful thorough explanation, thanks Mike.

FWIW it's also possible to do something like this too (not documented in
the man pages from lxd-daily/vivid (1.1.0-0ubuntu1))...

lxc-attach -n mycontainer -v TERM=linux

and --clear-env seems to remove host env vars and without a .bashrc or
.profile there is not even a TERM var and sure enough there are no colors
in a ls listing (oic, "set" shows a TERM=dumb)...

~ lxc-attach -n v1 --clear-env
root at v1:/root# env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/root
SHLVL=1
container=lxc
_=/usr/bin/env

And also FWIW these are my 2 favorite aliases of late...

alias a='lxc-attach --clear-env -v USER=root -v HOME=/root -v TERM=linux -v LANG=en_US.UTF-8 -v LC_ALL=en_US.UTF-8 -n'

alias lx='lxc-ls -f'



More information about the lxc-users mailing list