runfinch / finch

The Finch CLI is an open source client for container development
https://www.runfinch.com
Apache License 2.0
3.48k stars 88 forks source link

[Windows] Check if a Finch WSL2 distribution is running (and stop it) before attempting an upgrade #794

Closed ollypom closed 4 months ago

ollypom commented 5 months ago

Describe the bug During an upgrade the finch.msi should check to see if the Finch WSL2 distribution is running before attempting to proceed with an upgrade. If the distribution is running, the current .msi installer recognizes a limactl process is running, and stops it prior to an upgrade, but was not aware the lima-finch WSL2 distribution was running.

In my testing this resulted in a borked environment where the WSL2 distribution was still running but the Finch data directory had been wiped after a successful upgrade.

Steps to reproduce Perform an upgrade using a .msi without first stopping the Finch VM.

Expected behavior The installer to stop and remove the finch-lima VM from WSL during the upgrade.

Screenshots or logs During the upgrade I was prompted that related process where running.

image

But once the installer had finished I was in a bad spot..

> finch version
Finch version:  v1.1.1
time="2024-02-05T14:03:50Z" level=fatal msg="failed to get VM status: exit status 1, stderr: time=\"2024-02-05T14:03:50Z\" level=fatal msg=\"unable to load instance finch: open C:\\\\Program Files\\\\Finch\\\\lima\\\\data\\\\finch\\\\lima.yaml: The system cannot find the file specified.\"\n"

> finch vm status
time="2024-02-05T14:02:51Z" level=fatal msg="exit status 1, stderr: time=\"2024-02-05T14:02:51Z\" level=fatal msg=\"unable to load instance finch: open C:\\\\Program Files\\\\Finch\\\\lima\\\\data\\\\finch\\\\lima.yaml: The system cannot find the file specified.\"\n"

> wsl —list —running
Windows Subsystem for Linux Distributions:
lima-finch

Additional context

To help debug the issue as quickly as possible, we recommend generating a support bundle with finch support-bundle generate and attaching it to this issue. This packages all Finch-related configs and logs into one file.