# Install older versions of a port or package



## mack3457 (Jan 11, 2015)

Hi!

I upgraded our server to FreeBSD 10.1 last week and I'm now facing some problems (bugs) with the ImageMagick 6.9.0-2 binary package installed.

So I would like to downgrade to 6.8.* - can this be done with `pkg`?

There is an ImageMagick-6.8.9.8,1 package in http://pkg.freebsd.org/freebsd:10:x86:64/release_1/All/, which would be fine for me. But how to install this / replace the current version with that one?

Thanks for any hints,
Thomas Mack


----------



## pkubaj (Jan 11, 2015)

You can download a package and install it using `pkg add package.txz` or use ports-mgmt/portdowngrade/ to downgrade a port if you don't have the package.


----------



## junovitch@ (Jan 12, 2015)

The old package is most likely in /var/cache/pkg.  You can remove the current version and add the old package with `pkg add <pkgname.txz>`.  It would be good to sanity check the end result with `pkg check -d` and `pkg check -B` to make sure things are in a consistent state.


----------



## mack3457 (Jan 12, 2015)

Ok, yes, thank you.

I tested a little on a VirtualBox copy of the server and it seems I could even downgrade by a simple `pkg install ImageMagick-6.8.9.8,1.txz`.

So this pkg(8) is really smart to use - very nice.


----------



## mack3457 (Jan 15, 2015)

So, ImageMagick 6.8.9.8,1 does not include png-support, but 210 other formats, so this is bad.

Trying 6.8.0.7_5,1 requires some different libraries, so this doesn't work as well.

We need png support in not too many cases, so we can switch to some other image format for them, but just to know the procedure: can we download an older ImageMagick _port_ to compile it ourselves?

E.g., downloading from http://svnweb.freebsd.org/ports?view=revision&revision=372435 (and others?) and putting these files somewhere in an extra directory in /usr/ports/graphics and installing from there?


----------



## wblock@ (Jan 15, 2015)

Yes, although playing games with older versions will often lead to problems.  A longer-term solution is to find and fix the problems with the current version of ImageMagick.  Or see if the same problem exists with graphics/GraphicsMagick, which is very similar.


----------



## mack3457 (Jan 15, 2015)

Ok, checking with truss it came out to be a problem with libpng and not with ImageMagick, which is the wrong version (png16) for ImageMagick-6.8.9.8,1.

Found png-1.5.17.tbz and extracted libpng15.so.15 from it - this works fine now.

Thanks for your support,
Thomas Mack


----------



## wblock@ (Jan 15, 2015)

That's a very fragile way to fix the problem.  Why not just rebuild ImageMagick to use the new PNG?


----------



## junovitch@ (Jan 15, 2015)

For mack3457, keep in mind that the ports tree should be updated as a single unit. I can understand this if ImageMagick is broken if it's built with the new PNG.  The right answer is to report what you see as a bug on Bugzilla so the port gets fixed. Doing anything else should only be a short term work around.


----------



## mack3457 (Jan 16, 2015)

The package 6.8.9.8,1 was from FreeBSD 10.0, so maybe 10.0 has png15.

`make deinstall reinstall` on 6.8.9 had some dependency issue(s), so I didn't like to follow that path.

The problem with 6.9.0-2 is a bug I reported to ImageMagick and they confirmed it and said it to fix it on 6.9.0-4beta. I don't think the package or port maintainer will create a new version based on beta versions, so, downgrade was the better solution for me as long as 6.9.0.4 isn't out.

Putting the required library in /usr/local/lib ist the "least invasive" method to reactivate png support for some well known activities on the server. I just delete it on a next ImageMagick update, so this is good.

And yes: I would have tried to report it, but Bugzilla had some problems that day. And maybe it would have been a WONTFIX, as 6.8.9,1 was not packed for 10.1. So it remains a problem with "how to install previous versions on FreeBSD?". Which seems to be answered as: "you may try, but it's not really supported".


----------



## junovitch@ (Jan 18, 2015)

PNG is a port, graphics/png, so all that matters is the FreeBSD is a supported release as the ports tree is only supported in that case.  The /usr/local is the giveaway here that it's not part of base FreeBSD (see hier(7)).  The /usr/ports/UPDATING entry describes what was done that required the library version bump.



> 20141225:
> AFFECTS: users of graphics/png
> AUTHOR: antoine@FreeBSD.org
> 
> ...



It would still be worth reporting the bug.  As you had said the issue was already identified upstream and that information could be very helpful. The graphics/ImageMagick maintainer can include the patch for just this fix as part of the port and doesn't have to switch to a beta version.  The local patch won't be needed when ImageMagick is updated.


----------



## mack3457 (Jan 19, 2015)

Now I reported it as a bug to FreeBSD as well (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196870).

As the problem is rather unpredictable, people might not even know for a longer time they are affected by it. So it might be good to have a timely and public bug fix.


----------

