Page MenuHomeVyOS Platform

SNMPv3 set by HTTP API failed
Open, NormalPublicBUG

Description

Forum user got a SNMPv3 set problem when set SNMPv3 related entries.

I got perl locale warning and the set failed.

curl --request POST ‘http://localhost/configure’ --form data=‘{“op”: “set”, “path”: [“service”, “snmp”,“v3”,“user”,“user2”,“group”,“default”]}’ --form key=‘webkey’

And got error as follow:

{“success”: false, “error”: “perl: warning: Setting locale failed.\nperl: warning: Please check that your locale settings:\n\tLANGUAGE = (unset),\n\tLC_ALL = (unset),\n\tLC_CTYPE = "C.UTF-8",\n\tLANG = "en_US.UTF-8"\n are supported and installed on your system.\nperl: warning: Falling back to the standard locale ("C").\n[[service snmp]] failed\nCommit failed\n”, “data”: null}

It is no problem by using configure CLI. There is no problem to set any SNMPv2 date by HTTP API.

Most likely this is realted to https://github.com/vyos/vyos-1x/commit/7e0e8101998a6c8de6cb93c42bfbf1278c13f226

Details

Version
vyos-1.5-rolling-202408062043
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)
Forum thread
https://forum.vyos.io/t/snmpv3-set-by-http-api-failed/15163

Event Timeline

c-po assigned this task to jestabro.
c-po triaged this task as Normal priority.
c-po updated the task description. (Show Details)

Also reported:
https://forum.vyos.io/t/container-set-by-http-api-failed/15248/2

curl --request POST 'http://127.0.0.1/configure' --form data='{ "op": "set", "path": [ "container", "name", "hello", "image", "hello-world" ] }' --form key='xxxx'
{"success": false, "error": "perl: warning: Setting locale failed.....

I am not yet able to reproduce this in either case. @c-po suggestion of an interaction with the introduction of vyos.utils.configfs is quite reasonable, but I have not reproduced in current rolling or an image earlier than the recent changes (T6633, T6640) to resolve T6639. I've asked the forum user of the second report for further information.

I believe I am bumping into this issue aswell:

$ curl -k --request POST 'https://localhost:8443/configure' --form data='{ "op": "set", "path": [ "service", "ntp", "server", "time1.vyos.net", "prefer" ] }' --form key='MySuperSecretKey'
{"success": true, "data": "perl: warning: Setting locale failed.\nperl: warning: Please check that your locale settings:\n\tLANGUAGE = (unset),\n\tLC_ALL = (unset),\n\tLC_CTYPE = \"C.UTF-8\",\n\tLANG = \"en_US.UTF-8\"\n    are supported and installed on your system.\nperl: warning: Falling back to the standard locale (\"C\").\n", "error": null}

The error itself seems to come from the commit post hook:

$ until pgrep -fal perl; do :; done;
22246 /usr/bin/perl /etc/commit/post-hooks.d/10vyatta-log-commit.pl

Which is triggered by my-commit but ultimately I think the issue is that the http server does not have the locale settings configured fully as the error mention:

$ xargs --null --max-args=1 echo < <(sudo cat /proc/$(pgrep -f vyos-http-api-server)/environ)
LANG=en_US.UTF-8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOME=/root
LOGNAME=root
USER=root
SHELL=/bin/bash
INVOCATION_ID=d46a191b1e9f4befa49577ff42a8b3f1
JOURNAL_STREAM=9:11541203
SYSTEMD_EXEC_PID=1732

I can recrete the issue in a container using the latest (1.5-rolling-202411030007) iso, I created a little Makefile and vbash script that reproduces the issue on my system, in the hopes it can help.
FYI: It will require docker (or podman), xorriso, squashfs tools and jq to be available.