lx Branded Zones, pt. I

After playing around with Solaris 8 and Solaris 9 Branded Zones (it's a weird feeling: suddenly it's the year 2000 again and it's all itchy and....old :-)), I had to try the BrandZ as well - non-global branded zones that contain non-native operating environments. The lx brand is basically a Solaris container running Linux. There are quite a few and good howtos out there, but often outdated or too new and focussing on OpenSolaris. We're currently on Solaris 10 5/08 (i86pc) so we have use a slightly different approach sometimes. Here it goes:

$ cd /etc/zones
$ wget http://www.opensolaris.org/os/community/brandz/files/SUNWlx26.xml
$ zonecfg -z debian26
zonecfg:debian26> create -t SUNWlx26
zonecfg:debian26> set zonepath=/data/zones/debian26
zonecfg:debian26> add net
zonecfg:debian26:net> set address=10.200.0.129/24
zonecfg:debian26:net> set physical=bge0
zonecfg:debian26:net> end
zonecfg:debian26> verify
zonecfg:debian26> commit 
zonecfg:debian26> exit
That's right, we're using a different template here: SUNWlx would allow us to boot a Linux 2.4 kernel, we're trying to boot a Linux 2.6 kernel. OpenSolaris.org suggests to install a CentOS 3 image, but we're Debian fanboys and want a real GNU/Linux installation :-) Well, SUNWlx26 is for 2.6 kernels, but after installing it, we were not even able to login after we tried to install Debian/lenny:
$ zlogin debian26
[Connected to zone 'debian26' pts/4]
FATAL: kernel too old
Debian/sarge shipped with 2.4.27 and 2.6.8, that's hopefully old enough. To build our tarball (for zoneadm later on), we're using a GNU/Linux box somewhere in our lab:
lnx# mount -o loop,ro debian-31r0-i386-netinst.iso /mnt/cdrom/
lnx# debootstrap sarge /mnt/zone-sarge31 file:/mnt/cdrom/debian/
lnx# cd /mnt/zone-sarge31
lnx# mkdir -p etc/sysconfig etc/rc.d/init.d
lnx# touch etc/rc.d/rc.sysinit etc/rc.d/init.d/halt
lnx# tar -cf ../zone-sarge31.tar .
OK, we now have our tarball (with some fake RedHat'ish configuration files) and are now ready to install our configured branded zone:
$ zoneadm -z debian26 install -d /mnt/nfs/lnx/mnt/zone-sarge31.tar
$ zoneadm -z debian26 boot
$ zlogin debian26
-bash: initialize_job_control: setpgid: Operation not permitted
$ uname -a
Linux debian26 2.4.21 BrandZ fake linux i686 GNU/Linux
$ grep -i proc /proc/cpuinfo 
processor       : 0
model name      : AMD Opteron(tm) Processor 848
processor       : 1
model name      : AMD Opteron(tm) Processor 848
$ dmesg 
klogctl: Function not implemented
Hm, I guess Debian/Sarge still installs 2.4 per default, so we could've just used SUNWlx :-\ The zone is running now, but far too many things are b0rked, e.g. networking: there's no network route set, yet ping(1) across the subnet is working - but we're not able to set a different/default route (SIOCADDRT) - it's not really funny. That's it for now folks, stay tuned how we're gonna solve this one.

TODO:
  • boot Debian/sarge with a 2.6 kernel (utilize SUNWlx26)
  • configure a SUNWlx zone, may be more easier to do...
  • try Debian/etch?