Monday, January 03, 2011

pkg(1) and local caching of downloads

When installing packages, the pkg(1) command, by default, caches the downloaded files under the /var/pkg directory.

If you're using IPS to install packages from local repositories (either over the network or from the filesystem) you probably don't want to store an additional copy of files you could easily obtain again.

The caching behaviour is controlled by the local image property "flush-content-cache-on-success". Setting it to "true" will cause the cache to be emptied when packages are installed successfully:

boyd@sol11:~$ pkg property flush-content-cache-on-success
PROPERTY VALUE
flush-content-cache-on-success False
boyd@sol11:~$ sudo pkg set-property flush-content-cache-on-success true
boyd@sol11:~$ pkg property flush-content-cache-on-success
PROPERTY VALUE
flush-content-cache-on-success True

Now, after a successful package install, the cached files that were kept around from older installs are removed:

boyd@sol11:~$ sudo pkg install desktop/synergy
Packages to install: 1
Create boot environment: No
DOWNLOAD PKGS FILES XFER (MB)
Completed 1/1 27/27 6.7/6.7

PHASE ACTIONS
Install Phase 56/56

PHASE ITEMS
Package State Update Phase 1/1
Image State Update Phase 2/2

PHASE ITEMS
Reading Existing Index 8/8
Indexing Packages 1/1
Deleting content cache

Monday, December 27, 2010

IPS file based repositories and zones

