Hello,
after upgrading from OPNsense 25.7.11_9 to 26.1.3 I noticed the following message during boot:
Generating configuration: templates...failed
The message appears in dmesg or in the GUI under System → Log Files → General.
After some debugging I found that the issue is caused by the example template located at:
/usr/local/opnsense/service/templates/OPNsense/Sample
The log file (/var/log/configd/latest.log) contains the following traceback:
jinja2.exceptions.UndefinedError: 'filter' is undefined
File ".../templates/OPNsense/Sample/example_simple_page.txt"
The sample template contains code like:
{% for item in filter.rule %}
During normal boot-time template rendering the object "filter" does not appear to exist in the template context, which causes the template generation to fail.
Workaround:
Moving or removing the Sample template resolves the issue immediately:
mv /usr/local/opnsense/service/templates/OPNsense/Sample /backup/_DISABLED/
After doing so the boot process reports correctly:
grep templates /var/log/system/latest.log
<13>1 2026-03-05T13:10:12+01:00 opnsense.space.lan kernel - - [meta sequenceId="210"] <118>[7] >>> Invoking early script 'templates'
<13>1 2026-03-05T13:10:12+01:00 opnsense.space.lan kernel - - [meta sequenceId="211"] <118>[7] Generating configuration: templates...done
Since this appears to be only a developer/example template, the question arises whether it should be installed on production systems at all, or whether the template should be implemented more defensively (e.g. using "if filter is defined").
Maybe this information helps other users who encounter this boot message after an upgrade.
Best regards
/nodea
Thanks for the hint! You probably migrated your firewall rules to the new GUI.
It's a bit funny because I don't remember seeing these test files before. We'll discuss a cleanup/fix although this is only cosmetic.
Cheers,
Franco
https://github.com/opnsense/core/commit/7e089dab0
Hi Franco
Quote from: franco on Today at 01:35:05 PM... You probably migrated your firewall rules to the new GUI.
Correct, but on a fresh 26.1.2_5 upgraded to 26.1.3 exist those files as well:
opnsense-version
OPNsense 26.1.3 (amd64)
uname -a
FreeBSD opnsense.lan 14.3-RELEASE-p9 FreeBSD 14.3-RELEASE-p9 stable/26.1-n272033-b4ddb3e0f150 SMP amd64
root@opnsense:~ # ls -1 /usr/local/opnsense/service/templates/OPNsense/Sample
+TARGETS
example_config.txt
example_parent.txt
example_simple_page.txt
sub1
sub2
Thanx
/nodea
BTW: Thx for the Commit
> Correct, but on a fresh 26.1.2_5 upgraded to 26.1.3 exist those files as well:
Yep, but they don't error because filter.rules is populated with legacy rules by default. :)
We have enough examples elsewhere and don't reference these files so removing seemed like the obvious choice here. Will ship in 26.1.4.
Cheers,
Franco
right,
MVC-migrated box
root@opnsense:/ # grep -n "<filter>" /conf/config.xml
root@opnsense:/ #
fresh box
grep -n "<filter>" /conf/config.xml
261: <filter>