I've created a chroot with the help of jailkit and now I'm trying to install some other libraries and tools.

First I tried to install clear library. I've copied the file from the /bin folder and copied the dependencies to the chroot. However, when I entered the clear command, it says:

TERM environment variable not set.

So, when I'm logged in as root, the value of TERM is xterm-256color. But when I enter export TERM=xterm-256color, it says unknown terminal type.

What should I do?


clear depends on terminfo. terminfo uses the value of $TERM as a key to look up the proper escape sequences for your terminal in its database. You need to copy the terminfo database files for the terminal types you want to be supported in the chroot. You'll find them in /lib/terminfo or /usr/share/terminfo. If the files aren't found, terminfo can't do anything but tell you that it doesn't recognize your terminal type.


You likely want to install a shell in the chroot.

Also, debian has a very useful tool for populating chroots with a debian system, look at the man page for debbootstrap for more.


A good suggestion from the Gentoo alt-install doc: Instead of chroot /your/chroot/path /bin/bash run

chroot /your/chroot/path /bin/env -i TERM=$TERM /bin/bash

env -i will clean the environment (the chroot-environment is probably different or even incompatible), while the TERM=$TERM will make the chrooted bash aware of the parent's TERM variable ($TERM is expanded by the parent shell before executing the commands).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.