Failed start validation for device "disk-/tmp/craft-state"

I cannot run snapcraft more than once for a same project. It always stumbles on

Command standard error output: b’Error: Failed start validation for device “disk-/tmp/craft-state”: Missing source path “/run/user/1000/11309” for disk “disk-/tmp/craft-state”

Full output:

~/canonical/chromium/snap-from-source% snapcraft --verbosity=trace --debug --use-lxd
2025-09-08 13:20:09.954 Starting snapcraft, version 8.11.2
2025-09-08 13:20:09.954 Logging execution to '/home/nteodosio/.local/state/snapcraft/log/snapcraft-20250908-132009.834291.log'
2025-09-08 13:20:09.954 Raw pre-parsed sysargs: args={'help': False, 'verbose': False, 'quiet': False, 'verbosity': <EmitterMode.TRACE: 5>, 'version': False} filtered=['--debug', '--use-lxd']
2025-09-08 13:20:09.954 Running snapcraft without a command will not be possible in future releases. Use 'snapcraft pack' instead.
2025-09-08 13:20:09.954 General parsed sysargs: command='pack' args=['--debug', '--use-lxd']
2025-09-08 13:20:09.954 Configuring application...
2025-09-08 13:20:09.956 Command parsed sysargs: Namespace(destructive_mode=False, use_lxd=True, shell=False, shell_after=False, debug=True, platform=None, build_for=None, output=PosixPath('.'), fetch_service_policy=None, directory=None)
2025-09-08 13:20:09.985 Build plan: platform=None, build_for=None
2025-09-08 13:20:09.986 Loading project because a directory was not provided.
2025-09-08 13:20:09.987 Running snapcraft pack on host
2025-09-08 13:20:10.002 lifecycle command: 'pack', arguments: Namespace(destructive_mode=False, use_lxd=True, shell=False, shell_after=False, debug=True, platform=None, build_for=None, output=PosixPath('.'), fetch_service_policy=None, directory=None)
2025-09-08 13:20:10.002 Setting up BuildPlan
2025-09-08 13:20:10.047 Setting up Provider
2025-09-08 13:20:10.183 Setting snapcraft to be injected from the host into the build environment because it is running as a snap.
2025-09-08 13:20:10.184 Build plan contains 1 build(s).
2025-09-08 13:20:10.184 Build plan: [BuildInfo(platform='amd64', build_on='amd64', build_for='amd64', build_base=DistroBase(distribution='ubuntu', series='24.04'))]
2025-09-08 13:20:10.184 Running managed snapcraft in managed ubuntu@24.04 instance for platform 'amd64'
2025-09-08 13:20:10.199 Using parallel build count of 8 from CPU count
2025-09-08 13:20:10.200 CRAFT_TARGET_ARCH is deprecated, use CRAFT_ARCH_BUILD_FOR
2025-09-08 13:20:10.201 Processing grammar (on amd64 for amd64)
2025-09-08 13:20:10.201 Processing grammar for plugin: nil
2025-09-08 13:20:10.201 Processing grammar for build-environment: [{'PATH': '/snap/gnome-46-2404-sdk/current/usr/bin${PATH:+:$PATH}'}, {'XDG_DATA_DIRS': '/home/nteodosio/canonical/chromium/snap-from-source/stage/usr/share:/snap/gnome-46-2404-sdk/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}'}, {'LD_LIBRARY_PATH': '/snap/gnome-46-2404-sdk/current/lib/x86_64-linux-gnu:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu:/snap/gnome-46-2404-sdk/current/usr/lib:/snap/gnome-46-2404-sdk/current/usr/lib/vala-current:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/pulseaudio${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}'}, {'PKG_CONFIG_PATH': '/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/pkgconfig:/snap/gnome-46-2404-sdk/current/usr/lib/pkgconfig:/snap/gnome-46-2404-sdk/current/usr/share/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}'}, {'GETTEXTDATADIRS': '/snap/gnome-46-2404-sdk/current/usr/share/gettext-current${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}'}, {'GDK_PIXBUF_MODULE_FILE': '/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/gdk-pixbuf-current/loaders.cache'}, {'ACLOCAL_PATH': '/snap/gnome-46-2404-sdk/current/usr/share/aclocal${ACLOCAL_PATH:+:$ACLOCAL_PATH}'}, {'PYTHONPATH': '/snap/gnome-46-2404-sdk/current/usr/lib/python3.10:/snap/gnome-46-2404-sdk/current/usr/lib/python3/dist-packages:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/gobject-introspection${PYTHONPATH:+:$PYTHONPATH}'}, {'GI_TYPELIB_PATH': '/snap/gnome-46-2404-sdk/current/usr/lib/girepository-1.0:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/girepository-1.0${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}'}, {'CMAKE_PREFIX_PATH': '/home/nteodosio/canonical/chromium/snap-from-source/stage/usr:/snap/gnome-46-2404-sdk/current/usr${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH}'}, {'RUSTC_BOOTSTRAP': 1}, {'CC': '/snap/llvm-chromium/current/bin/clang'}, {'CXX': '/snap/llvm-chromium/current/bin/clang++'}, {'AR': '/snap/llvm-chromium/current/bin/llvm-ar'}, {'RUST_BACKTRACE': 1}, {'LIBCLANG_PATH': '/snap/llvm-chromium/current/lib'}]
2025-09-08 13:20:10.201 Processing grammar for after: ['launcher', 'manpage', 'va-drivers']
2025-09-08 13:20:10.201 Processing grammar for build-snaps: ['llvm-chromium/stable']
2025-09-08 13:20:10.201 Processing grammar for build-packages: ['bindgen', 'chrpath', 'cmake', 'default-jre-headless', 'elfutils', 'git', 'gperf', 'gzip', 'libasound2-dev', 'libcap-dev', 'libcups2-dev', 'libcurl4-openssl-dev', 'libdrm-dev', 'libevdev-dev', 'libffi-dev', 'libicu-dev', 'libkrb5-dev', 'libnss3-dev', 'libpam0g-dev', 'libpci-dev', 'libpipewire-0.3-dev', 'libssl-dev', 'libsystemd-dev', 'libva-dev', 'libwayland-dev', 'libxshmfence-dev', 'libxss-dev', 'lsb-release', 'make', 'mesa-common-dev', 'ninja-build', 'pkg-config', 'python3-pkg-resources', 'python3-xcbgen', 'quilt', 'qtbase5-dev', 'rustc-1.82', 'sed', 'wget', 'xcb-proto', 'yasm']
2025-09-08 13:20:10.202 Processing grammar for stage-packages: ['libnss3', 'libudev1', 'libpci3', 'libxss1', 'libsecret-1-0', 'opensc-pkcs11']
2025-09-08 13:20:10.202 Processing grammar for override-pull: set -eux
tar -x --strip-components 1 -f /home/nteodosio/canonical/chromium/snap-from-source/chromium-*.tar.xz
craftctl default
. chrome/VERSION
craftctl set version="$MAJOR.$MINOR.$BUILD.$PATCH"
2025-09-08 13:20:10.202 Processing grammar for override-build: set -ex +u
trap failed 0
failed(){
  llvm_chromium=/snap/llvm-chromium
  if ! find -name "$llvm_chromium" 'libclang_rt.builtins*' | grep .; then
    find "$llvm_chromium"
  fi
  find / -name '*libdrm*'
}

