I used vcgencmd inside a script for SNMP and the SNMP query returned:
VCHI initialization failed
I soon discovered if vcgencmd on a raspberry pi you get VCHI initialization failed then you need to add the video group to that user. The vcgencmd tool requires you have this group role so without it, it will give VCHI initialization failed.
To add the user group to that user you can run:
sudo usermod -aG video <username>
Where <username> is the user you want to run the vcgencmd command with. This command adds the video group to the the user you specify. In my case the <username> was “Debian-snmp”
Once you have ran the command any new logins will run the command successfully. Logging out and back into the pi will let you use the command. If the username is associated with a service, you have to restart the service
Why this problem occurs
This issue happens when you try and use the vcgencmd command with a user that isn’t a member of the video group. This typically happens when you create a new user for the raspberry pi and don’t give it the same groups that the pi user has.
The solution above fixes this by adding the correct video group to the created user.