picamera: picamera.exc.PiCameraMMALError: Failed to create MMAL component b'vc.camera_info': I/O error
I’m using Raspberry Pi 3 Model B+.
vcgencmd get_camera gives me supported=1 detected=1
raspistill -o test.jpg gives me the test.jpg file but also gives this message
mmal: mmal_vc_shm_init: could not initialize vc shared memory service
mmal: mmal_vc_component_create: failed to initialise shm for 'vc.camera_info' (7:EIO)
mmal: mmal_component_create_core: could not create component 'vc.camera_info' (7)
mmal: Failed to create camera_info component
Then, I try to run this python code below, but it gives me this error message
from picamera import PiCamera
camera = PiCamera()
Error:
mmal: mmal_vc_shm_init: could not initialize vc shared memory service
mmal: mmal_vc_component_create: failed to initialise shm for 'vc.camera_info' (7:EIO)
mmal: mmal_component_create_core: could not create component 'vc.camera_info' (7)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 367, in __init__
with mo.MMALCameraInfo() as camera_info:
File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 2346, in __init__
super(MMALCameraInfo, self).__init__()
File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 633, in __init__
prefix="Failed to create MMAL component %s" % self.component_type)
File "/usr/lib/python3/dist-packages/picamera/exc.py", line 184, in mmal_check
raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Failed to create MMAL component b'vc.camera_info': I/O error
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 28
Commits related to this issue
- mmal: Hack to make mmal core register VideoCore components The default linker option with Bullseye appears to now set as-needed, so as the core doesn't call into mmal_vc_client it is viewed as unnece... — committed to 6by9/userland by 6by9 3 years ago
- mmal: Hack to make mmal core register VideoCore components The default linker option with Bullseye appears to now set as-needed, so as the core doesn't call into mmal_vc_client it is viewed as unnece... — committed to raspberrypi/userland by 6by9 3 years ago
@6by9
I really don’t believe that this is the right way for the RPi Foundation to communicate such a big change, and I understand why many are frustrated with it.
There are thousands of scripts and examples out there that reference
picamera, and they have been written over many years. There are even Android apps built around the way picamera streams video feeds. I have built many pieces of automation that leveragepicamerato stream and record video between devices, and they’ve all been broken by the bullseye upgrade.You can’t get away with a random blog post that says “hey guys, FYI we’ve decided to completely kill the old picamera API, we’ll let you know as soon as we have time how you are supposed to migrate your scripts”. You can’t even expect people to go through blog posts before a dist-upgrade to validate whether anything is going to break upon reboot. This is the best way to get developers pissed, and it has another unfortunate precedent (the way the omxplayer layer has been left to break and rot on its own without viable alternatives). What I would have expected:
picamerarelevant pages (Github, documentation and pypi) should have reported, in big capital letters and with reasonable notice before bullseye was released as a new stable, WARNING: This library is deprecated and is going to break in bullseye, [link to migration steps here]. If people are opening issues on this topic, it probably means that a breaking change wasn’t properly communicated.picameraon bullseye that clearly warns the user about the deprecation.picameramodule provides an API that makes it easier to e.g. start a video stream or record with a preview even for a beginner, without having to mangle with ffmpeg/gstreamer/v4l2/gtk internals. Thepicameramodule could have simply relied on e.g. a gstreamer wrapper instead of the proprietary interface, while providing the same external interface to maintain back-compatibility with previously written software. I’m pretty sure that lots of beginners out there would have loved a back-compatible way of writing a script to stream a camera feed in three lines of code.We’re all happy to see the RPi software finally transition towards a more open-source approach, leaving behind legacy and hard-to-debug software like picamera or omxplayer. But we also expect the alternatives to be properly documented and supported. Many people out there rely on RPi software for stuff like media or camera playback: you can’t just break their software without providing and documenting the alternatives.
You can still enable the legacy stack, but the default is now libcamera. https://forums.raspberrypi.com/viewtopic.php?t=323390
Python bindings for libcamera are already in the works.
UPDATE AS OF 02/08/22* As mentioned by @danielfaust Just a note on @lexodistro 's solution.
According to https://downloads.raspberrypi.org/raspios_armhf/release_notes.txt the 2022-01-28 release re-added support for the old camera stack (“Legacy camera applications and libraries reinstalled”) and raspi-config got a new option to enable the legacy stack raspi-config - add option to switch to legacy camera mode.
This means that it is enough to issue a sudo apt update; sudo apt dist-upgrade and after the reboot issue sudo raspi-config to enable the legacy camera stack in the 3 Interface Options-section.
If you were holding the old packages you’d need to unhold them before doing the dist-upgrade:
sudo apt-mark unhold libraspberrypi0 sudo apt-mark unhold libraspberrypi-bin sudo apt-mark unhold libraspberrypi-dev sudo apt-mark unhold libraspberrypi-doc
sudo apt update; sudo apt upgrade and then after the reboot issue the sudo apt dist-upgrade
Original Post with spelling corrections (thanks @worldofchris)
Bro
In order to get the piCamera modules not to throw errors I had to manually update my repositories for bullseye this is important to do or else you will get errors like so
mmal: mmal_component_create_core: could not find component ‘vc.camera_info’ Traceback (most recent call last): File “<stdin>”, line 1, in <module> File “/usr/lib/python3/dist-packages/picamera/camera.py”, line 367, in init with mo.MMALCameraInfo() as camera_info: File “/usr/lib/python3/dist-packages/picamera/mmalobj.py”, line 2346, in init super(MMALCameraInfo, self).init() File “/usr/lib/python3/dist-packages/picamera/mmalobj.py”, line 631, in init mmal_check( File “/usr/lib/python3/dist-packages/picamera/exc.py”, line 184, in mmal_check raise PiCameraMMALError(status, prefix)
To fix this run these commands to update the repositories and remove the vlc errors
Then make sure to reenable the legacy camera interface
sudo raspi-configThen enable it
After this do a reboot
sudo rebootThen send me lots of thanks its quick and dirty but you can run PiCamera on bullseye and then update to Libcamera when they release picamer2 with the python3 bindings!!! be well and hope this helped someone. And I know I know you don’t need to use the -get anymore just a habit that’s hard to shake.
Raspberry Pi is becoming low-rent Apple.
This is what worked for me:
vcdbgneeds to be removed because it is included inlibraspberrypi-bin, elselibraspberrypi-binwould not install.But I still have a question: doing an
apt search raspberrypiyields:So I’m wondering how safe it is to leave the latter not-upgradeable entries at the newest version, specially
libraspberrypi-bin-dbgsymandlibraspberrypi0-dbgsymIn any case, thank you for your help, because now it works.
Another question:
libraspberrypi-bincontains/usr/bin/raspistilland/usr/bin/raspivid, at least according to https://packages.ubuntu.com/focal-updates/arm64/libraspberrypi-bin/filelistSo, could it be that it is not necessary to compile and install userland as described above ( where
git clone https://github.com/raspberrypi/userlandis mentioned )?Well, it worked fine for me.
And, yes, un-holding and upgrading is sufficient to undo this.
Go to http://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/
Download
libraspberrypi0_1.20210831-1_armhf.deb libraspberrypi-bin_1.20210831-1_armhf.deb libraspberrypi-dev_1.20210831-1_armhf.deb libraspberrypi-doc_1.20210831-1_armhf.deb raspberrypi-bootloader_1.20210831-1_armhf.deb
as root, do "dpkg -i " for all those files. You may need to remove vcdbg or make other package adjustments so that those fit.
Afterwards, do “apt-mark hold” for all of them so that future apt upgrades don’t overwrite them until that bug gets fixed.
That’s not enough. If you attempt this with the current libraspberrypi0/bootloader packages, what you get is “Failed to create MMAL component b’vc.camera_info’: Function Not Implemented.” You have to backtrack those packages to the 20210831-1 versions for now.