HowTo: Downgrade a Port on FreeBSD

Example

collectd5 in version 5.9.0 is broken and you upgraded it everywhere. But because it's FreeBSD it does not restart running services. After every old version is removed from /var/cache/pkg you restarted collectd and it does not start anymore, you really want to downgrade to 5.8.1 again. But even pkg now has 5.9.0 and you need your own make config setup anyway.

portdowngrade

Enter portdowngrade. Install it via pkg install portdowngrade.

You might want go to /root and run the next command should the folder not yet exist. You will see why at the end.

# mkdir portdowngrades && cd portdowngrades

It helps you along the way, so you can just naively type

# portdowngrade collectd5

and it takes a moment and will tell you, that this might not be specific enough, so it tells you to be more specific

collectd5-5.9.0_1	-> net-mgmt/collectd5

Choose a port origin (directory) from the list above, and then run portdowngrade category/port

So you know to tell it, where to find collectd5 and type the one you mean

# portdowngrade net-mgmt/collectd5

It will then blurt out a long list of revisions you can go back to, but the last line says what you need to do

Choose a revision from the above list and run /usr/local/sbin/portdowngrade net-mgmt/collectd5 revision

You could also just go to FreshPorts collectd5 Show archive.org snapshot and search for a suitable revision there. Once you know where you want to downgrade to, call it once again

# portdowngrade net-mgmt/collectd5 r497411

portdowngrade does NOT change /usr/ports in any case (anymore, apparently) and instead adds the old revision as a directory your current $PWD as well as copies your config. You can use this directory just as you would use /usr/ports/net-mgmt/collectd5/ and reinstall the old version from there now.

Marius Schuller Over 4 years ago