23

I am working on writing a graphical application that uses the Pi's GPU, and I constantly get * failed to open vchiq instance errors when running my programs. This is usually fixed by a sudo chmod 777 /dev/vchiq, but (1) this is a very insecure fix that is definitely not suited to deployment to user-owned devices, and (2) it gets reset after each reboot.

How can I fix my /dev/vchiq problems "the right way", persistently, without introducing security issues?

fouric
  • 1,809
  • 4
  • 18
  • 26

5 Answers5

32

I was able to solve a similar problem by adding myself to the video group (I was not using the default user). Maybe this can help.

The command is:

sudo usermod -a -G video $(whoami)

You will need to log out and in again for the change to take effect.

Mickaël
  • 421
  • 4
  • 4
9

You can create a udev rule to set specific permissions on the device. As root, you could:

echo 'SUBSYSTEM=="vchiq",GROUP="video",MODE="0660"' > /etc/udev/rules.d/10-vchiq-permissions.rules
usermod -a -G video YourUnprivilegedUser
5

You could set SUID permission

sudo chmod u+s /dev/vchiq
SlySven
  • 3,631
  • 1
  • 20
  • 46
Milliways
  • 62,573
  • 32
  • 113
  • 225
3

If you are running raspistill from a php script accessed via a browser then you need to enter: sudo usermod -a -G video www-data to give Apache the necessary permissions.

mirams
  • 3,928
  • 4
  • 19
  • 23
C Wheatley
  • 31
  • 1
0

add

start_x=1 
gpu_mem=256

to boot/config.txt then run sudo raspistill -o cam.jpg

Of course I added the path for the raspistill. It worked for me in Ubuntu.

Jacobm001
  • 11,904
  • 7
  • 47
  • 58