0

Recently, i installed ubuntu server 20 64bit on Raspberry pi 4 B+ 4GB model, and youtube is laggy so i searched a bit and installed raspi-config and tried to change memory split setting but it says i don't have vcgencmd installed I tried many things to install vcgencmd i tried building userland, i succeed to build it, and i see vcgencmd is in /opt/vc/bin, but when i use

$ /opt/vc/bin/vcgencmd

it says it can't find vcgencmd I'm sure that there wasn't any typo, because i used tab auto correction i also tried installing libraspberrypi-bin, but it says it is not available i tried

pip3 install vcgencmd

it installed successfuly, but when i try to use it, it says

Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/vcgencmd/init.py", line 20, in subprocess.check_output('vcgencmd') File "/usr/lib/python3.8/subprocess.py", line 411, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.8/subprocess.py", line 489, in run with Popen(*popenargs, **kwargs) as process: File "/usr/lib/python3.8/subprocess.py", line 854, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'vcgencmd'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.8/runpy.py", line 184, in _run_module_as_main mod_name, mod_spec, code = _get_module_details(mod_name, _Error) File "/usr/lib/python3.8/runpy.py", line 143, in _get_module_details return _get_module_details(pkg_main_name, error) File "/usr/lib/python3.8/runpy.py", line 110, in _get_module_details import(pkg_name) File "/usr/local/lib/python3.8/dist-packages/vcgencmd/init.py", line 22, in raise ImportError('\'vcgencmd\' does not exist in path') ImportError: 'vcgencmd' does not exist in path i used raspi-update to update firmware, and there was no problem updating firmware but i still can't use vcgencmd can anyone help me?

4
  • I installed ubuntu-desktop on ubuntu server, since there isn't any desktop ubuntu 20 for raspberry pi 4 right now
    – tmvkrpxl0
    May 3, 2020 at 16:43
  • What's the output of ldd /opt/vc/bin/vcgencmd?
    – tttapa
    May 3, 2020 at 16:47
  • 1
    You need to add /opt/vc/bin to $PATH. en.wikipedia.org/wiki/PATH_(variable)
    – goldilocks
    May 3, 2020 at 17:12
  • output of ldd /opt/vc/bin/vcgencmd is "it's not dynamic executable file" I use different language setting, so text could be different
    – tmvkrpxl0
    May 4, 2020 at 4:44

1 Answer 1

2

There are two problems here: 1. vcgencmd cannot find its shared libraries, and 2. the Python module you're using cannot find the vcgencmd executable.


There are two possible solutions to the first problem:

A. Set the rpath of vcgencmd when building the Userland project:

cmake \
    -DCMAKE_INSTALL_PREFIX="/opt/vc" \
    -DCMAKE_INSTALL_RPATH='${CMAKE_INSTALL_PREFIX}/lib' \
    <your usual options>

B. Add /opt/vc/lib to the path of the dynamic linker/loader:

echo '/opt/vc/lib' | sudo tee /etc/ld.so.conf.d/vc.conf
sudo ldconfig

The second problem is that the folder /opt/vc/bin is not in your PATH. There are many possible solutions, but you probably want to add it to the system-wide path:

echo 'export PATH="/opt/vc/bin:$PATH"' | sudo tee /etc/profile.d/vc.sh

Afterwards, reboot, or execute the command export PATH="/opt/vc/bin:$PATH" in the shell you're starting the Python program from.

4
  • I did both, but i still have problems, when i use vcgencmd, now it says it can't find "/opt/vc/bin/vcgencmd: error while loading shared libraries: libvchiq_arm.so: cannot open shared object file: No such file or directory" and i still get same issue on python
    – tmvkrpxl0
    May 4, 2020 at 6:50
  • My Cmake options are -DCMAKE_INSTALL_PREFIX="/opt/vc" -DCMAKE_INSTALL_RPATH='${CMAKE_INSTALL_PREFIX}/lib' -DARM64=ON
    – tmvkrpxl0
    May 4, 2020 at 6:51
  • Sorry, i did something wrong, and it's working fine, Thanks!
    – tmvkrpxl0
    May 4, 2020 at 6:53
  • This is it. Just added a ../bin to PATH and a ../lib to LDCONFIG and everything worked OK
    – A.Ametov
    Jun 25, 2021 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.