Flutter build fails - Invalid cross-device link

The error on snapcraft --use-lxd:

[Errno 13] Permission denied: ‘/sys/kernel/mm/page_idle/bitmap’ or [Error 13] Permisson denied: ‘/snap/core20/1611/dev/null’ or [Error 13] Permission denied: ‘/snap/core20/1611/dev/random’

The specific error is one of these three on every build.

Looking at stacktrace I see:

Traceback (most recent call last): File “/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft_legacy/file_utils.py”, line 102, in link_or_copy link(source, destination, follow_symlinks=follow_symlinks) File “/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft_legacy/file_utils.py”, line 136, in link os.link(source_path, destination, follow_symlinks=False) OSError: [Errno 18] Invalid cross-device link: ‘/sys/kernel/mm/page_idle/bitmap’ -> ‘/root/parts/feenics-kiosk/src/sys/kernel/mm/page_idle/bitmap’

The error on snapcraft: [Errno 6] No such device or address: ‘/run/snapd-snap.socket’

Stacktrace:

Traceback (most recent call last): File “/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft_legacy/file_utils.py”, line 102, in link_or_copy link(source, destination, follow_symlinks=follow_symlinks) File “/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft_legacy/file_utils.py”, line 136, in link os.link(source_path, destination, follow_symlinks=False) OSError: [Errno 18] Invalid cross-device link: ‘/run/snapd-snap.socket’ -> ‘/root/parts/feenics-kiosk/src/run/snapd-snap.socket’

Looks like “Invalid cross-device link” erorrs in all cases. Assumed this was caused by host locations being mapped into the container with insufficient access, so tryed sudo… but did not help.

Could you provide some details on how to reproduce this problem? It could be a smaller reproducer created specifically for this purpose, or even the original yaml file so others can debug it locally.

Thanks for your help. Turned out I was attempting to use the flutter plugin with core20.