How to do a clean reinstall of a port?

Reinstalling a port is sometimes problematic: files are not always cleaned out from the folders involved or some perhaps get corrupted. One way to fix this is to reinstall the whole operating system and all programs. But this is an absurd way. There must be a simpler way that I do not find documented.

The proof of the pudding:

A reinstall of x11-fm/filerunner and its only dependencies (Tcl/Tk): on first running of filerunner a folder /root/.fr and its files are not created as in the original install and startup. And a file related to Tcl, wish.conf retains erroneous links to non-existent files from previous installations: where /usr/local/etc/wish.conf should contain WISH=/usr/local/bin/wish8.5 contains wish8.6 if Tcl-8.6 was a previous install. And the original install of Tcl remains the reference in that instance regardless of subsequent installations/reinstallations.

Is there documentation for reinstalling and where?

Any help would be appreciated.
 
philjor said:
One way to fix this is to reinstall the whole operating system and all programs. But this is an absurd way.
Indeed, because there's never a reason to install the whole operating system again for this. FreeBSD isn't like Linux, the ports collection has no "ties" into the operating system itself, normally the ports can never disrupt it.

Therefore starting over basically consists of wiping out /usr/local, best done by using the pkg_delete program first (to empty the package database), then wipe out anything left yourself (this is assuming the use of the default package system instead of the currently favoured pkgng).

After that you can start over.

philjor said:
A reinstall of filerunner and its only dependecies (Tcl/Tk): on first running of filerunner a folder /root/.fr and its files are not created as in the original install and startup.
That leads up to the question how did you (de/re)-install all this?

philjor said:
And a file related to Tcl, wish.conf retains erroneous links to non-existent files from previous installations: where /usr/local/etc/wish.conf should contain WISH=/usr/local/bin/wish8.5 contains wish8.6 if Tcl-8.6 was a previous install.
That is something I think I can understand, if I understood you right. Some ports will change configuration files during the installation procedure (for example; installing a PHP extension will most likely result in its addition to the extensions.ini file).

However there are also many which only provide a "one time only" setup, so they provide a default configuration file but from that point on (or better put: if this file exists) then it's not being touched what so ever.

I don't know if this applies to this port, but it might explain it's behaviour. If the config file was already there then I can understand it hasn't been touched.

Still, a lot depends on your used methods on installing and re-installing.

philjor said:
Is there documentation for reinstalling and where?
Any help would be appreciated.
Well, the best documentation on handling ports is in my opinion chapter 5 of the FreeBSD handbook: Using the Ports collection.

Even so, my advice would be to pick up on ports-mgmt/portmaster, if you haven't already done so. It's an invaluable tool when it comes to port maintenance, and it can also help you out with the process of installing and reinstalling.

For example; there is a difference in port dependencies. You have run time dependencies, but also build time dependencies. And depending on how you (re)install a port, it's not always a given that reinstalling a port will also automatically reinstall (or "rebuild") every port it depends on.

But that's something where portmaster can help out.
 
You can also "simulate" a clean reinstall of FreeBSD by creating a FreeBSD jail(8)() (with this you really simulate a new system), or chroot(8)() (that's not really a new system, but I've found it good for debugging). This way you can see how your ports would behave on a clean freshly installed system, so you don't reinstall your FreeBSD.

You can also use jails to create your own binary packages from ports, and then distribute them to your host system, and keep packages on the jail as backups, where they represent a clean system.
 
  1. I am using portmaster; that does not fix problem.
  2. Normally, if there is a configuration file, I do # make config, then # make deinstall clean, # make reinstall
I rarely have problems, and when I do it's usually something stupid that is my own fault because of impatience and carelessness. :(

I just set up another machine that I was using without xorg since xorg crashes the OS when I check the configuration as per the manual:
Ctrl+Alt+F1 and then Ctrl+C
Still crashes; but I tweaked xorg.conf and xorg now starts up with fluxbox; I installed filerunner but I get the exact same error - small window with title wish8.5

What is really frustrating is that I did have filerunner working on FreeBSD 9.1; I just can't figure out why I cannot get it running again. Something smells rotten here, as Hamlet might observe... surely there is someone in the FreeBSD community who is running filerunner on FreeBSD 9.1?
 
Does portmaster -a -f -G not do the job?

Edit: old configuration files for installed ports are left there by design - so that any custom configuration you have done is retained.

From the portmaster man page:

Code:
     Using portmaster to do a complete reinstallation of all your ports:
           1. portmaster --list-origins > ~/installed-port-list
           2. Update your ports tree
           3. portmaster -ty --clean-distfiles
           4. portmaster --check-port-dbdir
           5. portmaster -Faf
           6. pkg_delete -a
           7. rm -rf /usr/local/lib/compat/pkg
           8. Back up any files in /usr/local you wish to save,
              such as configuration files in /usr/local/etc
           9. Manually check /usr/local and /var/db/pkg
              to make sure that they are really empty
           10. Re-install portmaster
           11. portmaster `cat ~/installed-port-list`

Then, restore the configuration files that you backed up from /usr/local/etc that you wish to re-use.
 
philjor said:
  1. I am using portmaster; that does not fix problem.
  2. Normally, if there is a configuration file, I do # make config, then # make deinstall clean, # make reinstall

If you mean a complete reinstall really, using portmaster to do a complete reinstallation of all your ports usually works as described in its man page, in examples section:
  1. portmaster --list-origins > ~/installed-port-list
  2. Update your ports tree
  3. portmaster -ty --clean-distfiles
  4. portmaster --check-port-dbdir
  5. portmaster -Faf
  6. pkg_delete -a
  7. rm -rf /usr/local/lib/compat/pkg
  8. Back up any files in /usr/local you wish to save, such as configuration files in /usr/local/etc
  9. Manually check /usr/local and /var/db/pkg to make sure that they are really empty
  10. Re-install portmaster
  11. portmaster `cat ~/installed-port-list`

If something goes wrong this way, check if you have old libs: Handbook - 25.8. Deleting Obsolete Files, Directories and Libraries

I did this to get the ports system stable again after several upgrades for two machines :)

Oh, another hint: after you clean your system, but before re-install, use portmaster -n to configure all ports before you build them. This way you will speed up the whole process and accurate the options configured for the set of ports. Combine more options as necessary.
 
I finally got the answer I needed. The problem was indeed in need of a clean reinstall but the cause was an outdated ports tree.
Since I had just installed FreeBSD 9.1, I mistakenly assumed that the ports tree was up to date; I even got a message at one point that it was up to date. So, updating the ports tree fixed the minor problem, but now I have to do a complete reinstall. What a bummmer.
Thank you all for your help. Glad to have the directions for portmaster laid out so nicely.
 
philjor said:
I finally got the answer I needed. The problem was indeed in need of a clean reinstall but the cause was an outdated ports tree.
Since I had just installed FreeBSD 9.1, I mistakenly assumed that the ports tree was up to date; I even got a message at one point that it was up to date. So, updating the ports tree fixed the minor problem, but now I have to do a complete reinstall. What a bummmer.

A complete reinstall is not needed, just an update of ports. ports-mgmt/portmaster exists for that purpose. See Upgrading FreeBSD Ports.
 
Back
Top