# reinstall without upgrading



## Darnell879 (Nov 12, 2010)

Hello,

A few months ago using portsmaster I installed a few ports. I believe it was ImageMagick and all of its dependancies. One bad thing resulted from this, this install "upgraded" my libjpeg.so from libjpeg.so.9 to libjpeg.so.10, and apparently did not recompile or relink what was already relying upon libjpeg.so.9. I believe that matters have been made worse since my ports tree has also been "updated" recently. This problem was not realized until recently either, when a user was attempting to use a binary that wanted libjpegso.9.

I have done some serious poking around the system with various utilities, to find what was broken by libjpeg.so being 10 and not 9, and all of the dependancies, and dependent upons, and have come to the conclusion it would be far better on the system if there was a way I could reinstall the versions that I have installed, but was able to link it to libjpeg.so.10. Otherwise, it is going to be a very long process, and would more than likely be better off updating and rebuilding just about all of my installed ports.

This machine is a production machine. I have a limited window in which to get this issue fixed. How may I rebuild or reinstall the same version of these ports that I currently have installed?

Thank you very much in advance.


----------



## SirDice (Nov 12, 2010)

If you have ports-mgmt/portmaster installed you can rebuild jpeg and everything that depends on it like so:
`# portmaster -r jpeg-`

It's also mentioned in /usr/ports/UPDATING which you should read before updating any port.



> 20090719:
> AFFECTS: users of graphics/jpeg
> AUTHOR: dinoex@FreeBSD.org
> 
> ...


----------



## jb_fvwm2 (Nov 12, 2010)

A slight chance that 
	
	



```
cp -iv libjpeg.so.10 /usr/local/lib/compat/libjpeg.so.9
```
 might work. You'd want to eventually remove the latter copied file if it does.


----------



## wblock@ (Nov 12, 2010)

Darnell879 said:
			
		

> Hello,
> 
> A few months ago using portsmaster I installed a few ports. I believe it was ImageMagick and all of its dependancies. One bad thing resulted from this, this install "upgraded" my libjpeg.so from libjpeg.so.9 to libjpeg.so.10, and apparently did not recompile or relink what was already relying upon libjpeg.so.9. I believe that matters have been made worse since my ports tree has also been "updated" recently. This problem was not realized until recently either, when a user was attempting to use a binary that wanted libjpegso.9.
> 
> ...



You'd have to restore the ports tree (/usr/ports/) to a time before the jpeg update (see the *date* keyword for csup(1)), and then rebuild everything that has been built since then.  That's pretty much the same process as updating everything, although more fiddly and harder to get right.  And the distfiles for the older versions may no longer be available.

So updating all ports is probably the more practical way to go.  The *-n* option to portmaster or portupgrade helps to see what to expect.

Upgrading FreeBSD Ports

pkg_libchk(1) from sysutils/bsdadminscripts can help determine which applications are missing which libraries.


----------



## DutchDaemon (Nov 12, 2010)

If you're really far behind on the entries in /usr/ports/UPDATING you might want to deinstall and reinstall all ports, as outlined on the last page of portmaster(8). From a fresh ports tree, of course.


----------



## qsecofr (Nov 12, 2010)

That would be a nice feature to have in portmaster:  rebuild in-place, even if a newer version exists in the ports tree.  If it does exist already, then I've not read the man page carefully enough.

I've also gotten good mileage from ports-mgmt/portdowngrade.  Not sure it's applicable for the OP.  I didn't see if ImageMagick required that particular version of jpeg.


----------



## DutchDaemon (Nov 12, 2010)

qsecofr said:
			
		

> That would be a nice feature to have in portmaster:  rebuild in-place, even if a newer version exists in the ports tree.



portmaster(8):


```
Alternatively you could use portmaster -a -f -D to do an ``[B]in place[/B]''
     update of your ports.  If that process is interrupted for any reason you
     can use portmaster -a -f -D -R to avoid rebuilding ports already rebuilt
     on previous runs.  However the first method (delete everything and rein-
     stall) is preferred.
```

The *-a* and *-f* flags guarantee that all ports are rebuilt, regardless of version.


----------



## wblock@ (Nov 12, 2010)

DutchDaemon said:
			
		

> portmaster(8):
> 
> 
> ```
> ...



Not the same thing, though.  Using -a -f -D will rebuild every installed port, based on what is currently in the ports tree.  Old ports will be updated to whatever's in the ports tree.  To rebuild and keep old versions when /usr/ports/ has newer versions, you'd have to integrate ports-mgmt/portdowngrade.  And the mistake there is assuming that a rebuild of the old version in place would solve the problem; libraries change, and as we saw with the png port, the applications sometimes have to be changed to match.

Sometimes people do a lot of work to avoid doing a little work.


----------



## DutchDaemon (Nov 12, 2010)

Oh right, I read "even if a newer version exists in the ports tree" with a slightly different intention  To me, that meant: "rebuild, even if it means upgrading".


----------



## phoenix (Nov 14, 2010)

Uhm, if the Makefiles in the ports tree are updated to refer to a different version, how do you expect to be able to "rebuild in-place" using the existing version?  You're asking for a physical impossibility.


----------



## qsecofr (Nov 14, 2010)

Definitely wishful thinking on my part.  Hence, the mileage I've gotten with portdowngrade.  I just wondered if the OP might have had a quicker fix by downgrading the one port that seemed the root of the problem, instead of updating more & more.  It wasn't clear to me if ImageMagick depended on a specific version of the shared library.  And if not a solution for this specific  problem, then downgrading may not be a bad thing to keep in the back of one's mind for the future.


----------

