Opensolaris adventure, part 3: pkg
For my next trick, I’ll be trying out pkg, the opensolaris packaging system.
I have moderately high standards for this; I use ubuntu on the desktop, so apt is my benchmark for how a unix package management system should operate. Ian Murdock (ex. Debian) is behind OpenSolaris’s pkg, so hopefully the experience should be comparable.
# pkg refresh # pkg install SUNWipkg ... time passes... ...success!
so, a basic smoke-test passes. I can install packages :-). Now, let’s have a look in the repo and see if we can find anything useful
#pkg search -r apache ... nothing ...
hmm… that’s not so good. Where’s apache? a bit of googling suggests that the package is called ‘SUNWapch22’
# pkg search -r apch ...nothing # pkg search -r SUNWapch22 ...nothing # pkg search -r httpd basename file usr/apache2/bin/httpd pkg:/SUNWapch2@2.2.3-0.75
ah-ha! It seems like
pkg search doesn’t search package names and descriptions (as
aptitude search does) but rather, file contents. I think that’s a little bit weird; it wouldn’t have occurred to me to specify the name of a file rather than some part of the description, but maybe it makes more sense. For a lot of packages (lynx , say), the name of the binary is the term you’d most likely search on, so it should work well in that circumstance.
pkg install SUNWapch2 ...success!
So now I have apache; import the manifest and enable the service and away we go!
OK, now to try something a bit more exciting; a distribution upgrade to the latest (snv_93) kernel and associated goodies.
It dowloads for a couple of hours (Sun repos seem to be slower than the ubuntu ones), and finally announces that it’s made me a new boot environment.
zfs list shows me a new set of file systems under rpool/ROOT/opensolaris-1, and
beadm list tells me I now have 2 boot environments; with the new one set to become active on a reboot. Off we go then!
I reboot, wait a bit, and try and ssh back into the box. Hmm; connection refused. I fire up the ilom console and take a look. The system appears to be continually rebooting – when the grub screen comes up, the new BE is present, but as soon as grub tries to boot it, the system goes back to the BIOS startup screen and reboots again :-(
So, next time round I select the old boot environment from the grub menu, and I’m back into my 05.08 environment. So, the fact that the image-update appears to have failed is a bit sucky, but, unlike a failed kernel update in ubuntu (which is rare, but generally leaves you with a broken X and a whole bunch of packages needing to be manually rolled back), I’m seamlessly back to where I started. ZFS FTW!
Anyway, a bit more googling reveals that image-update isn’t quite working yet, you need to manually update the boot archive.
# mkdir /tmp/foo # mount -F zfs rpool/ROOT/opensolaris-1 # /tmp/foo/boot/solaris/bin/update_grub -R /tmp/foo
Reboot again, and this time when the grub menu comes up, I have a third option, for snv_93. It’s pre-selected, so I let it boot; and it works fine :-) It’s a bit confusing that I still have the ‘opensolaris-1’ item in the grub menu, but it’s not causing any harm so I’m going to leave it there for the moment.
So, now I have a shiny new kernel with all the latest toys. What else do I want?
Well, blastwave and the SFW repositories would be nice:
# pkg set-authority -O http://pkg.sunfreeware.com:9000 sunfreeware # pkg set-authority -O http://blastwave.network.com:10000 blastwave # pkg refresh # pkg search -r lynx INDEX ACTION VALUE PACKAGE basename file opt/csw/bin/lynx pkg:/IPSlynx@0.5.11-2.6 basename file opt/sfw/bin/lynx pkg:/IPSFWlynx@0.5.11-5.7
Sorted. Next, some zones, I think…