ln  -sf /usr/bin/rustc-1.82          /usr/bin/rustc
ln  -sf /usr/bin/rust-1.82-clang     /usr/bin/rust-clang
ln  -sf /usr/bin/rust-1.82-lld       /usr/bin/rust-lld
ln  -sf /usr/bin/rust-1.82-llvm-dwp  /usr/bin/rust-llvm-dwp
ln  -sf /usr/bin/rustdoc-1.82        /usr/bin/rustdoc
rustc --version

# Otherwise who really can claim to know what they contain?
printf '%s\n'               \
  "/home/nteodosio/canonical/chromium/snap-from-source/stage"            \
  "$CRAFT_PART_INSTALL"     \
  "$CRAFT_PART_BUILD"       \
  "$CRAFT_PART_SRC"         \
  "$CRAFT_PART_SRC_WORK"    \
  "$CRAFT_PART_BUILD_WORK"  \
  "/home/nteodosio/canonical/chromium/snap-from-source"      \
  "/home/nteodosio/canonical/chromium/snap-from-source/prime"
set -u

# Generate and install the man page (see the "manpage" part)
mkdir -p $CRAFT_PART_INSTALL/man1
sed \
    -e "s/@@PACKAGE@@/chromium/g" \
    -e "s/@@MENUNAME@@/chromium/g" \
    -e "s:\$HOME/.config:\$SNAP_USER_DATA/.config:g" \
    -e "s:\$HOME/.cache:\$SNAP_USER_COMMON/.cache:g" \
    $CRAFT_PART_SRC/chrome/app/resources/manpage.1.in \
    > $CRAFT_PART_INSTALL/man1/chrome.1
gzip -9n $CRAFT_PART_INSTALL/man1/chrome.1

# Builder gets out of space because of the duplication of
# SRC->BUILD. Remove SRC then.
# https://forum.snapcraft.io/t/duplicated-directories-src-and-build-are-a-space-issue/44618
# Delete this workaround if trying to build locally iteratively.
rm -rf "$CRAFT_PART_SRC"

# Find all patches that don't apply anymore before running Quilt, as it
# stops at the 1st unappliable and doesn't tells us how the file looks.
d=/home/nteodosio/canonical/chromium/snap-from-source/patches
while IFS= read -r p; do
  < "$d/$p" patch --dry-run -p1 -o "$d/$p.out" || cat "$d/$p.out"
done < "$d/series"
QUILT_PATCHES=$d quilt push -a

# Get the Node.js binaries needed to build chromium's WebUI
third_party/node/update_node_binaries

cp tools/gn/bootstrap/last_commit_position.h tools/gn/src/
python3 tools/gn/bootstrap/bootstrap.py --skip-generate-buildfiles

