Bizzare behaviour running snapcraft on vlc

Hi,

I have been looking at updating the vlc snap. I download that git repository, and then enter extras/package/snap and run snapcraft pull vlc. I have seen various misbehaviours, and none of them make any sense to me.

You need to wait a while before the various errors happen, but they are always triggered in my testing when the log file shows Extracting stage package: libgdk-pixbuf2.0-common.

At that point, all I see is the extraction of libgdk-pixbuf2.0-common “spinning”. In one failure case, my disk completely filled up and snapcraft failed. straceing the snapcraft process while this was happening showed,

sendfile(7, 6, [151867228160] => [151867228160], 8388608) = 8388608
sendfile(7, 6, [151875616768] => [151875616768], 8388608) = 8388608
...

Going on indefinitely. I.e., something is copying 8MB chunks from file descriptor 7 to 6.

Looking at those file descriptors,

$ ls -l /proc/132299/fd
...
lr-x------ 1 charles charles 64 Oct 19 21:11 6 -> /dev/urandom
l-wx------ 1 charles charles 64 Oct 19 21:11 7 -> /root/parts/vlc/src/dev/urandom

It is try to copying /dev/urandom in the snap area, which is most unexpected.

On a second run, I interrupted the build to see a traceback while it was busy filling my harddisk,

2025-10-19 21:12:11.854 Interrupted.
2025-10-19 21:12:11.863 Traceback (most recent call last):
2025-10-19 21:12:11.863   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_parts/utils/file_utils.py", line 98, in link_or_copy
2025-10-19 21:12:11.863     link(source, destination, follow_symlinks=follow_symlinks)
2025-10-19 21:12:11.863   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_parts/utils/file_utils.py", line 141, in link
2025-10-19 21:12:11.863     os.link(source_path, destination, follow_symlinks=False)
2025-10-19 21:12:11.863 OSError: [Errno 18] Invalid cross-device link: '/dev/urandom' -> '/root/parts/vlc/src/dev/urandom'
2025-10-19 21:12:11.863 
2025-10-19 21:12:11.863 During handling of the above exception, another exception occurred:
2025-10-19 21:12:11.863 Traceback (most recent call last):
2025-10-19 21:12:11.863   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_application/application.py", line 653, in run
2025-10-19 21:12:11.863     return_code = self._run_inner()
2025-10-19 21:12:11.863                   ^^^^^^^^^^^^^^^^^
2025-10-19 21:12:11.863   File "/snap/snapcraft/15950/lib/python3.12/site-packages/snapcraft/application.py", line 184, in _run_inner
2025-10-19 21:12:11.863     return_code = super()._run_inner()
2025-10-19 21:12:11.863                   ^^^^^^^^^^^^^^^^^^^^
2025-10-19 21:12:11.863   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_application/application.py", line 630, in _run_inner
2025-10-19 21:12:11.863     return_code = dispatcher.run() or os.EX_OK
2025-10-19 21:12:11.863                   ^^^^^^^^^^^^^^^^
2025-10-19 21:12:11.863   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_cli/dispatcher.py", line 564, in run
2025-10-19 21:12:11.863     return self._loaded_command.run(self._parsed_command_args)
2025-10-19 21:12:11.863            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-10-19 21:12:11.863   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_application/commands/base.py", line 200, in run
2025-10-19 21:12:11.863     result = self._run(parsed_args, **kwargs) or result
2025-10-19 21:12:11.863              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-10-19 21:12:11.863   File "/snap/snapcraft/15950/lib/python3.12/site-packages/snapcraft/commands/lifecycle.py", line 74, in _run
2025-10-19 21:12:11.863     super()._run(parsed_args)
2025-10-19 21:12:11.863   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_application/commands/lifecycle.py", line 592, in _run
2025-10-19 21:12:11.864     return self._run_real(parsed_args=parsed_args, step_name=step_name)
2025-10-19 21:12:11.864            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-10-19 21:12:11.864   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_application/commands/lifecycle.py", line 410, in _run_real
2025-10-19 21:12:11.864     super()._run(parsed_args, step_name="prime")
2025-10-19 21:12:11.864   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_application/commands/lifecycle.py", line 221, in _run
2025-10-19 21:12:11.864     self._run_lifecycle(parsed_args, step_name)
2025-10-19 21:12:11.864   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_application/commands/lifecycle.py", line 237, in _run_lifecycle
2025-10-19 21:12:11.864     self._services.get("lifecycle").run(step_name=step_name)
2025-10-19 21:12:11.864   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_application/services/lifecycle.py", line 321, in run
2025-10-19 21:12:11.864     self._exec(actions)
2025-10-19 21:12:11.864   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_application/services/lifecycle.py", line 345, in _exec
2025-10-19 21:12:11.864     aex.execute(action, stdout=stream, stderr=stream)
2025-10-19 21:12:11.864   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_parts/executor/executor.py", line 342, in execute
2025-10-19 21:12:11.864     self._executor.execute(actions, stdout=stdout, stderr=stderr)
2025-10-19 21:12:11.864   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_parts/executor/executor.py", line 136, in execute
2025-10-19 21:12:11.864     self._run_action(act, stdout=stdout, stderr=stderr)
2025-10-19 21:12:11.864   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_parts/executor/executor.py", line 229, in _run_action
2025-10-19 21:12:11.864     handler.run_action(action, stdout=stdout, stderr=stderr)
2025-10-19 21:12:11.864   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_parts/executor/part_handler.py", line 308, in run_action
2025-10-19 21:12:11.864     state = handler(step_info, stdout=stdout, stderr=stderr)
2025-10-19 21:12:11.864             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-10-19 21:12:11.864   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_parts/executor/part_handler.py", line 334, in _run_pull
2025-10-19 21:12:11.864     self._run_step(
2025-10-19 21:12:11.864   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_parts/executor/part_handler.py", line 676, in _run_step
2025-10-19 21:12:11.864     return step_handler.run_builtin()
2025-10-19 21:12:11.864            ^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-10-19 21:12:11.864   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_parts/executor/step_handler.py", line 139, in run_builtin
2025-10-19 21:12:11.864     return handler()
2025-10-19 21:12:11.864            ^^^^^^^^^
2025-10-19 21:12:11.864   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_parts/executor/step_handler.py", line 143, in _builtin_pull
2025-10-19 21:12:11.864     self._source_handler.pull()
2025-10-19 21:12:11.864   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_parts/sources/local_source.py", line 102, in pull
2025-10-19 21:12:11.864     file_utils.link_or_copy_tree(
2025-10-19 21:12:11.864   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_parts/utils/file_utils.py", line 254, in link_or_copy_tree
2025-10-19 21:12:11.865     copy_function(source, destination)
2025-10-19 21:12:11.865   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_parts/utils/file_utils.py", line 111, in link_or_copy
2025-10-19 21:12:11.865     copy(source, destination, follow_symlinks=follow_symlinks)
2025-10-19 21:12:11.865   File "/snap/snapcraft/15950/lib/python3.12/site-packages/craft_parts/utils/file_utils.py", line 172, in copy
2025-10-19 21:12:11.865     shutil.copy2(source, destination, follow_symlinks=follow_symlinks)
2025-10-19 21:12:11.865   File "/snap/snapcraft/current/usr/lib/python3.12/shutil.py", line 475, in copy2
2025-10-19 21:12:11.865     copyfile(src, dst, follow_symlinks=follow_symlinks)
2025-10-19 21:12:11.865   File "/snap/snapcraft/current/usr/lib/python3.12/shutil.py", line 273, in copyfile
2025-10-19 21:12:11.865     _fastcopy_sendfile(fsrc, fdst)
2025-10-19 21:12:11.865   File "/snap/snapcraft/current/usr/lib/python3.12/shutil.py", line 150, in _fastcopy_sendfile
2025-10-19 21:12:11.865     sent = os.sendfile(outfd, infd, offset, blocksize)
2025-10-19 21:12:11.865            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-10-19 21:12:11.865 KeyboardInterrupt
2025-10-19 21:12:11.990 Emitter: Resuming control of the terminal
2025-10-19 21:12:11.990 Executing in container: lxc --project snapcraft exec local:snapcraft-vlc-amd64-20434693 -- env CRAFT_MANAGED_MODE=1 SNAPCRAFT_DEBUG=False SNAPCRAFT_LXD_REMOTE=local SNAPCRAFT_LAUNCHPAD_INSTANCE=production DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical test -f /tmp/snapcraft.log
2025-10-19 21:12:12.354 Executing on host: lxc --project snapcraft file pull local:snapcraft-vlc-amd64-20434693/tmp/snapcraft.log /home/charles/tmpauszz5em.tmp-craft/tmp85run_9_
2025-10-19 21:12:12.487 Logs retrieved from managed instance:
2025-10-19 21:12:12.489 Executing on host: lxc --project snapcraft config device show local:snapcraft-vlc-amd64-20434693
2025-10-19 21:12:12.549 Executing on host: lxc --project snapcraft config device remove local:snapcraft-vlc-amd64-20434693 disk-/root/project
2025-10-19 21:12:12.788 Executing on host: lxc --project snapcraft config device remove local:snapcraft-vlc-amd64-20434693 disk-/tmp/craft-state
2025-10-19 21:12:12.930 Executing on host: lxc --project snapcraft stop local:snapcraft-vlc-amd64-20434693

Of interest there,

2025-10-19 21:12:11.863     os.link(source_path, destination, follow_symlinks=False)
2025-10-19 21:12:11.863 OSError: [Errno 18] Invalid cross-device link: '/dev/urandom' -> '/root/parts/vlc/src/dev/urandom

So, it seemed to ignore that error and copy anyway. A second failure mode was less severe, while extracting the libgdk-pixbuf2.0-common package again, it immediately failed with /sys/kernel/mm/page_idle/bitmap: Permission denied. Of course, the details are nonsense, the problem seems to be snapcraft tries to copy my /dev directory into the build container, but I can’t figure out why.

Does anyone see anything horribly wrong with the VLC snapcraft.yaml I am trying to update?

I was able to reproduce this as well on latest/candidate. This isn’t it copying your local /dev, but rather it seems that the build container’s entire root is being copied into the source directory for the vlc part. My hunch right now is that libgdk-pixbuf2.0-common, or one of its dependencies, has abnormal symlinks (not necessarily broken - just ones we haven’t handled before). I’ll do some more research on this and see what I can find.

1 Like

Just a recommendation.

It would be better to use the kde-neon extension instead of adding QT packages.

This makes building easier and improves system integration.

Thanks, that is indeed the plan. The manual handling of Qt packages happened before the KDE extension was available (I think) I stumbled into this issue while working towards that.

1 Like