Friday, 4 December 2015

Upgrading PacketFence 5.4.0 to 5.5.1

In a previous post, I mentioned upgrading PacketFence seemed fairly straightforward.

Once I turned on pfsetvlan, I started getting errors along the lines of: ERROR: Failed to load module pf::Switch::PacketFence: PacketFence (pf::SwitchFactory::getModule)
Dec 04 15:19:34 pfcmd.p ERROR: Can not load perl module for switch, type: PacketFence. The type is unknown or the perl module has compilation errors.  (pf::SwitchFactory::__ANON__)
Dec 04 15:19:34  FATAL: Can't call method "new" on an undefined value at /usr/local/pf/lib/pf/ line 165.
in /usr/local/pf/logs/packetfence.log -even when I deleted custom switch definitions (i.e. my HP MSM). As it came with pfsetvlan disabled and this error seemed to be specifically related to turning pfsetvlan on, I suspect there may be an issue with it. On the off chance this fixes it, I'm going to do an upgrade.

As usual, you should check the specific upgrade instructions given, and read changelogs, just in case - particularly on a production system...


Upgrading 5.4.0 to 5.5.1

Log into a shell on the PacketFence server

service packetfence stop
(if you have a cron job that restarts packetfence automagically when it "dies", then disable it)
wait for services to stop.

service packetfence-config stop
Wait for that to stop

yum update packetfence --enablerepo=packetfence

The yum process will then check for updates, give you a summary of what it thinks should be updated how large the combined download will be, and then ask you y./N whether to continue. Enter y if you're happy and press enter. In this case, there are 47 required packages, totaling some 63 megabytes.

The various required packages will then download and install. Hopefully, from a mirror fairly close by, which is quick!

At the end it will give you a Complete! and return you to the shell.

PacketFence suggest you should check for changes with:

find /usr/local/pf -name \*.rpmnew
In my case, this returned

They suggest:

"Compare them to your existing version and see if there are changes that should be merged into your existing configuration. Then, once you are done make sure to delete these files so that there is no confusion the next time you upgrade PacketFence."

Using diff, you can achieve this quite easily (or at least see if there are any "significant" changes). 

The specific command in this case is:
diff /usr/local/pf/conf/profiles.conf /usr/local/pf/conf/profiles.conf.rpmnew  -y  --side-by-side
which displays the two side by side, highlighting only the changes. They are minor, and apart from the billing_engine line, which I simply deleted, only relate to config changes I've made - which I want to keep - not massively changed functionality, so I can ignore the changes and delete the .rpm version. You should be similarly lucky unless you've made major changes yourself. 

The oh-so-handy diff function
Once you're happy with that, remove the rpm file. 
 rm /usr/local/pf/conf/profiles.conf.rpmnew
There are also changes to the database schema, so you'll have to run this command:
mysql -u root -p pf -v < /usr/local/pf/db/upgrade-5.4.0-5.5.0.sql
it will prompt you for your mysql root password. After that, it should complete your schema update:
MySQL schema update
service packetfence-config restart 
service packetfence restart 
and you should be back up again. Watch the output for any errors; they're usually helpful, and more detail will likely be in the packetfence.log file.

If you run
/usr/local/pf/bin/pfcmd version
it should output:
PacketFence 5.5.1

Fairly painless!

No comments:

Post a Comment