Skip to content

tart exec fails after Linux VM reboot #1220

Description

@smcloughlinTT

Version: 2.32.0

tart exec works the first time it's run on a VM but fails after restarting the VM.

tart clone ghcr.io/cirruslabs/ubuntu:latest test-vm
tart set test-vm --disk-size 20
tart run test-vm --no-graphics & disown
tart exec test-vm "ls"  # This should ls the home directory of the VM
tart stop test-vm
tart run test-vm --no-graphics & disown

# This will hang for ~10s and then fail with "Failed to connect to the VM using its control socket: The operation couldn't be completed. (GRPC.GRPCConnectionPoolError error 1.), is the Tart Guest Agent running?"
tart exec test-vm "ls"

This appears to be a macOS-side issue where stale control sockets are not cleaned up. I've been able to successfully work around this with this script:

#!/bin/bash
# Wrapper around 'tart run' that cleans up stale control sockets first.
# Usage: tart-run <vm-name> [extra tart run args...]

VM_NAME="$1"
if [ -z "$VM_NAME" ]; then
  echo "Usage: tart-run <vm-name> [args...]" >&2
  exit 1
fi

SOCK="$HOME/.tart/vms/$VM_NAME/control.sock"

if [ -S "$SOCK" ]; then
  echo "Removing stale control socket for $VM_NAME..."
  rm -f "$SOCK"
fi

shift
exec tart run "$VM_NAME" "$@"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions