Re: ZFS / Boot Environments / Jails / Upgrading form Source Code

2012-10-19 Thread Shane Ambler

On 19/10/2012 07:44, dweimer wrote:


First step replace the usr/src within the jail with new source using
 svn, easy enough.  Then start make buildworld... oops, I have a
problem now, the usr/obj/usr stuff is now under
/usr/obj/usr/jails/release91rc2..., However I want it to be under
/usr/jails/release91rc2/usr/obj/usr.


If the jails base dir is /usr/obj/usr/jails/release91rc2 then it can
only access files below that base dir. That is part of the jails security.

If your jail is based at /usr/obj/usr/jails/release91rc2 then the jail
by default will buildworld into /usr/obj of the jail system which
translates to /usr/obj/usr/jails/release91rc2/usr/obj on the base system.

You can adjust the settings within the jail but it will always be
within the release91rc2 dir so you can't use the jail to install into
/usr/jails of the base system.


From looking at the usr/src/Makefile  It looks like I need to set the
 MAKEOBJDIRPREFIX=/usr/jails/relase91rc2/usr/obj/usr/src/tmp
environment variable, but is that the best solution here? There's
also a /usr/obj/lib32 directory (system is running amd64, I assume
this is for 32 bit libraries), so I would likely need to do something
here as well, that I haven't gotten to yet.


lib32 is part of the final system - you don't need to handle it
separately. See man src.conf if you want to turn off the creation of
32bit libs.

You can set MAKEOBJDIRPREFIX (default /usr/obj ) to define where the
binary files are made.
You can also set DESTDIR (default is / ) for the installworld step to
define where they get installed.

When you start a buildworld or buildkernel the compiled binaries are
stored within MAKEOBJDIRPREFIX. When that is complete the installworld
or installkernel steps install the files from MAKEOBJDIRPREFIX into
DESTDIR to create a workable system. That prevents a failed build from
destroying part of your running system.

If you want to experiment with different versions then you can also try-

mkdir /usr/jails
cd /usr/jails
svn co http://svn0.us-west.FreeBSD.org/base/releng/9.0 9.0-src
cd 9.0-src
set MAKEOBJDIRPREFIX = /usr/jails/9.0-obj
set DESTDIR = /usr/jails/9.0-base
make buildworld  make installworld

cd /usr/jails
svn co http://svn0.us-east.FreeBSD.org/base/releng/9.1 9.1-src
cd 9.1-src
set MAKEOBJDIRPREFIX = /usr/jails/9.1-obj
set DESTDIR = /usr/jails/9.1-base
make buildworld  make installworld


I know the /usr/obj/usr directory can be deleted after the
installation of the source, does the same go for the /usr/obj/lib32
directory?  if so


Anything in MAKEOBJDIRPREFIX (/usr/obj) can be deleted after you have
installed it, including lib32 which are libs to allow running 32bit
programs on a 64bit system.


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: ZFS / Boot Environments / Jails / Upgrading form Source Code

2012-10-19 Thread dweimer

On 2012-10-19 02:48, Shane Ambler wrote:

On 19/10/2012 07:44, dweimer wrote:


First step replace the usr/src within the jail with new source using
 svn, easy enough.  Then start make buildworld... oops, I have a
problem now, the usr/obj/usr stuff is now under
/usr/obj/usr/jails/release91rc2..., However I want it to be under
/usr/jails/release91rc2/usr/obj/usr.


If the jails base dir is /usr/obj/usr/jails/release91rc2 then it can
only access files below that base dir. That is part of the jails 
security.


If your jail is based at /usr/obj/usr/jails/release91rc2 then the 
jail

by default will buildworld into /usr/obj of the jail system which
translates to /usr/obj/usr/jails/release91rc2/usr/obj on the base 
system.


You can adjust the settings within the jail but it will always be
within the release91rc2 dir so you can't use the jail to install into
/usr/jails of the base system.


The base of the Jail, is /usr/jails/release91rc2, however, I did forget 
to mention that I was running the buildworld and buildkernel from the 
base system, with the intent to install using the 
DESTDIR=/usr/jails/release91rc2 command line option




From looking at the usr/src/Makefile  It looks like I need to set 
the

 MAKEOBJDIRPREFIX=/usr/jails/relase91rc2/usr/obj/usr/src/tmp
environment variable, but is that the best solution here? There's
also a /usr/obj/lib32 directory (system is running amd64, I assume
this is for 32 bit libraries), so I would likely need to do 
something

here as well, that I haven't gotten to yet.


lib32 is part of the final system - you don't need to handle it
separately. See man src.conf if you want to turn off the creation of
32bit libs.


Got it, Fine with leaving it there, just wanted to know if there was a 
separate option to define where it ended up.