# Build chromium
OUT=out/Release
mkdir -p $OUT
cp /home/nteodosio/canonical/chromium/snap-from-source/args.gn $OUT/
if [ amd64 = "armhf" ]; then
  # Do not build with ThinLTO either, because it requires lld
  echo "use_thin_lto = false"
  # Do not build with NEON on armhf (https://launchpad.net/bugs/1884856)
  echo "arm_use_neon = false"
fi >> $OUT/args.gn

# //build/linux/debian_bullseye_amd64-sysroot/usr/include/signal.h:30:10:
# fatal error: 'bits/signum.h' file not found
ln -s /usr/include/x86_64-linux-gnu/bits /usr/include/bits
ln /usr/include/bits/signum-generic.h /usr/include/bits/signum.h

$OUT/gn gen $OUT
# Add -v to see the exact command used for each build step.
ninja -C $OUT chrome chrome_sandbox chromedriver

# Strip debug symbols off the chrome binary
eu-strip $OUT/chrome

# Install to $CRAFT_PART_INSTALL
mkdir -p $CRAFT_PART_INSTALL
cp chrome/app/theme/chromium/linux/product_logo_256.png $CRAFT_PART_INSTALL/chromium.png
T=$CRAFT_PART_INSTALL/usr/lib/chromium-browser
mkdir -p $T
cd $OUT
cp chrome chromedriver chrome_crashpad_handler \
    chrome_*.pak resources.pak \
    icudtl.dat \
    libEGL.so libGLESv2.so libffmpeg.so \
    libvk_swiftshader.so libvulkan.so.1 vk_swiftshader_icd.json \
    v8_context_snapshot.bin \
    $T/
