Hello, I’m trying to implement the ffmpeg-2204 content snap because my python application needs it to perform some operations.
When trying to execute ffmpeg inside the snap environment, I get the following error: ffmpeg: error while loading shared libraries: libxcb.so.1: cannot open shared object file: No such file or directory
Hi, @alemosa thanks for using the content snap. The content snap was made with the content snaps like gnome-42-2204 in mind. So, it lacks a lot of desktop related libraries like libxcb. You’ll need to add those here as @baldeuniversel suggested. I’ll try to create a documentation on this. If your snap can, you can use the gnome extension. It’ll simplify these.
Thanks for the suggestions. When trying to add the stage-packages @baldeuniversel said, I get a new shared error: ffmpeg: error while loading shared libraries: libxcb-shm.so.0: cannot open shared object file: No such file or directory
If I try then to add libxcb-shm or libxcb-shm-dev as a stage-package, snapcraft says that it can’t find that stage-package.
If I follow the suggestion of @soumyaDghosh of adding the gnome extension, ffmpeg works inside the snap (I can shell into it and run ffmpeg successfully), but I get a new error on my python app: mkdir: cannot create directory ‘/run/user/0. This leads into running with issues for the python app, because it can’t for example create the logs directory and files, as well as other directories needed.
Need to mention that the objective of this snap is running into a raspberry-pi-4B with ubuntu core 22 installed, I don’t know if installing the gnome extension is the best approach.
The connections of rackety-nuc-script in the raspberry look as follows:
No, I actually just want to have write permission on the $SNAP_DATA folder, but it seems like my python app doesn’t have write permission even there after using the “gnome” extension…
Normally the python app would create some directories inside the $SNAP_DATA folder, but when running with the gnome extension the directory is completely empty, so It’s not being able to create any dirs. Maybe with the error trace you can see better what is happening:
2024-02-29T09:56:59Z systemd[1]: Started Service for snap application rackety-nuc-script.rackety-nuc-script.
2024-02-29T09:56:59Z rackety-nuc-script.rackety-nuc-script[7090]: mkdir: cannot create directory ‘/run/user/0’: Permission denied
2024-02-29T09:57:00Z rackety-nuc-script.rackety-nuc-script[7057]: Traceback (most recent call last):
2024-02-29T09:57:00Z rackety-nuc-script.rackety-nuc-script[7057]: File "/snap/rackety-nuc-script/17/bin/rackety-nuc-script", line 5, in <module>
2024-02-29T09:57:00Z rackety-nuc-script.rackety-nuc-script[7057]: from src.__main__ import main
2024-02-29T09:57:00Z rackety-nuc-script.rackety-nuc-script[7057]: File "/snap/rackety-nuc-script/17/lib/python3.10/site-packages/src/__main__.py", line 2, in <module>
2024-02-29T09:57:00Z rackety-nuc-script.rackety-nuc-script[7057]: from .Logging import printRackety as print, Logging,printAndLog,launchThreadUploadFtpLogs, moveLogFiles
2024-02-29T09:57:00Z rackety-nuc-script.rackety-nuc-script[7057]: File "/snap/rackety-nuc-script/17/lib/python3.10/site-packages/src/Logging.py", line 22, in <module>
2024-02-29T09:57:00Z rackety-nuc-script.rackety-nuc-script[7057]: fileHandler = RotatingFileHandler("logs/app.log", mode='a', maxBytes=5*1024*1024,
2024-02-29T09:57:00Z rackety-nuc-script.rackety-nuc-script[7057]: File "/usr/lib/python3.10/logging/handlers.py", line 155, in __init__
2024-02-29T09:57:00Z rackety-nuc-script.rackety-nuc-script[7057]: BaseRotatingHandler.__init__(self, filename, mode, encoding=encoding,
2024-02-29T09:57:00Z rackety-nuc-script.rackety-nuc-script[7057]: File "/usr/lib/python3.10/logging/handlers.py", line 58, in __init__
2024-02-29T09:57:00Z rackety-nuc-script.rackety-nuc-script[7057]: logging.FileHandler.__init__(self, filename, mode=mode,
2024-02-29T09:57:00Z rackety-nuc-script.rackety-nuc-script[7057]: File "/usr/lib/python3.10/logging/__init__.py", line 1169, in __init__
2024-02-29T09:57:00Z rackety-nuc-script.rackety-nuc-script[7057]: StreamHandler.__init__(self, self._open())
2024-02-29T09:57:00Z rackety-nuc-script.rackety-nuc-script[7057]: File "/usr/lib/python3.10/logging/__init__.py", line 1201, in _open
2024-02-29T09:57:00Z rackety-nuc-script.rackety-nuc-script[7057]: return open_func(self.baseFilename, self.mode,
2024-02-29T09:57:00Z rackety-nuc-script.rackety-nuc-script[7057]: FileNotFoundError: [Errno 2] No such file or directory: '/var/snap/rackety-nuc-script/17/logs/app.log'
2024-02-29T09:57:00Z systemd[1]: snap.rackety-nuc-script.rackety-nuc-script.service: Main process exited, code=exited, status=1/FAILURE
2024-02-29T09:57:00Z systemd[1]: snap.rackety-nuc-script.rackety-nuc-script.service: Failed with result 'exit-code'.
2024-02-29T09:57:00Z systemd[1]: snap.rackety-nuc-script.rackety-nuc-script.service: Scheduled restart job, restart counter is at 4.
This is a shortcoming of the gnome extension since it is not really designed to run as root … which you have to do when using ubuntu core (i.e. your apps usually are daemons/services, not enduser apps in this case) …
you could try to use the gnome snap as a stage snap and then mangle the wrapper scripts to suppress the mkdir and have the scripts use /tmp or so … but that is likely as much work as to simply figure out what you need via deb packages in stage-package entries … looking at the gnome extension snap might give you some clues what to do to get all font/theme/whatever bits in order though …
PS: the last error in your log seems to indicate that you want a “mkdir $SNAP_DATA/logs” somewhere (perhaps in the install hook) …
Yeah, I was just having a look at that, it’s installed under $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pulseaudio, compiling it right now let’s see
EDIT: It would be amazing that I could detect all missing libraries for ffmpeg in one shot, right now I have to go 1 by 1 compiling the whole snap and installing it to see if it works, I wonder if there’s a faster way…