← Back to issue list

LXD device gets corrupted when ssh connection is closed

View original Github issue

Metadata

Project
snapcraft
Number
#5942
Type
issue
State
open
Author
soumyaDghosh
Labels
Created
Updated
Closed

Current evaluation

Snapcraft LXD build instance fails to restart after SSH disconnect/VM reboot because the craft-state disk device points at a transient /run/user/<uid>/<pid> path that no longer exists. Unlabelled, zero comments, 245 days old.

Suggested action: needs triage

Reason: No labels, no assignee, and zero comments from any maintainer in 245 days, so this has never been triaged. The root cause is identifiable from the log — craft-application's state service (craft_application/services/state.py) places its state dir under $XDG_RUNTIME_DIR/<pid>, which is wiped on session end/reboot, leaving the LXD disk-/tmp/craft-state device with a missing source path. It is a real, reproducible bug (not a support question) but needs maintainer assessment of where the fix belongs (craft-application state dir location vs craft-providers device handling).

Impact: 50 Quick Win: 22.5 Staleness: 75 Complexity: 55 Confidence: 65 Support Request: 10

Issue body

### Check existing issues - [x] I've verified that this bug isn't described by any existing issues. ### Bug description I'm using a gcloud compute vm to build snaps. Whenever I am closing the ssh connection, or if the gcloud instance shuts down, and I restart it and continue the snapcraft build, LXD fails to find the old device. ### Steps to reproduce 1. Connect to a gcloud compute instance 2. Start Building the snap 3. Stop the build 4. Close the ssh connection and reconnect 5. See this error ### Environment GCloud Compute instance Snapcraft: version 8.13.2 revision 16570 LXD: version 5.21.4-9eb1368 revision 36971 ### snapcraft.yaml ```yaml ``` ### Log output ```shell Starting instance 2025-12-29 06:54:28.292 Executing on host: lxc --project snapcraft info local:snapcraft-qt-full-amd64-524348 2025-12-29 06:54:28.408 Executing on host: lxc --project snapcraft start local:snapcraft-qt-full-amd64-524348 2025-12-29 06:54:28.540 Failed to start 'snapcraft-qt-full-amd64-524348'. 2025-12-29 06:54:28.540 Detailed information: * Command that failed: 'lxc --project snapcraft start local:snapcraft-qt-full-amd64-524348' * Command exit code: 1 * Command standard error output: b'Error: Failed start validation for device "disk-/tmp/craft-state": Missing source path "/run/user/400433789/356321" for disk "disk-/tmp/craft-state"\nTry `lxc info --show-log local:snapcraft-qt-full-amd64-524348` for more info\n' 2025-12-29 06:54:28.555 Traceback (most recent call last): 2025-12-29 06:54:28.555 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_providers/lxd/lxc.py", line 1187, in start 2025-12-29 06:54:28.556 self._run_lxc(command, capture_output=True, project=project) 2025-12-29 06:54:28.556 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_providers/lxd/lxc.py", line 206, in _run_lxc 2025-12-29 06:54:28.556 return subprocess.run( 2025-12-29 06:54:28.556 ^^^^^^^^^^^^^^^ 2025-12-29 06:54:28.556 File "/snap/snapcraft/current/usr/lib/python3.12/subprocess.py", line 571, in run 2025-12-29 06:54:28.556 raise CalledProcessError(retcode, process.args, 2025-12-29 06:54:28.556 subprocess.CalledProcessError: Command '['lxc', '--project', 'snapcraft', 'start', 'local:snapcraft-qt-full-amd64-524348']' returned non-zero exit status 1. 2025-12-29 06:54:28.556 2025-12-29 06:54:28.556 The above exception was the direct cause of the following exception: 2025-12-29 06:54:28.557 Traceback (most recent call last): 2025-12-29 06:54:28.557 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_application/application.py", line 663, in run 2025-12-29 06:54:28.557 return_code = self._run_inner() 2025-12-29 06:54:28.557 ^^^^^^^^^^^^^^^^^ 2025-12-29 06:54:28.557 File "/snap/snapcraft/16570/lib/python3.12/site-packages/snapcraft/application.py", line 183, in _run_inner 2025-12-29 06:54:28.557 return_code = super()._run_inner() 2025-12-29 06:54:28.557 ^^^^^^^^^^^^^^^^^^^^ 2025-12-29 06:54:28.557 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_application/application.py", line 640, in _run_inner 2025-12-29 06:54:28.557 return_code = dispatcher.run() or os.EX_OK 2025-12-29 06:54:28.557 ^^^^^^^^^^^^^^^^ 2025-12-29 06:54:28.557 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_cli/dispatcher.py", line 564, in run 2025-12-29 06:54:28.558 return self._loaded_command.run(self._parsed_command_args) 2025-12-29 06:54:28.558 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-12-29 06:54:28.558 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_application/commands/base.py", line 222, in run 2025-12-29 06:54:28.558 result = self._run(parsed_args, **kwargs) or result 2025-12-29 06:54:28.558 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-12-29 06:54:28.558 File "/snap/snapcraft/16570/lib/python3.12/site-packages/snapcraft/commands/lifecycle.py", line 74, in _run 2025-12-29 06:54:28.558 super()._run(parsed_args) 2025-12-29 06:54:28.558 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_application/commands/lifecycle.py", line 619, in _run 2025-12-29 06:54:28.558 return super()._run(parsed_args=parsed_args, step_name=step_name) 2025-12-29 06:54:28.558 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-12-29 06:54:28.559 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_application/commands/lifecycle.py", line 232, in _run 2025-12-29 06:54:28.559 self._run_manager_for_build_plan(fetch_service_policy) 2025-12-29 06:54:28.559 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_application/commands/lifecycle.py", line 97, in _run_manager_for_build_plan 2025-12-29 06:54:28.559 provider.run_managed(build, bool(fetch_service_policy)) 2025-12-29 06:54:28.559 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_application/services/provider.py", line 457, in run_managed 2025-12-29 06:54:28.559 with self.instance( 2025-12-29 06:54:28.559 File "/snap/snapcraft/current/usr/lib/python3.12/contextlib.py", line 137, in __enter__ 2025-12-29 06:54:28.559 return next(self.gen) 2025-12-29 06:54:28.559 ^^^^^^^^^^^^^^ 2025-12-29 06:54:28.559 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_application/services/provider.py", line 185, in instance 2025-12-29 06:54:28.559 with provider.launched_environment( 2025-12-29 06:54:28.559 File "/snap/snapcraft/current/usr/lib/python3.12/contextlib.py", line 137, in __enter__ 2025-12-29 06:54:28.560 return next(self.gen) 2025-12-29 06:54:28.560 ^^^^^^^^^^^^^^ 2025-12-29 06:54:28.560 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_providers/lxd/lxd_provider.py", line 168, in launched_environment 2025-12-29 06:54:28.560 instance = launch( 2025-12-29 06:54:28.560 ^^^^^^^ 2025-12-29 06:54:28.560 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_providers/lxd/launcher.py", line 780, in launch 2025-12-29 06:54:28.560 if instance.exists() and _launch_existing_instance( 2025-12-29 06:54:28.560 ^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-12-29 06:54:28.560 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_providers/lxd/launcher.py", line 429, in _launch_existing_instance 2025-12-29 06:54:28.560 instance.start() 2025-12-29 06:54:28.560 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_providers/lxd/lxd_instance.py", line 568, in start 2025-12-29 06:54:28.560 self.lxc.start( 2025-12-29 06:54:28.561 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_providers/lxd/lxc.py", line 1189, in start 2025-12-29 06:54:28.561 raise LXDError( 2025-12-29 06:54:28.561 craft_providers.lxd.errors.LXDError: Failed to start 'snapcraft-qt-full-amd64-524348'. 2025-12-29 06:54:28.561 * Command that failed: 'lxc --project snapcraft start local:snapcraft-qt-full-amd64-524348' 2025-12-29 06:54:28.561 * Command exit code: 1 2025-12-29 06:54:28.561 * Command standard error output: b'Error: Failed start validation for device "disk-/tmp/craft-state": Missing source path "/run/user/400433789/356321" for disk "disk-/tmp/craft-state"\nTry `lxc info --show-log local:snapcraft-qt-full-amd64-524348` for more info\n' ```

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 50
Quick Win: 22.5
Staleness: 75
Complexity: 55
Confidence: 65
Support Request: 10
needs triage Snapcraft LXD build instance fails to restart after SSH disconnect/VM reboot because the craft-state disk device points at a transient /run/user/<uid>/<pid> path that no longer exists. Unlabelled, zero comments, 245 days old.
qwen/qwen3.6-35b-a3b
Staleness: 90
Complexity: 60
Confidence: 85
Support Request: 10
close stale LXD instance fails to start after SSH disconnect due to missing transient user runtime path. No maintainer activity or comments for 205 days.
qwen3.6-35b-a3b-mtp-q6
Staleness: 75
Complexity: 40
Confidence: 85
Support Request: 10
needs triage LXD device fails to start after SSH disconnect due to missing ephemeral source path. Untriaged, 191 days old, no maintainer response.
qwen3.6-35b-a3b-mtp-q6
Staleness: 80
Complexity: 45
Confidence: 85
Support Request: 10
needs triage LXD disk device fails to start after SSH disconnect or VM restart due to a missing temporary source path. Open for 169 days with zero comments or labels; needs triage and assignment.

Update history

No update history recorded yet.

Related work

  • Related To: craft-application#786 (confidence 60%)

    feat: add a state service — introduced the state dir that is bind-mounted into the LXD instance as disk-/tmp/craft-state and sourced from XDG_RUNTIME_DIR, the path that goes missing.

  • Related To: craft-application#838 (confidence 55%)

    fix(StateService): add g+rwx to the state dir — shows the state dir location/permissions are an active area of change in the same service implicated here.

Related issues

No related issues found above the similarity threshold.