cp chrome_sandbox $T/chrome-sandbox
mkdir $T/locales
cp locales/*.pak $T/locales/
if [ -d swiftshader ]; then
  # not built on arm*
  mkdir $T/swiftshader
  cp swiftshader/*.so $T/swiftshader/
fi

# Fix setuid bits on the sandbox executable
# (ref: https://forum.snapcraft.io/t/call-for-testing-chromium-snap/1714/16)
chmod 4555 $CRAFT_PART_INSTALL/usr/lib/chromium-browser/chrome-sandbox
2025-09-08 13:20:10.202 Processing grammar for prime: ['-etc/init.d', '-etc/xdg', '-usr/include', '-usr/share/doc', '-usr/share/lintian', '-usr/share/man']
2025-09-08 13:20:10.202 Processing grammar for plugin: dump
2025-09-08 13:20:10.202 Processing grammar for source: launcher
2025-09-08 13:20:10.202 Processing grammar for organize: {'*': 'bin/'}
2025-09-08 13:20:10.202 Processing grammar for build-environment: [{'PATH': '/snap/gnome-46-2404-sdk/current/usr/bin${PATH:+:$PATH}'}, {'XDG_DATA_DIRS': '/home/nteodosio/canonical/chromium/snap-from-source/stage/usr/share:/snap/gnome-46-2404-sdk/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}'}, {'LD_LIBRARY_PATH': '/snap/gnome-46-2404-sdk/current/lib/x86_64-linux-gnu:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu:/snap/gnome-46-2404-sdk/current/usr/lib:/snap/gnome-46-2404-sdk/current/usr/lib/vala-current:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/pulseaudio${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}'}, {'PKG_CONFIG_PATH': '/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/pkgconfig:/snap/gnome-46-2404-sdk/current/usr/lib/pkgconfig:/snap/gnome-46-2404-sdk/current/usr/share/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}'}, {'GETTEXTDATADIRS': '/snap/gnome-46-2404-sdk/current/usr/share/gettext-current${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}'}, {'GDK_PIXBUF_MODULE_FILE': '/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/gdk-pixbuf-current/loaders.cache'}, {'ACLOCAL_PATH': '/snap/gnome-46-2404-sdk/current/usr/share/aclocal${ACLOCAL_PATH:+:$ACLOCAL_PATH}'}, {'PYTHONPATH': '/snap/gnome-46-2404-sdk/current/usr/lib/python3.10:/snap/gnome-46-2404-sdk/current/usr/lib/python3/dist-packages:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/gobject-introspection${PYTHONPATH:+:$PYTHONPATH}'}, {'GI_TYPELIB_PATH': '/snap/gnome-46-2404-sdk/current/usr/lib/girepository-1.0:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/girepository-1.0${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}'}, {'CMAKE_PREFIX_PATH': '/home/nteodosio/canonical/chromium/snap-from-source/stage/usr:/snap/gnome-46-2404-sdk/current/usr${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH}'}]
2025-09-08 13:20:10.202 Processing grammar for plugin: dump
2025-09-08 13:20:10.202 Processing grammar for source: firstrun
2025-09-08 13:20:10.202 Processing grammar for organize: {'*': 'firstrun/'}
2025-09-08 13:20:10.203 Processing grammar for build-environment: [{'PATH': '/snap/gnome-46-2404-sdk/current/usr/bin${PATH:+:$PATH}'}, {'XDG_DATA_DIRS': '/home/nteodosio/canonical/chromium/snap-from-source/stage/usr/share:/snap/gnome-46-2404-sdk/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}'}, {'LD_LIBRARY_PATH': '/snap/gnome-46-2404-sdk/current/lib/x86_64-linux-gnu:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu:/snap/gnome-46-2404-sdk/current/usr/lib:/snap/gnome-46-2404-sdk/current/usr/lib/vala-current:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/pulseaudio${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}'}, {'PKG_CONFIG_PATH': '/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/pkgconfig:/snap/gnome-46-2404-sdk/current/usr/lib/pkgconfig:/snap/gnome-46-2404-sdk/current/usr/share/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}'}, {'GETTEXTDATADIRS': '/snap/gnome-46-2404-sdk/current/usr/share/gettext-current${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}'}, {'GDK_PIXBUF_MODULE_FILE': '/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/gdk-pixbuf-current/loaders.cache'}, {'ACLOCAL_PATH': '/snap/gnome-46-2404-sdk/current/usr/share/aclocal${ACLOCAL_PATH:+:$ACLOCAL_PATH}'}, {'PYTHONPATH': '/snap/gnome-46-2404-sdk/current/usr/lib/python3.10:/snap/gnome-46-2404-sdk/current/usr/lib/python3/dist-packages:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/gobject-introspection${PYTHONPATH:+:$PYTHONPATH}'}, {'GI_TYPELIB_PATH': '/snap/gnome-46-2404-sdk/current/usr/lib/girepository-1.0:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/girepository-1.0${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}'}, {'CMAKE_PREFIX_PATH': '/home/nteodosio/canonical/chromium/snap-from-source/stage/usr:/snap/gnome-46-2404-sdk/current/usr${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH}'}]
2025-09-08 13:20:10.203 Processing grammar for plugin: nil
2025-09-08 13:20:10.203 Processing grammar for stage-packages: ['groff-base', 'libgdbm6t64', 'libpipeline1', 'man-db']
2025-09-08 13:20:10.203 Processing grammar for prime: ['-etc', '-usr/lib/tmpfiles.d', '-usr/share/bug', '-usr/share/calendar', '-usr/share/doc', '-usr/share/doc-base', '-usr/share/lintian', '-usr/share/man', '-usr/share/man-db', '-var']
2025-09-08 13:20:10.203 Processing grammar for build-environment: [{'PATH': '/snap/gnome-46-2404-sdk/current/usr/bin${PATH:+:$PATH}'}, {'XDG_DATA_DIRS': '/home/nteodosio/canonical/chromium/snap-from-source/stage/usr/share:/snap/gnome-46-2404-sdk/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}'}, {'LD_LIBRARY_PATH': '/snap/gnome-46-2404-sdk/current/lib/x86_64-linux-gnu:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu:/snap/gnome-46-2404-sdk/current/usr/lib:/snap/gnome-46-2404-sdk/current/usr/lib/vala-current:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/pulseaudio${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}'}, {'PKG_CONFIG_PATH': '/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/pkgconfig:/snap/gnome-46-2404-sdk/current/usr/lib/pkgconfig:/snap/gnome-46-2404-sdk/current/usr/share/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}'}, {'GETTEXTDATADIRS': '/snap/gnome-46-2404-sdk/current/usr/share/gettext-current${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}'}, {'GDK_PIXBUF_MODULE_FILE': '/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/gdk-pixbuf-current/loaders.cache'}, {'ACLOCAL_PATH': '/snap/gnome-46-2404-sdk/current/usr/share/aclocal${ACLOCAL_PATH:+:$ACLOCAL_PATH}'}, {'PYTHONPATH': '/snap/gnome-46-2404-sdk/current/usr/lib/python3.10:/snap/gnome-46-2404-sdk/current/usr/lib/python3/dist-packages:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/gobject-introspection${PYTHONPATH:+:$PYTHONPATH}'}, {'GI_TYPELIB_PATH': '/snap/gnome-46-2404-sdk/current/usr/lib/girepository-1.0:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/girepository-1.0${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}'}, {'CMAKE_PREFIX_PATH': '/home/nteodosio/canonical/chromium/snap-from-source/stage/usr:/snap/gnome-46-2404-sdk/current/usr${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH}'}]
2025-09-08 13:20:10.203 Processing grammar for plugin: nil
2025-09-08 13:20:10.203 Processing grammar for override-pull:
2025-09-08 13:20:10.203 Processing grammar for override-prime: set -eux
mkdir -p usr/bin
cd usr/bin
ln -s /usr/bin/xdg-open xdg-email
2025-09-08 13:20:10.203 Processing grammar for build-environment: [{'PATH': '/snap/gnome-46-2404-sdk/current/usr/bin${PATH:+:$PATH}'}, {'XDG_DATA_DIRS': '/home/nteodosio/canonical/chromium/snap-from-source/stage/usr/share:/snap/gnome-46-2404-sdk/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}'}, {'LD_LIBRARY_PATH': '/snap/gnome-46-2404-sdk/current/lib/x86_64-linux-gnu:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu:/snap/gnome-46-2404-sdk/current/usr/lib:/snap/gnome-46-2404-sdk/current/usr/lib/vala-current:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/pulseaudio${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}'}, {'PKG_CONFIG_PATH': '/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/pkgconfig:/snap/gnome-46-2404-sdk/current/usr/lib/pkgconfig:/snap/gnome-46-2404-sdk/current/usr/share/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}'}, {'GETTEXTDATADIRS': '/snap/gnome-46-2404-sdk/current/usr/share/gettext-current${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}'}, {'GDK_PIXBUF_MODULE_FILE': '/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/gdk-pixbuf-current/loaders.cache'}, {'ACLOCAL_PATH': '/snap/gnome-46-2404-sdk/current/usr/share/aclocal${ACLOCAL_PATH:+:$ACLOCAL_PATH}'}, {'PYTHONPATH': '/snap/gnome-46-2404-sdk/current/usr/lib/python3.10:/snap/gnome-46-2404-sdk/current/usr/lib/python3/dist-packages:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/gobject-introspection${PYTHONPATH:+:$PYTHONPATH}'}, {'GI_TYPELIB_PATH': '/snap/gnome-46-2404-sdk/current/usr/lib/girepository-1.0:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/girepository-1.0${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}'}, {'CMAKE_PREFIX_PATH': '/home/nteodosio/canonical/chromium/snap-from-source/stage/usr:/snap/gnome-46-2404-sdk/current/usr${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH}'}]
2025-09-08 13:20:10.203 Processing grammar for plugin: nil
2025-09-08 13:20:10.203 Processing grammar for stage-packages: ['xdg-utils']
2025-09-08 13:20:10.204 Processing grammar for stage: ['usr/bin/xdg-icon-resource']
2025-09-08 13:20:10.204 Processing grammar for override-prime: sed -i '/^xdg_user_dir="$XDG_DATA_HOME"$/s|".*"|$SNAP_REAL_HOME/.local/share|' /home/nteodosio/canonical/chromium/snap-from-source/stage/usr/bin/xdg-icon-resource
craftctl default
2025-09-08 13:20:10.204 Processing grammar for build-environment: [{'PATH': '/snap/gnome-46-2404-sdk/current/usr/bin${PATH:+:$PATH}'}, {'XDG_DATA_DIRS': '/home/nteodosio/canonical/chromium/snap-from-source/stage/usr/share:/snap/gnome-46-2404-sdk/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}'}, {'LD_LIBRARY_PATH': '/snap/gnome-46-2404-sdk/current/lib/x86_64-linux-gnu:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu:/snap/gnome-46-2404-sdk/current/usr/lib:/snap/gnome-46-2404-sdk/current/usr/lib/vala-current:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/pulseaudio${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}'}, {'PKG_CONFIG_PATH': '/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/pkgconfig:/snap/gnome-46-2404-sdk/current/usr/lib/pkgconfig:/snap/gnome-46-2404-sdk/current/usr/share/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}'}, {'GETTEXTDATADIRS': '/snap/gnome-46-2404-sdk/current/usr/share/gettext-current${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}'}, {'GDK_PIXBUF_MODULE_FILE': '/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/gdk-pixbuf-current/loaders.cache'}, {'ACLOCAL_PATH': '/snap/gnome-46-2404-sdk/current/usr/share/aclocal${ACLOCAL_PATH:+:$ACLOCAL_PATH}'}, {'PYTHONPATH': '/snap/gnome-46-2404-sdk/current/usr/lib/python3.10:/snap/gnome-46-2404-sdk/current/usr/lib/python3/dist-packages:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/gobject-introspection${PYTHONPATH:+:$PYTHONPATH}'}, {'GI_TYPELIB_PATH': '/snap/gnome-46-2404-sdk/current/usr/lib/girepository-1.0:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/girepository-1.0${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}'}, {'CMAKE_PREFIX_PATH': '/home/nteodosio/canonical/chromium/snap-from-source/stage/usr:/snap/gnome-46-2404-sdk/current/usr${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH}'}]
2025-09-08 13:20:10.204 Processing grammar for plugin: nil
2025-09-08 13:20:10.204 Processing grammar for stage-packages: ['mesa-va-drivers', {'on amd64': ['i965-va-driver', 'intel-media-va-driver']}]
2025-09-08 13:20:10.204 Processing grammar for stage: ['usr/lib/*/dri/*_video.so']
2025-09-08 13:20:10.204 Processing grammar for build-environment: [{'PATH': '/snap/gnome-46-2404-sdk/current/usr/bin${PATH:+:$PATH}'}, {'XDG_DATA_DIRS': '/home/nteodosio/canonical/chromium/snap-from-source/stage/usr/share:/snap/gnome-46-2404-sdk/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}'}, {'LD_LIBRARY_PATH': '/snap/gnome-46-2404-sdk/current/lib/x86_64-linux-gnu:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu:/snap/gnome-46-2404-sdk/current/usr/lib:/snap/gnome-46-2404-sdk/current/usr/lib/vala-current:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/pulseaudio${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}'}, {'PKG_CONFIG_PATH': '/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/pkgconfig:/snap/gnome-46-2404-sdk/current/usr/lib/pkgconfig:/snap/gnome-46-2404-sdk/current/usr/share/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}'}, {'GETTEXTDATADIRS': '/snap/gnome-46-2404-sdk/current/usr/share/gettext-current${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}'}, {'GDK_PIXBUF_MODULE_FILE': '/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/gdk-pixbuf-current/loaders.cache'}, {'ACLOCAL_PATH': '/snap/gnome-46-2404-sdk/current/usr/share/aclocal${ACLOCAL_PATH:+:$ACLOCAL_PATH}'}, {'PYTHONPATH': '/snap/gnome-46-2404-sdk/current/usr/lib/python3.10:/snap/gnome-46-2404-sdk/current/usr/lib/python3/dist-packages:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/gobject-introspection${PYTHONPATH:+:$PYTHONPATH}'}, {'GI_TYPELIB_PATH': '/snap/gnome-46-2404-sdk/current/usr/lib/girepository-1.0:/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/girepository-1.0${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}'}, {'CMAKE_PREFIX_PATH': '/home/nteodosio/canonical/chromium/snap-from-source/stage/usr:/snap/gnome-46-2404-sdk/current/usr${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH}'}]
2025-09-08 13:20:10.204 Processing grammar for source: /snap/snapcraft/15775/share/snapcraft/extensions/desktop/command-chain
2025-09-08 13:20:10.204 Processing grammar for plugin: make
2025-09-08 13:20:10.204 Processing grammar for build-snaps: ['gnome-46-2404-sdk']
2025-09-08 13:20:10.204 Not processing grammar for non-grammar enabled keyword make-parameters
2025-09-08 13:20:10.209 Preparing managed instance 'snapcraft-chromium-amd64-3304589'
2025-09-08 13:20:10.209 Using hostname 'snapcraft-chromium-amd64-3304589'
2025-09-08 13:20:10.209 Using provider 'lxd' passed as an argument.
2025-09-08 13:20:10.228 Checking if LXD is installed.
2025-09-08 13:20:10.326 LXD snap status: active
2025-09-08 13:20:10.327 Checking if LXD is installed.
2025-09-08 13:20:10.375 LXD snap status: active
2025-09-08 13:20:10.522 Executing on host: lxc --project default profile show local:default
2025-09-08 13:20:11.054 Launching managed ubuntu 24.04 instance...
2025-09-08 13:20:11.055 Executing on host: lxc remote list --format=yaml
2025-09-08 13:20:11.173 Remote 'craft-com.ubuntu.cloud-buildd' already exists.
2025-09-08 13:20:11.174 Executing on host: lxc project list local: --format=yaml
2025-09-08 13:20:11.303 Converted name 'snapcraft-chromium-amd64-3304589' to instance name 'snapcraft-chromium-amd64-3304589'
2025-09-08 13:20:11.304 Checking for instance 'snapcraft-chromium-amd64-3304589' in project 'snapcraft' in remote 'local'
2025-09-08 13:20:11.304 Executing on host: lxc --project snapcraft list local: --format=yaml
2025-09-08 13:20:11.629 Executing on host: lxc --project snapcraft config get local:snapcraft-chromium-amd64-3304589 raw.idmap
2025-09-08 13:20:11.744 Executing on host: lxc --project snapcraft list local: --format=yaml
2025-09-08 13:20:12.030 Instance exists and is not running. Starting instance.
2025-09-08 13:20:12.030 Starting instance
2025-09-08 13:20:12.030 Executing on host: lxc --project snapcraft info local:snapcraft-chromium-amd64-3304589
2025-09-08 13:20:12.148 Executing on host: lxc --project snapcraft start local:snapcraft-chromium-amd64-3304589
2025-09-08 13:20:12.361 Failed to start 'snapcraft-chromium-amd64-3304589'.
2025-09-08 13:20:12.362 Detailed information:
* Command that failed: 'lxc --project snapcraft start local:snapcraft-chromium-amd64-3304589'
* Command exit code: 1
* Command standard error output: b'Error: Failed start validation for device "disk-/tmp/craft-state": Missing source path "/run/user/1000/11309" for disk "disk-/tmp/craft-state"\nTry `lxc info --show-log local:snapcraft-chromium-amd64-3304589` for more info\n'
2025-09-08 13:20:12.372 Traceback (most recent call last):
2025-09-08 13:20:12.372   File "/snap/snapcraft/15775/lib/python3.12/site-packages/craft_providers/lxd/lxc.py", line 1045, in start
2025-09-08 13:20:12.372     self._run_lxc(command, capture_output=True, project=project)
2025-09-08 13:20:12.372   File "/snap/snapcraft/15775/lib/python3.12/site-packages/craft_providers/lxd/lxc.py", line 110, in _run_lxc
2025-09-08 13:20:12.372     return subprocess.run(lxc_cmd, check=check, stdin=stdin.value, **kwargs)
2025-09-08 13:20:12.372            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-09-08 13:20:12.372   File "/snap/snapcraft/current/usr/lib/python3.12/subprocess.py", line 571, in run
2025-09-08 13:20:12.372     raise CalledProcessError(retcode, process.args,
2025-09-08 13:20:12.372 subprocess.CalledProcessError: Command '['lxc', '--project', 'snapcraft', 'start', 'local:snapcraft-chromium-amd64-3304589']' returned non-zero exit status 1.
2025-09-08 13:20:12.372
2025-09-08 13:20:12.372 The above exception was the direct cause of the following exception:
2025-09-08 13:20:12.372 Traceback (most recent call last):
2025-09-08 13:20:12.372   File "/snap/snapcraft/15775/lib/python3.12/site-packages/craft_application/application.py", line 626, in run
2025-09-08 13:20:12.373     return_code = self._run_inner()
2025-09-08 13:20:12.373                   ^^^^^^^^^^^^^^^^^
2025-09-08 13:20:12.373   File "/snap/snapcraft/15775/lib/python3.12/site-packages/snapcraft/application.py", line 184, in _run_inner
2025-09-08 13:20:12.373     return_code = super()._run_inner()
2025-09-08 13:20:12.373                   ^^^^^^^^^^^^^^^^^^^^
2025-09-08 13:20:12.373   File "/snap/snapcraft/15775/lib/python3.12/site-packages/craft_application/application.py", line 603, in _run_inner
2025-09-08 13:20:12.373     return_code = dispatcher.run() or os.EX_OK
2025-09-08 13:20:12.373                   ^^^^^^^^^^^^^^^^
2025-09-08 13:20:12.373   File "/snap/snapcraft/15775/lib/python3.12/site-packages/craft_cli/dispatcher.py", line 564, in run
2025-09-08 13:20:12.373     return self._loaded_command.run(self._parsed_command_args)
2025-09-08 13:20:12.373            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-09-08 13:20:12.373   File "/snap/snapcraft/15775/lib/python3.12/site-packages/craft_application/commands/base.py", line 200, in run
2025-09-08 13:20:12.373     result = self._run(parsed_args, **kwargs) or result
2025-09-08 13:20:12.373              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-09-08 13:20:12.374   File "/snap/snapcraft/15775/lib/python3.12/site-packages/snapcraft/commands/lifecycle.py", line 74, in _run
2025-09-08 13:20:12.374     super()._run(parsed_args)
2025-09-08 13:20:12.374   File "/snap/snapcraft/15775/lib/python3.12/site-packages/craft_application/commands/lifecycle.py", line 575, in _run
2025-09-08 13:20:12.374     return super()._run(parsed_args=parsed_args, step_name=step_name)
2025-09-08 13:20:12.374            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-09-08 13:20:12.374   File "/snap/snapcraft/15775/lib/python3.12/site-packages/craft_application/commands/lifecycle.py", line 190, in _run
2025-09-08 13:20:12.374     self._run_manager_for_build_plan(fetch_service_policy)
2025-09-08 13:20:12.374   File "/snap/snapcraft/15775/lib/python3.12/site-packages/craft_application/commands/lifecycle.py", line 96, in _run_manager_for_build_plan
2025-09-08 13:20:12.374     provider.run_managed(build, bool(fetch_service_policy))
2025-09-08 13:20:12.374   File "/snap/snapcraft/15775/lib/python3.12/site-packages/craft_application/services/provider.py", line 437, in run_managed
2025-09-08 13:20:12.374     with self.instance(
2025-09-08 13:20:12.374   File "/snap/snapcraft/current/usr/lib/python3.12/contextlib.py", line 137, in __enter__
2025-09-08 13:20:12.374     return next(self.gen)
2025-09-08 13:20:12.374            ^^^^^^^^^^^^^^
2025-09-08 13:20:12.375   File "/snap/snapcraft/15775/lib/python3.12/site-packages/craft_application/services/provider.py", line 180, in instance
2025-09-08 13:20:12.375     with provider.launched_environment(
2025-09-08 13:20:12.375   File "/snap/snapcraft/current/usr/lib/python3.12/contextlib.py", line 137, in __enter__
2025-09-08 13:20:12.375     return next(self.gen)
2025-09-08 13:20:12.375            ^^^^^^^^^^^^^^
2025-09-08 13:20:12.375   File "/snap/snapcraft/15775/lib/python3.12/site-packages/craft_providers/lxd/lxd_provider.py", line 150, in launched_environment
2025-09-08 13:20:12.375     instance = launch(
2025-09-08 13:20:12.375                ^^^^^^^
2025-09-08 13:20:12.375   File "/snap/snapcraft/15775/lib/python3.12/site-packages/craft_providers/lxd/launcher.py", line 721, in launch
2025-09-08 13:20:12.375     if instance.exists() and _launch_existing_instance(
2025-09-08 13:20:12.375                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-09-08 13:20:12.375   File "/snap/snapcraft/15775/lib/python3.12/site-packages/craft_providers/lxd/launcher.py", line 399, in _launch_existing_instance
2025-09-08 13:20:12.375     instance.start()
2025-09-08 13:20:12.376   File "/snap/snapcraft/15775/lib/python3.12/site-packages/craft_providers/lxd/lxd_instance.py", line 556, in start
2025-09-08 13:20:12.376     self.lxc.start(
2025-09-08 13:20:12.376   File "/snap/snapcraft/15775/lib/python3.12/site-packages/craft_providers/lxd/lxc.py", line 1047, in start
2025-09-08 13:20:12.376     raise LXDError(
2025-09-08 13:20:12.376 craft_providers.lxd.errors.LXDError: Failed to start 'snapcraft-chromium-amd64-3304589'.
2025-09-08 13:20:12.376 * Command that failed: 'lxc --project snapcraft start local:snapcraft-chromium-amd64-3304589'
2025-09-08 13:20:12.376 * Command exit code: 1
2025-09-08 13:20:12.376 * Command standard error output: b'Error: Failed start validation for device "disk-/tmp/craft-state": Missing source path "/run/user/1000/11309" for disk "disk-/tmp/craft-state"\nTry `lxc info --show-log local:snapcraft-chromium-amd64-3304589` for more info\n'
2025-09-08 13:20:12.376 Full execution log: '/home/nteodosio/.local/state/snapcraft/log/snapcraft-20250908-132009.834291.log'

Running the command suggested gives nothing:

~/canonical/chromium/snap-from-source% lxc info --show-log local:snapcraft-chromium-amd64-3304589
Error: Failed to fetch instance "snapcraft-chromium-amd64-3304589" in project "default": Instance not found
~/canonical/chromium/snap-from-source% lxc info --project snapcraft --show-log local:snapcraft-chromium-amd64-3304589
Name: snapcraft-chromium-amd64-3304589
Status: STOPPED
Type: container
Architecture: x86_64
Created: 2025/09/05 10:05 CEST
Last Used: 2025/09/05 12:08 CEST

Log:

Hi,

I’d be interested to see the full trace-level logs of the first and second runs of Snapcraft.

When the first run exits, Snapcraft should unmount the directory from the container. It’s unexpected that the directory is still mounted when Snapcraft runs the second time.

Hi, what are the full trace-level logs? I shared the output of snapcraft with –verbosity=trace in the opening post, so I assume it’s something else.

Note I cannot even start it afterwards:

% lxc start --project snapcraft snapcraft-firefox-amd64-3350694
Error: Failed start validation for device "disk-/tmp/craft-state": Missing
source path "/run/user/1000/35360" for disk "disk-/tmp/craft-state" Try `lxc
info --show-log snapcraft-firefox-amd64-3350694` for more info

I’d like to see the first and second runs of Snapcraft with --verbosity=trace, after running snapcraft clean.

The logs above show the bad state that Snapcraft is in, but it doesn’t show how it got into that bad state. I’m interested in the logs that show if this happened or not:

I found stuff in ~/.local/state/snapcraft/log.

During the first run[1], the system froze. I had to perform the Sysrq REISUB to its end, and after the system rebooted I attempted another run, which fails[2] with said error.

[1]https://people.canonical.com/~npt/snapcraft-20250909-142553.350102.log [2]https://people.canonical.com/~npt/snapcraft-20250909-145228.385824.log

I’m pretty sure this happened before without any system crash though, so I’ll capture future logs myself (as older logs seems to be gone) and share them when I hit the issue again.

Thanks, I appreciate that.

@lengau, what do you think about a failsafe in craft-application to unmount non-existent state directories before starting a container? Or for craft-providers to unmount all non-existent directories?

@mr_cal I’m a bit surprised as that was what I thought was happening already. I guess this is happening when the process gets killed before it can unmount the state directory?

My preference would actually be to go all the way and unmount all directories on launch in craft-providers. WDYT?

EDIT: I guess unless unmounting the other directories would make the launch take noticeably longer (more than say 200 ms)

That’s what I think too.

I like this idea, my only concern with unmounting everything is if we end up adding a craft profile for LXD projects and someone uses that to mount their ssh directory. (I haven’t thought through this scenario very much)

Hmm that’s a good point. And it doesn’t look like there’s an option in lxd to do an ephemeral device add (or multipass ephemeral mount).

I think you’re right - we should be conservative about what we unmount. I’ve created a feature request in craft-providers to determine the more specific implementation: Unmount nonexistent directories on start · Issue #821 · canonical/craft-providers · GitHub

1 Like

Looks great, thanks @lengau!

I think the interim workaround is to manually unmount devices from the lxd container when this happens.

I think the interim workaround is to manually unmount devices from the lxd container when this happens.

Is that something that can be done by the user himself while the issue is present? Could you indicate what are the steps to do so? Under the assumption I cannot even start the container. If doable of course, which might just not be the case but I’m mostly ignorant about LXD.