Developing with multiple BEs in OpenSolaris

One of the things I have found over the years to be helpful as a Solaris kernel developer is liveupgrade (lucreate(1M)).

For example, I will usually have 3 boot environments (BE) on my systems at one time. The first BE usually has the base build that my gate is a child of. The second BE is my test BE which I BFU, and generally seem to kill quite often. And the third BE is an old build so I can go move my test BE to the old build all the way up to the most recent build (luupgrade(1M)).

OpenSolaris uses beadm which is a nice replacement to the lu commands. I was a little disappointed when I first started using it because I didn't think it was as flexible as I wanted.. But after playing with it for a while, I have a setup which I'm pretty happy with at the moment.

What I want to be able to do is to have the stock OpenSolaris BE, which gets upgraded at major releases. But I also want to have BEs which are based off of various development builds, and test BEs which I can BFU, etc. This is really nice since these will be COW based clones due to zfs.

So the question was how to update an alternate BE and at the same time, not modify the current BE. i.e. not having to update the authority, upgrade SUNWipkg, etc. The solution is pretty simple, chroot...

Here's how I create a b108 BE on a stock 2008.11 system, while ensuring I keep the 2008.11 bits unmodified. I can switch back to the stock OpenSolaris bits at any time with a beadm activate opensolaris.

beadm create snv108
beadm mount snv108 /mnt
mount -F proc /proc /mnt/proc
chroot /mnt
pkg set-authority -O http://pkg.opensolaris.org/dev opensolaris.org
pkg refresh
pkg install SUNWipkg
pkg install entire@0.5.11-0.108
bootadm update-archive
exit
umount /mnt/proc
beadm umount snv108
beadm activate snv108
Comments:

I use VirtualBox so I just have two virtual machines but if I were on bare metal I'd probably do something like this to get to the same place as your procedure.

beadm create dev
beadm activate dev
init 6 (that is, boot the dev boot environment)
pkg set-authority -O http://pkg.opensolaris.org/dev opensolaris.org
pkg refresh
pkg image-update
beadm activate dev
beadm rename dev-1 snv108
readm activate snv108

I guess that I'm less confident that I know all of the magic incantations needed to do an "image-update" manually so I'd rig it so I can use the real thing.

The beadm actvate/rename/activate sequence is a little trick I use to avoid having to use automatically generated BE names. You can't rename an active boot environment, so you activate another one long enough to do the rename and then reactivate the renamed one.

I'm not suggesting my way is better or worse than yours - it is simply an alternative. [I've not tested this, so there may be some errors in the details but I think the general approach should work.]

-- Rand

Posted by Rand Huntzinger on March 04, 2009 at 03:29 AM EST #

Hi Rand,

I do the same procedure that I wrote above on my VirtualBox
OpenSolaris guest. :-)

A couple of things why I took my approach. I can just as
easily install b105 vs b108. I don't always want the most
recent build. You usually want to install whatever build the
source base your working on is sync'd up to. I also get
less downtime when setting up the BE.

You can do a lot of interesting branching of BE's with COW.
image-update is good at what it's meant to do. But I was
looking something that gave more fine grained control.

As you say, it's one of many solutions.. :-) This one fits
my specific need so I though I would share it.

Thanks for the comments! MRJ

Posted by Mark Johnson on March 04, 2009 at 03:57 AM EST #

pkg also takes a -R option should you prefer to do things that way;

eg pkg -R /mnt image-update will update the image mounted at /mnt.

Posted by Bart Smaalders on March 04, 2009 at 05:30 PM EST #

Post a Comment:
Comments are closed for this entry.
About

mrj

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today