Version 25.1.5_5 Captive Portal Sessions Problem

Started by saleh, May 06, 2025, 12:41:32 AM

Previous topic - Next topic
After updating to the latest version 25.1.5_5, we are experiencing empty sessions in the Captive Portal Sessions. This issue does not occur immediately after a reboot, but it starts happening while the OPNsense router is running. It occurs multiple times a day. The sessions only reappear after we stop the captive portal, delete the captiveportal.sqlite file, and then restart the captive portal.

We are only facing this issue after updating OPNsense to version 25.1. Why is the captiveportal.sqlite file getting corrupted?

Services: Captive Portal: Sessions

Thank you

Note: Another thing there are no logs in the
Services: Captive Portal: Log File




May 14, 2025, 01:16:32 PM #2 Last Edit: May 14, 2025, 01:21:42 PM by saleh
Hello,
We are getting every day many log errors in the captive portal service regarding captiveportal.sqlite, what is the reson that the captiveportal.sqlite file is corrupted. please see the below logs and images.

025-05-14T13:44:39    Error    captiveportal    sqlite3 repair /var/captiveportal/captiveportal.sqlite   
2025-05-14T13:44:39    Error    captiveportal    Forcefully repair database (Traceback (most recent call last): File "/usr/local/opnsense/scripts/OPNsense/CaptivePortal/cp-background-process.py", line 251, in main bgprocess.db.cleanup_sessions() File "/usr/local/opnsense/scripts/OPNsense/CaptivePortal/lib/db.py", line 360, in cleanup_sessions cur.execute(""" delete sqlite3.OperationalError: no such table: accounting_state )

Thank you


Hello Franco,

Could you please help us to fix this issue. This issue occurs multiple times a day. When it happens  current users Sessions in the captive portal not appears and users can connect the internet without the hotspot authentication.

Services: Captive Portal: Log File

2025-05-15T08:34:11   Error   captiveportal   sqlite3 repair /var/captiveportal/captiveportal.sqlite   
2025-05-15T08:34:11   Error   captiveportal   Forcefully repair database (Traceback (most recent call last): File "/usr/local/opnsense/scripts/OPNsense/CaptivePortal/cp-background-process.py", line 251, in main bgprocess.db.cleanup_sessions() File "/usr/local/opnsense/scripts/OPNsense/CaptivePortal/lib/db.py", line 360, in cleanup_sessions cur.execute(""" delete sqlite3.OperationalError: no such table: accounting_state )   
2025-05-15T08:33:11   Error   captiveportal   sqlite3 repair /var/captiveportal/captiveportal.sqlite [done]   
2025-05-15T08:32:40   Error   captiveportal   sqlite3 repair /var/captiveportal/captiveportal.sqlite   
2025-05-15T08:32:40   Error   captiveportal   Forcefully repair database (Traceback (most recent call last): File "/usr/local/opnsense/scripts/OPNsense/CaptivePortal/cp-background-process.py", line 251, in main bgprocess.db.cleanup_sessions() File "/usr/local/opnsense/scripts/OPNsense/CaptivePortal/lib/db.py", line 360, in cleanup_sessions cur.execute(""" delete sqlite3.OperationalError: no such table: accounting_state )   

Thank you.


Try to avoid a broken Sqlite database. There isn't much to do once it's been corrupted.

Check if you use UFS and your system has unexpected reboots, which easily kills Sqlite due to file system inconsistencies.


Cheers,
Franco

Thank you so much Franco,
We are using ZFS not UFS. We know isn't much to do once it's been corrupted but the problem we want to know what is the reason for that.
I mean the corrupted captiveportal.sqlite.
This issue does not occur immediately in the reboot or after a reboot, but it starts happening while the OPNsense router is up, running and working normal. It occurs multiple times a day.
Best Regards,
Saleh