Opnsense reverts to an old configuration

Started by Inxsible, October 04, 2022, 04:44:05 PM

Previous topic - Next topic
October 04, 2022, 04:44:05 PM Last Edit: October 04, 2022, 05:04:42 PM by Inxsible
I was making some changes to the Opnsense HAProxy configuration to add a new service for AdGuard Home. However, when I saved the HAProxy configuration, Opnsense reverted to a very old configuration that I used months ago. Please see the screenshot.

I no longer use a Multisite VPN or NordVPN. I had removed all of that including the NordVPN interface etc. some months ago. I also use the os-cicada theme, but it reverted to the opnsense theme. This had happened to me once before, but I didn't realize why, and since I backup the config nightly, I just reloaded the old config and forgot about it

Can someone tell me if Opnsense saves an old copy of the configuration somewhere in it's storage and if so, how can I update that to the latest config that I want to use.

Thanks in advance.

This happened again when I reset the configuration from last night and then tried to create a new entry for AdGuard Home in HAProxy.

The third time, I just save the config manually before adding the entry and kept taking backups of the configuration after every step but it is quite annoying to have your config reset to a few months old as many things will have changed.

Does anyone else HAProxy plugin that can confirm this issue? I admit that it is intermittent and when I saved a backup configuration after every step, I didn't encounter the issue.

This happened to me yet again when upgrading from 22.7.6 to 22.7.7_1. It reverted to a very old config when I used to have NordVPN clients etc.
Worse thing was that I could no longer access my NAS in order to upload a nightly saved configuration copy. I had to manually mount my NAS as NFS using the IP and then copy the configuration over.

I have not had this problem when upgrading opnsense before but this is much recent -- at least the last 3 or 4 upgrades. Can some please provide some pointers as to where the old config is being saved so that I can update it with the latest copy?

I had exactly the same problem. I was not upgraded yet to  22.7.7_1.

I was make some firewall modifications, and noticed a change in rules. I was missing data, that definitely was there before.

I noticed yesterday also that my IPTV did not work anymore, why i did not know yet.

Today i did an upgrade to  22.7.7_1, and my SSL certifictes from Lets Encrypts where changed during the upgrade to a year back. After reboot, all my IPSEC configurtion was also set back to long a go configurtion and my Interfaces had a configuration of a year back, as my ISP has changed this year.

So with the upgrade something really went wrong... Lucky have a daily backup script on my NAS, so i can restore my settings of last week. As i don't trust my configuration anymore.

Something is really wrong, as it looks like multiple users are facing this issue?


When it would revert, the previous version(s) would still be stored in the backup, which is accessible via (System -> Configuration -> History).

In case it does automatically restore (which only happens when an un-parsable config is found), the machine would send a message to the (system) log about the event as well:

https://github.com/opnsense/core/blob/20a3c3da3869751ecacd306e267c53059a5f7973/src/opnsense/mvc/app/library/OPNsense/Core/Config.php#L330-L341

Best regards,

Ad

It was a restore of about 1 year ago. Not a factory default reset or something like that.

It as the configuration of about 12 months ago.

I could also not find any logs with "factory" in it.

So this was not happening in this case.

November 13, 2022, 05:06:34 AM #6 Last Edit: November 13, 2022, 05:30:24 AM by Inxsible
Quote from: AdSchellevis on November 11, 2022, 03:10:20 PM
When it would revert, the previous version(s) would still be stored in the backup, which is accessible via (System -> Configuration -> History).

In case it does automatically restore (which only happens when an un-parsable config is found), the machine would send a message to the (system) log about the event as well:

https://github.com/opnsense/core/blob/20a3c3da3869751ecacd306e267c53059a5f7973/src/opnsense/mvc/app/library/OPNsense/Core/Config.php#L330-L341

Best regards,

Ad
Thanks for responding Ad.
The code seems be logging the exception if the config cannot be restored. Where would I find that log -- just so that I can see what in the config is incorrect such that the restore fails with a ConfigException?

I checked my configuration history and originally had about 37MB of history. So the question still is why would it revert back to a config which was some months old and not the recent one?Also I haven't had this happen on every reboot and this definitely is intermittent.

In any case, since I was on the page, I reduced the Backup Count to 5 -- which effectively deleted all my old configurations from the history and kept only the latest ones. The hope is that next time it would just pick up one of the 5 latest configurations. I have reverted the Backup Count back to empty, so it would now save the history beyond the 5 recent files.

Under System>>Log Files>>Web GUI  I do see the following a few times:

2022-11-07T16:38:20-06:00 Error lighttpd (configfile.c.1287) WARNING: unknown config-key: server.dir-listing (ignored)

but I am not sure if it is related to be honest.