Cleaning up space used by the OpenSolaris pkg utility

I’ve been experimenting with the new OpenSolaris package manager (pkg), and ran into an odd issue last weekend. The flash drive I was running image-update on filled up, and after poking around I noticed that /var/pkg had some large directories:

$ cd /var/pkg

$ du -sh *

4.6M    catalog
1.5K    cfg_cache
892M    download
1.5K    file
4.5K    history
19M     index
1.5K    lost+found
146M    pkg
318K    state

In this specific case, pkg downloaded close to 900MB to the download directory, but failed to remove the downloaded files once the image was updated. :( The pkg tool currently doesn’t have a purge option to remove old stuff in this directory, so I had to go in manually and remove everything in the download directory. It appears bug #2266 is open to address this, and removing the contents from the download directory is safe (at least according to a post I read on the pkg mailing list). I think I prefer yum to the pkg tool, but hopefully I can be swayed once pkg matures a bit more!