Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Attach a screen before chrooting into your linux from scratch minimal system (See related posts)

This snippet is not so much a snippet as a tip. It's goal is to make your Linux from Scratch experience easier by allowing you the freedom of being able to attach and detach to a screen session from your host computer. Of course you would go through the book and change the chroot command to suit your needs, but just bear in mind that the chroot command you will use may be different from the one I use.

By using screen, you can start a lengthy compile and then detach, go about your business and re-attach another time. I use it primarily when I have to start a compilation from one computer, then later from another machine located somewhere else. Combined with SSH, this can be real handy.

desktop ~ # screen -S clfs
desktop ~ # chroot "${CLFS}" /tools/bin/env -i \
>     HOME=/root TERM="${TERM}" PS1='\u:\w\$ ' \
>     PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
>     /tools/bin/bash --login +h

At any time, you can hit ctrl+a+d to detach. Then if you want to re-attach just type screen -r clfs and whamo, your right back where you left off.

Thanks again to ChrisS67 for helping me with my GCC problem (or me forgetting to install findutils) ;)

Comments on this post

Araxia posts on Dec 06, 2007 at 07:23
The "x" and "R" flags to screen are my favorites because you can always use the same command to either initially create or reattach to an existing session. e.g.

screen -xR clfs

will create a new screen session name "clfs" if it doesn't already exist, or reattach to it if it already exists (and without detaching another client that may already be attached).
chrelad posts on Dec 11, 2007 at 22:26
I'll change my alias's right away :)

Thanks Araxia,


You need to create an account or log in to post comments to this site.

Related Posts