If you are using filesystem based (file://) repositories with IPS, rather than network-based ones, there is one caveat to worry about when making zones.

When a zone is created on Solaris 11, the set of repos to use is copied from the global zone. If you're using network-based repositories this is normally not a problem. There could still be an issue if you use "localhost" in your repo URLs, or the non-global zone does not have access to the network repos that the global zone does.

With filesystem-based repositories, however, the non-global zone almost certainly doesn't have access to the appropriate directories by default.

For example:
root@global# pkg publisher
PUBLISHER TYPE STATUS URI
solaris (preferred) origin online http://localhost/
boyd origin online file:/export/repo/boyd/
root@global# zoneadm -z cal install
A ZFS file system has been created for this zone.
Publisher: Using solaris (http://localhost/ ).
Publisher: Using boyd (file:/export/repo/boyd/).
[...]


root@cal:~# pkg refresh
pkg: 0/2 catalogs successfully updated:
Unable to contact valid package repository
Encountered the following error(s):
Unable to contact any configured publishers.
This is likely a network configuration problem.
[...]
2: file protocol error: code: 22 reason: The path '/export/repo/boyd' does not contain a valid package repository.
Repository URL: 'file:/export/repo/boyd'.

One way to deal with this is to loopback mount (read-only) the repo directory into the zone:

root@global# zonecfg -z cal
zonecfg:cal> add fs
zonecfg:cal:fs> set special=/export/repo/boyd
zonecfg:cal:fs> set dir=/export/repo/boyd
zonecfg:cal:fs> set type=lofs
zonecfg:cal:fs> add options ro
zonecfg:cal:fs> end
zonecfg:cal> exit

Now the zone can access the repo as it should.

Monday, December 20, 2010

IPS slides from MSOSUG December meeting

Another great turnout last week for the last MSOSUG meeting of the decade.

Andre talked on the Automated Installer (AI) for Solaris 11, while I talked about some of the lesser known parts of IPS (Choose File -> Download Original for a PDF).

There are a few points I didn't have time to cover that I'll try to mention over the next few weeks.

Hope these slides help.

Thursday, September 13, 2007

MSOSUG Live upgrade slides

Great turnout last night for the inaugural MSOSUG meeting.

Here's the slides I used for my talk on Live Upgrade.

Tuesday, September 11, 2007

Melbourne Solaris and OpenSolaris Users Group tomorrow night

Please join us for our first meeting!

Where?

Level 7, 476 St Kilda Road, Melbourne,

When?

September 12th, 2007 at 18:00 for general discussion.
Speakers start at 18:30, and we expect that each speaker will take up to one hour.

Speakers:
  • Nathan Kroenert: Niagara 2 CPU and Architecture exploration
  • Boyd Adamson: Solaris Live Upgrade: Using and abusing

Coffee, Tea and soft drinks provided.

A note on access: The Lifts in the building and entrance to Level 7 automatically lock early in the evening, so access will be provided by Sun folks on-site. A sign will also be placed close to the ground floor lifts with a contact number, should you arrive after the start of the meeting.
The Melbourne Solaris and OpenSolaris Users Group exists to explore Solaris, OpenSolaris and closely related technologies.

For those looking for more information on what this group will do in the future, come along to the first meeting, as we'll be spending some time talking about what it is that everyone is most interested in exploring. It is hoped that over time, everyone participating will have something to share with the group, be it 'their' implementation of something, or someone exploring the deeper aspects of some particular Solaris feature, right through to folks who are interested in directly contributing to the OpenSolaris movement. We'll also discuss the preferred frequency of regular meetings.

If you are interested in Solaris, doing interesting things with, or on Solaris, we want YOU!
See you there!

Tuesday, August 21, 2007

zsh DTrace Provider

Since there’s an effort underway to instrument various shells with dtrace probes, I thought I’d work on my shell of choice, zsh. Also, Brendan twisted my arm.

We’re trying to keep some uniformity between the shells, so I’m implementing the probes that Alan Hargreaves has documented.

So far, I’ve mostly finished the following probes:

builtin-entry
builtin-return
function-entry
function-return
script-done
script-start
And in simple use they look like this:
$ cat $tests/test_func_simple.zsh
#!./zsh

func()
{
echo "Hello from function"
return 1
}

func

$ dtrace -n 'zsh$target:::' -c $tests/test_func_simple.zsh
dtrace: description 'zsh$target:::' matched 8 probes
Hello from function
CPU ID FUNCTION:NAME
0 51903 zsh_main:script-start
0 51898 runshfunc:function-entry
0 51896 execbuiltin:builtin-entry
0 51897 execbuiltin:builtin-return
0 51896 execbuiltin:builtin-entry
0 51897 execbuiltin:builtin-return
0 51899 runshfunc:function-return
0 51902 zexit:script-done
dtrace: pid 16530 exited with status 1

And for something more elaborate:

$ cat $tests/basic_args.d

#pragma D option quiet

zsh$target:::builtin-entry, zsh$target:::function-entry
{
printf("%15s: %8s line: %d\n", probename, copyinstr(arg1), arg2);
}

zsh$target:::builtin-return, zsh$target:::function-return
{
printf("%15s: %8s ret: %d\n", probename, copyinstr(arg1), arg2);
}

zsh$target:::script-start
{
printf("Script %s starts\n", copyinstr(arg0));
}

zsh$target:::script-done
{
printf("Script %s done, return: %d\n", copyinstr(arg0), arg1);
}

$ dtrace -s $tests/basic_args.d -c $tests/test_func_simple.zsh
Hello from function
Script ../../tests/test_func_simple.zsh starts
function-entry: func line: 0
builtin-entry: echo line: 0
builtin-return: echo ret: 0
builtin-entry: return line: 0
builtin-return: return ret: 1
function-return: func ret: 1
Script ../../tests/test_func_simple.zsh done, return: 1


Note that the line numbers are all zero at the moment since I haven’t provided them yet.
There’s a few more probes to come and some cleanup to do, but I’m hoping to have a patch available soon.

Thursday, July 12, 2007

docs.sun.com now usable!

Great news from Michelle Olsen in this thread at the opensolaris discussions:

We also had a hardware upgrade last week for docs.sun.com that has made a huge difference in performance, give it a whirl.


I've tried it and it actually feels snappy! The site had gotten so bad lately that I'd taken to downloading PDFs, rather than crawl from page to page.

Hooray!