Install Raspberry Pi’s vcgencmd on Fedora


This post is a continuation of my previous one about setting up a cluster of Raspberry Pis running Fedora. After I got the cluster to compute something, @ColsonXu, the cluster’s owner, asked me if I could monitor the CPU temperature of each Raspberry Pi by running this command:

$ /opt/vc/bin/vcgencmd measure_temp

The vcgencmd program is included in Raspberry Pi OS (formerly called Raspbian) as a utility for retrieving information about Raspberry Pi’s hardware. However, it is not included in Fedora’s software repositories. Luckily though, the source code of vcgencmd, along with the entire userland package that contains the program, is available, so we can compile it on our own.

Build and Install the Program

  1. Install the required compilers and build tools, and Git for retrieving the source code.

    $ sudo dnf install cmake gcc gcc-c++ make git

  2. Clone the userland package’s source code, then enter its directory.

    $ git clone
    $ cd userland
  3. Use ./buildme --aarch64 to compile the program for the aarch64 architecture Fedora runs on and install it.

    After the compilation completes and before the installation, you might see a prompt from sudo that demands your password. Enter it to proceed.

    $ ./buildme --aarch64

After this command completes, you will find the vcgencmd program under /opt/vc/bin.

Tell the System About /opt/vc

When you run vcgencmd now, you will see the following error message:

$ /opt/vc/bin/vcgencmd
/opt/vc/bin/vcgencmd: error while loading shared libraries: cannot open shared object file: No such file or directory

This error is caused by the operating system not knowing where to find the shared object file That file does exist under /opt/vc/lib, but the system is not told to find the file from that directory. To solve this issue, create a file whose name ends with .conf under the /etc/ directory, and add the following line to the file:


Then, run the following command to apply the change:

$ sudo ldconfig

Running /opt/vc/bin/vcgencmd now should no longer get you the error message.

It can be tedious when you have to type in the full path to the vcgencmd program in order to run it. To save yourself from the torture, you can add /opt/vc/bin to the PATH environment variable by editing ~/.bashrc:

  # User specific environment
  if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
+ PATH="/opt/vc/bin:$PATH"
  export PATH

Then, run the following command for the change to take effect:

$ source ~/.bashrc

Configure Device Permissions and User Group

At this point, if you attempt to use vcgencmd to read hardware information as a normal user, you might get the VCHI initialization failed error.

Most solutions to this issue you can find online would tell you to add the user to the video group. However, they typically assume you are running vcgencmd under Raspberry Pi OS. On Fedora, doing only this will not suffice. You need to configure the VCHI device so that video group users can access it. This is done by adding a new udev rule shown here, published by GitHub user @sakaki-.

$ cd /usr/lib/udev/rules.d/
$ sudo curl -O

Once the udev rule is copied to the correct location, you may apply it immediately without a reboot by using udevadm:

$ sudo udevadm trigger /dev/vchiq

To see if the rule is in effect, check the permission settings for the VCHI device file /dev/vchiq. If its group is video, then the udev rule has been successfully activated.

$ ls -l /dev/vchiq
crw-rw----. 1 root video 511, 0 Nov  9 23:17 /dev/vchiq

Once this is done, any user in the video group can invoke vcgencmd without getting the same error. You can use the following command to add your own user account to the video group; however, you must re-login to let the change take effect.

$ sudo usermod -aG video $USER

Use DNF to Install the Program

Don’t want to build vcgencmd by yourself? I have made an RPM package for userland and uploaded it to a Copr repository, so you can get vcgencmd working by simply running the following DNF commands:

$ sudo dnf copr enable leo3418/raspberrypi-userland
$ sudo dnf install raspberrypi-userland

With this installation method, you can skip all the building and installation steps described above, including creating a .conf file under /etc/, modifying ~/.bashrc, and installing the udev rule. The only thing you must do is to add your user account to the video group.

You can also build the RPM packages for userland by yourself from the SPEC file I wrote for it. For this one, I will only give you a demo of how to build the RPM packages instead of detailed instructions.