Removing old perl version from system

Bill Moran wmoran at
Fri Feb 18 15:26:04 GMT 2005

BSD todoo <bsd at> wrote:

> Hello again !
> I have all these version of perl installed on my system (FreeBSD 5.2.1) 
> : 5.6.1           5.6.2           5.8.5           5.8.6
> I would like to get rid of the old versions and only keep 5.8.6 how do 
> I have to do that ??
> The reason why I would like to do that is that when I upgrade the port 
> tree I found that modules sometimes get confused and switch to the old 
> 5.6.1 module !!

I recently did something similar to this for a client.  In my case, there
were only two perls installed (5.6.? and 5.8.?)

In my case, I was able to easily deinstall perl 5.8.  I then used
portupgrade with the -o option to replace perl 5.6 with perl 5.8.  It
seems a little roundabout to deinstall 5.8, only to reinstall it, but
it got the job done.  I used portupgrade with the -f option to force
all software dependent on perl to be rebuilt.  After that, all worked,
and I only had perl5.8.

I do remember one glitch: somewhere during process, the system reverted
to using perl 5.005 (this was FreeBSD 4.11) and I had to manually
'use.perl port' to fix that.  Not a big deal, except I had to repeat
a number of steps because I didn't realize it had happened.  Watch for
this using 'perl -v' between steps ... but it shouldn't happen on
FreeBSD 5.x.

In your case, I expect it will be a little more complicated.  If it were
me, I would start out by deinstalling everything not necessary to the
system's operation, as well as anything that's perl-dependent and won't
be difficult to reinstall (some packages require a lot of work, others
are a breeze ...)  I would then see if I could deinstall perl 5.6.1
and perl 5.8.5.  If that worked, I'd be back to where I was on the
other system, and I could simply remove 5.8, and then do
'portupgrade -o lang/perl5.8 perl-5.6.2' (please note that command is
from memory, and may not be perfectly correct.  Once I had it down
to just perl 5.8, I used 'portupgage -fr perl'.  This tells the system
to rebuild/reinstall all packages that depend on perl, whether they
need upgrade or not.  Note that this is probably overkill, but I'd
rather over than under.

Be wary that some of those portupgrade commands can take a LONG time,
and if you have some things you don't want to upgrade, they could
bite you.  Liberal use of the -n option to portupgrade is recommended
to ensure that it's not doing something you don't want it to do.
If you get stuck with getting things deinstalled, you can either
deinstall all packages dependent on them, or use the -f option to
force the operation.  The former is more time-consuming, the latter
can be risky.

Do this during non-production time, as it's likely that many perl apps
will have trouble during the process and will need restarted to work
again after the process is finished.

> What are the pros and cons of doing such an uninstall ??

Pros are that the system will be easier to maintain.  You're system will
have less programs with vulnerabilities installed, and will use less
disk space.

Cons are that you'll spend less time working with this system, and it's
less likely to get cracked, so if you get paid by the hour, you'll make
less $$.

Good luck.

Bill Moran
Potential Technologies
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-questions mailing list