Solved A couple of questions about jails

Hi, I am reading FreeBSD Handbook (chapter about jails).
Just for curiosity, why is it necessary/recommended to invoke sh in example?

Code:
# sh
# export DESTDIR=/here/is/the/jail
After few lines, there is another command:

Code:
# setenv D /here/is/the/jail

but such is not recognized by sh (it works with csh, instead).
I think one could do same steps with bash or whatever, but again: I am just curious about it.

Second questions: why is it necessary to compile world from sources?
I wondering if one simply needs to create a jailed envrinonment, isn't possible to copy base system (binary), as with standard BSD installation?

Thank you very much
 
Just for curiosity, why is it necessary/recommended to invoke sh in example?

Code:
# sh
# export DESTDIR=/here/is/the/jail
It's not really necessary, but merely an example. I can only speculate but my theory is that they started sh to ensure that if you use any other shell then all their examples will still work. The export line wouldn't easily work with csh for example.

After few lines, there is another command:

Code:
# setenv D /here/is/the/jail
but such is not recognized by sh (it works with csh, instead).
Pay close attention to what is written above that section: it's an example that was directly taken from the jail(8) manualpage. The reason why they'd focus on csh is because this is the default shell for the root user, so it makes somewhat sense to assume that it's being used whenever you need to perform an action as root (also because the default way to become root is using su(1) which would also invoke csh).

However, truth of the matter is that this section is outdated. The particular example is no longer mentioned in the Jail manualpage.

Second questions: why is it necessary to compile world from sources?
It isn't. Also see that very same page in the handbook which starts with an example that uses the binary archives which contain the entire base system, this is also how I set up my jails. No need to build the world, just grab the binaries and you're done.

Once again I can only speculate why this is included in the manualpage, but my theory is because many system administrators use the source code to keep their systems up to date. So then it would be a very simple step to use that same source tree to set up a jail.

Hope this can help clear a few things up.
 
The D=/here/is/the/jail is still in the man page, though they're doing it Bourne shell style. The setenv D is c shell style.
Whatever the reasons, the FreeBSD documentation is often out of date these days. The handbook and manpage may contradict, but, for what it's worth, using the older (I believe) style mentioned in the handbook will still work well, and I think it's the method Michael Lucas describes in his latest (released early this month) Absolute FreeBSD.

I have't used the binary method for awhile, but it would certainly be much quicker. :)
 
Back
Top