树莓派使用Ubuntu官方的Ubuntu server 20会导致vcgencmd command not found,按照下面的步骤走即可解决
首先用su命令进入root用户模式下,接着执行
cd /tmp
git clone https://github.com/raspberrypi/userland.git
cd userland
如果你使用的是32位OS,输入
./buildme
如果是64位OS,则输入
./buildme --aarch64
接着,在/opt/vc/bin目录下就有vcgencmd了。直接运行,可能导致报错:
./vcgencmd: error while loading shared libraries: libvchiq_arm.so: cannot open shared object file: No such file or directory
在root用户下执行:
echo "/opt/vc/lib" >> /etc/ld.so.conf
ldconfig
即可。
如果需要,可以将/opt/vc/bin加入到环境变量PATH内。
注一:
出编译时出现
CMake Error at CMakeLists.txt:3 (project):
No CMAKE_CXX_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
原因:ubuntu没有自带编译环境
方案:
sudo apt install -y build-essential
参考:
树莓派Ubuntu系统安装vcgencmd - 斐斐のBlog (mmuaa.com)
注二:
运行时出现
VCHI initialization failed
方法
sudo usermod -G video <username>
sudo reboot
然后
sudo vcgencmd XXXXXXXXX