Overview
Thecloudstic break-lock command forcibly removes lock files from a Cloudstic repository. Locks are automatically acquired by operations like backup, prune, and forget to prevent concurrent writes that could corrupt the repository.
When to Use
Usebreak-lock when:
- A Cloudstic process was killed (SIGKILL, crash, system reboot) and left a stale lock
- You receive an error like:
repository is locked by another operation - You have verified that no other Cloudstic process is running (check with
ps,htop, or your process manager)
Basic Usage
Terminal Output Examples
Stale Lock Removed
No Lock Found
Multiple Locks Removed
Command Flags
break-lock has no command-specific flags. It uses global flags for repository access.
Global Flags
Storage backend type:
local, b2, s3, sftp.Local/SFTP directory path or B2/S3 bucket name.
Key prefix for B2/S3 objects.
Platform key (64 hex chars = 32 bytes) for encrypted repositories.
Repository password for encrypted repositories.
24-word BIP39 recovery phrase.
AWS KMS key ARN for KMS-encrypted repositories.
Log detailed operations.
Suppress output (not recommended for this command).
Log every store request (network calls, timing, sizes).
S3-Specific Flags
S3-compatible endpoint (MinIO, R2, etc.).
S3 region.
S3 access key ID.
S3 secret access key.
SFTP-Specific Flags
SFTP server hostname.
SFTP server port.
SFTP username.
SFTP password.
Path to SSH private key file.
Examples
Local Repository
Remote S3 Repository
SFTP Repository
With Debug Logging
How Locks Work
Lock Acquisition
When a Cloudstic operation starts, it attempts to acquire a lock:- Generate lock ID:
<operation>-<hostname>-<pid>-<timestamp> - Write lock file: Store lock metadata (holder, operation, acquired time, expiration)
- Validate lock: Check that no other exclusive lock exists
- Proceed with operation
Some operations use shared locks (e.g.,
check, restore) that allow concurrent reads. Others use exclusive locks (e.g., backup, prune) to prevent concurrent writes.Lock Expiration
Locks have a default expiration time (typically 1 hour). If a lock is older than its expiration time:- Automatic expiration: New operations can proceed and ignore expired locks
- Manual cleanup:
break-lockremoves expired or stale locks
Lock Storage
Locks are stored as objects in the repository:- Key format:
lock/<operation>-<holder>.lock - Content: JSON metadata (operation, holder, timestamps, shared flag)
- Unencrypted: Lock files are stored in plaintext for debuggability
Understanding Lock Information
Operation
The Cloudstic command that held the lock:backup— Backup operationprune— Prune operationforget— Forget operationinit— Repository initialization (rare, short-lived)
Holder
Unique identifier for the process that acquired the lock:- hostname: Machine hostname
- 12345: Process ID (PID)
- timestamp: When the lock was acquired (ISO 8601 UTC)
Acquired / Expired At
- Acquired: When the lock was first created
- Expired at: When the lock would automatically become invalid
Shared
- true: Shared lock (allows concurrent read operations)
- false: Exclusive lock (prevents all other operations)
Safety Considerations
How to Verify No Active Processes
Linux/macOS
Windows
Systemd/Cron
Check if Cloudstic is running as a scheduled task:When It’s Safe to Break a Lock
✅ Safe scenarios:- Process was killed (SIGKILL, crash, reboot)
- Lock expiration time has passed
- You confirmed no active Cloudstic processes
- Lock holder hostname is a decommissioned machine
- Active backup is in progress on another machine
- Scheduled backup might be running (check cron/systemd)
- Uncertain about process status
Troubleshooting
Error: Failed to init store
-store, -store-path, and credentials (e.g., -s3-access-key, -sftp-host).
Error: Failed to break lock
- Check storage backend permissions (S3 IAM policy, SFTP file permissions)
- Verify you have write access to the repository
Lock reappears immediately after breaking
Cause: Another process is actively creating locks (e.g., running backup). Resolution:- Find and stop the active process
- Wait for the lock to expire naturally (check “Expired at” time)
- Do not repeatedly break locks — this indicates an underlying issue
Repository is corrupted after breaking lock
Cause: Lock was broken while another process was writing. Resolution:- Run
cloudstic checkto assess damage - If errors found, restore from an earlier snapshot or backup
- In the future, always verify no processes are running before breaking locks
Use Cases
Crashed Backup Job
Remote Repository Lock After Server Reboot
CI/CD Pipeline Failure
Exit Codes
- 0 — Success (lock removed or no lock found)
- 1 — Error (store initialization failed, permission denied, or command error)
Related Commands
- cloudstic backup — May create locks that need breaking
- cloudstic prune — Creates exclusive locks
- cloudstic forget — Creates exclusive locks
- cloudstic check — Creates shared locks (rarely needs breaking)