When all goes bad and you can’t get to the web interface of your Netgate pfSense, you’ll have no option but to try using the CLI (command line). This happened to me recently and this article explains what i did to recover.
A few worthy points:
- The pfSense configuration file (a single file) is stored in “/cf/conf/config.xml“.
- Backup configuration files are stored in “/cf/conf/backup/“.
- Copying the configuration file from the backup location over the top of the current configuration is effectively the restore process.
These are the steps to restore back to a previous state. I’m assuming the system wont boot as normal and therefore “single user” mode is needed.
- Boot the Netgate with the mini-USB cable connecting the Netgate appliance to your workstation.
- Very near the start of the booting process, there’s a prompt to boot with options. Select to boot into “single user” mode.
- When you get a prompt, remount the filesystem into read/write mode using “mount -u /cf”.
- Check the filesystem for errors and repair them with “fsck -yf /“.
- Locate and copy the restore file from the “/cf/conf/backup/” directory. Go back a few stages (not the latest file) based on the times of the backup files. Copy it with “cp /cf/conf/backup/config-1593242670.xml /cf/config/config.xml“.
- Remove the file “/tmp/config.cache” using “rm /tmp/config.cache“.
- Run the command “/etc/rc.reload_all start“.
- Reboot using “reboot“.
When the device reboots, it should be back-dated (in terms of the config) to the date of the restore file.