FreeNas – recovering from an upgrade that wipes out OpenVPN

Upgraded a couple of my FreeNas servers from 8.3.0 to 8.3.0 p1 last night.  That part went great.  What didn’t work as well is when I got to work today and tried to connect to the VPN on one of them.  Seems that the bone-head in me forgot that upgrading the FreeNas OS would wipe out the modifications to rc.conf to start OpenVPN as well as wipe out the entire /usr/local/etc/openvpn directory with all of the keys and openvpn configuration in it.

The nice folks over at FreeNas.org have anticipated me being a doof and created the upgrade process such that the old OS is preserved.  You can easily roll back to that if you are infront of your server by rebooting and hitting F2 (possibly F1) at the boot loader.

My problem was I wasn’t infront of my server and needed the VPN up ASAP.  So, I reached out to my big brother (Josh Paetzel) and magically the answer appeared in my inbox.

  1. ssh into the server.
  2. su to root
  3. mount
  4. You are looking for this “/dev/ufs/FreeNASs2a on / (ufs, local, read-only)”If it says that, then your old install is /dev/ufs/FreeNASs1a, if it says FreeNASs1a then the old install is FreeNASs2a
  5. Either way, mkdir /mnt/oldinstall
  6. mount /dev/ufs/FreeNASs1a /mnt/oldinstall 
  7. or mount /dev/ufs/FreeNASs2a /mnt/oldinstall
  8. ls /mnt/oldinstall/conf/base/etc/local/openvpn
  9. mount -uw /
  10. cp -r /mnt/oldinstall/conf/base/etc/local/openvpn /conf/base/etc/local/.
  11. grep openvpn /mnt/oldinstall/conf/base/etc/rc.conf >> /conf/base/etc/rc.conf
  12. Either reboot or repeat steps 10 and 11 replacing /conf/base/… with /etc/rc.conf and /usr/local/etc/openvpn

A great big thanks to Brother Josh on this one.  Always there saving me from myself.  Hope this helps someone else in some way, shape or form.

Advertisements

2 thoughts on “FreeNas – recovering from an upgrade that wipes out OpenVPN

  1. Hi there Joe,

    I was just about to update FreeNAS to 8.3.1P2 when i tumbled upon this post.
    Could you tell me what i should do before (and after) upgrading FreeNAS so that i keep my OpenVPN?

    Kind regards,
    Dimitri

    • The thing to do before is backup /conf/base/etc/local/openvpn and /conf/base/etc/rc.conf to a data drive or off the server completely.

      After upgrading, restore your backup of /conf/base/etc/local/openvpn and then add in the openvpn portions of rc.conf into the new rc.conf at /conf/base/etc/rc.conf

      I would not restore rc.conf from your backup just in case there was a change between the versions. Some day, I plan on working out a strategy that will make the upgrade process a little easier. Will probably have to do with having the openvpn directory live on a data drive. Will probably be a toss up to see if FreeNas fixes this issue or if I come up with a work around post first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s