You can set MAKEOBJDIRPREFIX (default /usr/obj ) to define where the
binary files are made.
You can also set DESTDIR (default is / ) for the installworld step to
define where they get installed.


It appears I went to deep on my definition of the MAKOBJDIRPREFIX, made 
the above path after seeing some output at the start of one of my 
buildworld attempts, which is what led me to believe there would be a 
second choice.



When you start a buildworld or buildkernel the compiled binaries are
stored within MAKEOBJDIRPREFIX. When that is complete the 
installworld

or installkernel steps install the files from MAKEOBJDIRPREFIX into
DESTDIR to create a workable system. That prevents a failed build 
from

destroying part of your running system.

If you want to experiment with different versions then you can also 
try-


mkdir /usr/jails
cd /usr/jails
svn co http://svn0.us-west.FreeBSD.org/base/releng/9.0 9.0-src
cd 9.0-src
set MAKEOBJDIRPREFIX = /usr/jails/9.0-obj
set DESTDIR = /usr/jails/9.0-base
make buildworld  make installworld

cd /usr/jails
svn co http://svn0.us-east.FreeBSD.org/base/releng/9.1 9.1-src
cd 9.1-src
set MAKEOBJDIRPREFIX = /usr/jails/9.1-obj
set DESTDIR = /usr/jails/9.1-base
make buildworld  make installworld


Here was the key information I needed, found several examples searching 
but none stated the MAKEOBJDIRPREFIX=, as you state below they are not 
needed for the running system, guessing most people clean them up 
afterwards so they aren't concerned they don't exist in the same boot 
environment in the end.  I prefer to keep them in the same boot 
environment if possible, just so that if I delete a boot environment I 
know I got rid of everything that belonged to it and don't end up 
uselessly eating up extra disk space.  I do delete the /usr/obj/usr 
directory prior to any rebuild, from old documentation I read when I 
first started doing source upgrades as a method of improving the speed 
of the buildworld.  I am sure those were written for a 32bit system, 
which is why the lib32 directory wasn't included in those instructions.



I know the /usr/obj/usr directory can be deleted after the
installation of the source, does the same go for the /usr/obj/lib32
directory?  if so


Anything in MAKEOBJDIRPREFIX (/usr/obj) can be deleted after you have
installed it, including lib32 which are libs to allow running 32bit
programs on a 64bit system.


Looks like I am on the right path, now time to give it a try with the 
new environment variables, thanks for your help Shane.


If all goes well on this step, only things I have left to figured out 
and test is creating zfs snapshots by hand of volumes outside my boot 
environment, and mounting those read write within the jailed systems 
base so that I can fully test my applications against the latest live 
data without changing the actual data.  Don't expect to have any trouble 
with this one.


And then last of all need to test removing a HD from my Virtual 
Machine, adding a replacement, and rebuilding the mirror, again don't 
expect this to be a problem, just need to work my way through them and 
get the steps down before I am comfortable doing these procedures on a 
system that 

ZFS / Boot Environments / Jails / Upgrading form Source Code

2012-10-18 Thread dweimer
I have been playing around with different build layouts etc trying to 
come up with a plan to make updates smoother and more easily recoverable 
if it goes horribly wrong.  I think I have almost figured things out, 
just have a couple things left to figure out, one of which I am hoping 
someone on this list can help em out with, to save me some trial an 
error.


Steps already figured out, mount new boot environment (using 9.1rc2 to 
test with) in /usr/jails/release91rc2, added the necessary settings to 
rc.conf, started jail, so far so good.  I now know I can run the boot 
environment from within the jail, stop the jail and begin the upgrade 
from source.


First step replace the usr/src within the jail with new source using 
svn, easy enough.  Then start make buildworld... oops, I have a problem 
now, the usr/obj/usr stuff is now under 
/usr/obj/usr/jails/release91rc2..., However I want it to be under 
/usr/jails/release91rc2/usr/obj/usr.


From looking at the usr/src/Makefile  It looks like I need to set the 
MAKEOBJDIRPREFIX=/usr/jails/relase91rc2/usr/obj/usr/src/tmp environment 
variable, but is that the best solution here?
There's also a /usr/obj/lib32 directory (system is running amd64, I 
assume this is for 32 bit libraries), so I would likely need to do 
something here as well, that I haven't gotten to yet.


I know the /usr/obj/usr directory can be deleted after the installation 
of the source, does the same go for the /usr/obj/lib32 directory?  if so 
perhaps it is a better option to make a new zfs data set outside the 
boot environments to mount under /usr/obj directory, let the default 
prefixes handle which sub directory to use, and just delete the 
directories when I am done working with the boot environment.


--
Thanks,
   Dean E. Weimer
   http://www.dweimer.net/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org