# Newbie question about package management



## blumstng (May 29, 2009)

I have installed some packages using the pkg_add system.  One of them being clamav.  Well, I would like to upgrade to the newer package but I have made some changes to configuration files and such.  I don't find a pkg_update function, so what would be the best way to upgrade the package and not loose my changes?

Can I uninstall the old package and install the new, or can I just do a pkg_add -f on the package?  Simply doing a pkg_add on the new package fails.  Am I missing an "update" switch I can throw somewhere?


----------



## hydra (May 29, 2009)

Hello, the answers to your questions may be found in the handbook:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports.html
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html


----------



## DutchDaemon (May 29, 2009)

Check out sysutils/bsdadminscripts. It contains a pkg_upgrade utility.


----------



## blumstng (May 29, 2009)

DutchDaemon,

Thanks for the pointer at the pkg_upgrade script.  I had seen the information about ports, and had already looked in the handbook and didn't see anything like portsupgrade for packages.


----------



## DutchDaemon (May 29, 2009)

There is, and it's called portupgrade  If you use portupgrade with the -PP option, it will work with packages only. The downside is that it needs a full ports tree installed (for version information), and it will use the port version to tell you that packages are 'behind'. 

Unfortunately, portupgrade doesn't know whether updated packages are actually available, so it will just keep on taunting you with messages about packages being outdated without a solution in sight. Packages can be lagging behind ports several months. 

The pkg_upgrade script works with the version information on package sites, so it will always know when an available package is newer than the installed one. And upgrade it for you.


----------



## blumstng (May 29, 2009)

ok.  One little problem.  pkg_upgrade wants to upgrade everything.  I don't want to do that.  I just want to upgrade one single package to the version which I have downloaded.  Specifically, if version 0.93 of clamav is installed, I want to upgrade to version 0.94 (which I have downloaded) of clamav (and only clamav).  I use clamav as an example.


----------



## DutchDaemon (May 29, 2009)

Since I don't use packages myself, I'm not familiar with the inner workings of pkg_upgrade. I'd assume there was a command-line flag telling it to operate on a single package. But I don't know that for sure. I do know that the author of the script is on this forum, so I hope he chimes in.


----------



## mdg583 (May 31, 2009)

It seems to me that packages in FreeBSD are in a little bit of limbo. (For one thing they are a part of a google summer of code project).

I read this really nice article about ports and packages in Freebsd, written I think by one of the developers, but I can't find it now. It basically introduced pkg_upgrade, and as far as I can remember it said it was supposed to be used just for major upgrades (e.g. upgrade your entire system after a release). I gave it a try to upgrade from 7.1 to 7.2, and it worked really well. Saved me a lot of build time. 

It seems like only in CURRENT are there up-to-date packages. I have never run a -CURRENT system, but on every other system it pretty much seems like packages are built at the beginning of a release, and if you want to keep up to date after that you have to build from ports. (there is only one ports tree, but packages are built separately for the different releases.)

So, for me, if I don't run -CURRENT, it seems like a lot of hassle to ever upgrade my ports tree, because then I have to upgrade everything by compiling from ports, since there seem to be no new packages for releases.


----------



## DrJ (May 31, 2009)

mdg583 said:
			
		

> It seems like only in CURRENT are there up-to-date packages.
> <snip>
> So, for me, if I don't run -CURRENT, it seems like a lot of hassle to ever upgrade my ports tree, because then I have to upgrade everything by compiling from ports, since there seem to be no new packages for releases.



That's not right.  -STABLE has a snapshot of up-to-date packages, and you can use those on any 7.x release too (since the ABI is the same).  You just have to point to the right "repository."


----------



## mdg583 (May 31, 2009)

Ah - so why would it be that the releases don't have up-to-date packages? (Does this page show the package status?) I guess I just point my system to here?


----------



## DrJ (May 31, 2009)

You have it right now.  Note that there is also 6-STABLE, which I did not mention.

The reason, in my opinion, is that 7.2-R (for example) is a well-developed and -tested snapshot of the 7 branch.  The packages for that release are the ones current on that day.  That does not change as things progress along the branch.

Current of course does not have a release.

This is just a nomenclature quirk, so I'd suggest you get used to it and move on.


----------



## DrJ (May 31, 2009)

Just to complete the discussion, from the handbook:

It is possible to change this behavior by overriding PACKAGESITE. For example, if you run a FreeBSD 5.4-RELEASE system, by default pkg_add(1) will try to fetch packages from ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5.4-release/Latest/. If you want to force pkg_add(1) to download FreeBSD 5-STABLE packages, set PACKAGESITE to ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5-stable/Latest/.


----------



## phoenix (May 31, 2009)

mdg583 said:
			
		

> Ah - so why would it be that the releases don't have up-to-date packages? (Does this page show the package status?) I guess I just point my system to here?



Packages are created for new releases, in order to have packages available on the release CDs.  After that, packages are only updated if there are major changes to the ports tree (KDE 4 releases, GNOME releases, Xorg releases, things that touch a large portion of the tree).  Packages really are only for convenience when setting up a new system, or when upgrading between releases.  One should not rely on packages.

Packages for 6-STABLE, 7-STABLE, and -CURRENT are done on a monthly basis, I believe, in order to test changes to the ports tree, among other reasons.  One can point the pkg_* tools to the -STABLE/-CURRENT package repos, and hope the packages will run on -RELEASE (they should, but there are no guarantees).

The ports tree is the primary software installation/upgrade mechanism.  If one wants to use packages, one of the recommendations is to set up a separate package-building machine (or jail) and use either *make package* or *pkg_create -b* to create custom packages from the ports tree.  Then copy those over to the other systems and install them using pkg_add.

There are different projects underway to make packages more useful, so maybe in the future one will be able to have a binary-only system.


----------



## mdg583 (May 31, 2009)

Thank you very much - that helps me understand things a lot better. I think I am happier never upgrading my system for now, but just waiting for the next release. Or I can upgrade using pkg_upgrade every month or so.

Matthew


----------



## mdg583 (Jul 17, 2009)

Here is the article I was talking about:
http://www.lpthe.jussieu.fr/~talon/freebsdports.html#htoc19


----------

