lima-vm/lima · error
error running wslCommand that executes boot.sh (%v): %w, che
Error message
error running wslCommand that executes boot.sh (%v): %w, check /var/log/lima-init.log for more details (out=%#q)
What it means
Lima's WSL2 driver runs the instance's boot.sh provisioning script inside the WSL distro via wslCommand and captures its combined output. If the command exits non-zero, Lima wraps the original error together with the command arguments and captured output, because boot.sh failure means guest provisioning did not complete.
Source
Thrown at pkg/driver/wsl2/vm_windows.go:130
// because main.handleExitCoder() traps it, so wrap the error
return fmt.Errorf("failed to run wslpath command: %w", err)
}
limaBootFileLinuxPath := strings.TrimSpace(string(limaBootFilePathOnLinuxB))
go func() {
cmd := exec.CommandContext(
ctx,
"wsl.exe",
"-d",
distroName,
"bash",
"-c",
limaBootFileLinuxPath,
)
out, err := cmd.CombinedOutput()
os.RemoveAll(limaBootFileWinPath)
logrus.Debugf("%v: %#q", cmd.Args, string(out))
if err != nil {
errCh <- fmt.Errorf(
"error running wslCommand that executes boot.sh (%v): %w, "+
"check /var/log/lima-init.log for more details (out=%#q)", cmd.Args, err, string(out))
}
<-ctx.Done()
logrus.Info("Context closed, stopping vm")
if status, err := getWslStatus(ctx, instanceName); err == nil &&
status == limatype.StatusRunning {
_ = stopVM(ctx, distroName)
}
}()
return err
}
// keepAlive runs a background process which in order to keep the WSL2 VM running in the background after launch.
func keepAlive(ctx context.Context, distroName string, errCh chan<- error) {
keepAliveCmd := exec.CommandContext(View on GitHub (pinned to dd909d0973)
Solutions
- Read /var/log/lima-init.log inside the distro (wsl -d <distroName> cat /var/log/lima-init.log) to find the failing provisioning step
- Inspect the out= portion of this error for stderr from boot.sh
- Fix or remove the failing provisioning steps in the instance's Lima YAML (provision section) and recreate the instance
- Ensure the guest has network/DNS access and the distro finished first-boot setup before provisioning
- Rerun limactl start after fixing; delete the broken instance with limactl delete if provisioning is half-applied
Example fix
// before
provision:
- mode: system
script: apt-get install -y mypkg # fails if apt index is stale
// after
provision:
- mode: system
script: apt-get update && apt-get install -y mypkg Defensive patterns
Strategy: try-catch
Validate before calling
// Verify provisioning script is syntactically valid before start
const { execFileSync } = require('child_process');
execFileSync('bash', ['-n', 'boot.sh'], { stdio: 'inherit' }); // syntax check Type guard
function hasBootOutput(r) { return r && typeof r.out === 'string'; } Try / catch
try {
await limactlStart(inst);
} catch (e) {
if (String(e).includes('error running wslCommand that executes boot.sh')) {
const log = execFileSync('wsl', ['-d', distro, 'cat', '/var/log/lima-init.log']).toString();
console.error('Provisioning failed; lima-init.log tail:', log.slice(-2000));
} else throw e;
} Prevention
- Syntax-check provisioning scripts with bash -n before embedding them in lima.yaml
- Keep provisioning steps idempotent so a retry after partial failure succeeds
- Test provisioning scripts in a plain WSL distro before adding them to Lima config
- Ensure guest network/DNS works; add apt-get update before installs
When it happens
Trigger: The wsl.exe invocation executing lima-boot-file (boot.sh) returns a non-zero exit status during instance start; cmd.CombinedOutput() populates err. Provisioning commands inside boot.sh (package installs, systemctl, user setup) fail inside the guest.
Common situations: A provisioning script step fails due to no network in the guest, a bad apt/yum mirror, invalid provisioning YAML converted into boot.sh, or the distro not being fully initialized when boot.sh runs. The real cause is visible in /var/log/lima-init.log inside the distro.
Related errors
- failed to construct wsl boot.sh script: %w
- failed to run wslpath command: %w
- cannot use `--sync` with a wsl2 instance, the host directory
- unimplemented
- failed to run `wsl.exe --distribution %s`: %w (out=%#q)
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/894e209dad9ef12b.
Report an issue: GitHub.