2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

BrokenなLima VMを復旧する

Posted at

概要

Lima VMを起動しようとしたらエラー。
何度か遭遇したものの、毎回復旧手順を忘れるので備忘録として記録しておきます。

現象

$ limactl start docker
INFO[0000] Using the existing instance "docker"         
FATA[0000] errors inspecting instance: [failed to get Info from "/Users/ogawatti/.lima/docker/ha.sock": Get "http://lima-hostagent/v1/info": dial unix /Users/ogawatti/.lima/docker/ha.sock: connect: connection refused] 

改めてステータスを確認、壊れているらしい。

$ limactl ls
WARN[0000] instance "docker" has errors                  errors="[failed to get Info from \"/Users/ogawatti/.lima/docker/ha.sock\": Get \"http://lima-hostagent/v1/info\": dial unix /Users/ogawatti/.lima/docker/ha.sock: connect: connection refused]"
NAME      STATUS    SSH            ARCH       CPUS    MEMORY    DISK      DIR
docker    Broken    127.0.0.1:0    aarch64    4       8GiB      100GiB    /Users/ogawatti/.lima/docker

対応

強制オプションでVMを停止する。

$ limactl stop -f docker

調査

復旧系のコマンドはなさそう。

$ limactl -h
...
Available Commands:
  completion    Generate the autocompletion script for the specified shell
  copy          Copy files between host and guest
  delete        Delete an instance of Lima.
  edit          Edit an instance of Lima
  factory-reset Factory reset an instance of Lima
  help          Help about any command
  info          Show diagnostic information
  list          List instances of Lima.
  prune         Prune garbage objects
  shell         Execute shell in Lima
  show-ssh      Show the ssh command line
  start         Start an instance of Lima
  stop          Stop an instance
  sudoers       Generate the content of the /etc/sudoers.d/lima file
  validate      Validate YAML files
...

マニュアルもない。

$ man limactl 
No manual entry for limactl

この状態だとVM削除もできない。

$ limactl delete docker
FATA[0000] failed to delete instance "docker": expected status "Stopped", got "Broken"

メッセージに従い、状態を停止にしようと試みる。

$ limactl stop docker
FATA[0000] expected status "Running", got "Broken" (maybe use `limactl stop -f`?) 

-f オプションがあることを知る(思い出す)。 delete にもあった。

$ limactl stop -h
Stop an instance

Usage:
  limactl stop INSTANCE [flags]

Flags:
  -f, --force   force stop the instance
  -h, --help    help for stop

Global Flags:
      --debug   debug mode

強制オプションでVMを停止する。

$ limactl stop -f docker
INFO[0000] The QEMU process seems already stopped       
INFO[0000] Sending SIGKILL to the host agent process 2910 
ERRO[0000] operation not permitted                      
INFO[0000] Removing *.pid *.sock under "/Users/ogawatti/.lima/docker" 
INFO[0000] Removing "/Users/ogawatti/.lima/docker/ga.sock" 
INFO[0000] Removing "/Users/ogawatti/.lima/docker/ha.pid" 
INFO[0000] Removing "/Users/ogawatti/.lima/docker/ha.sock" 

停止状態になる。

$ limactl ls
NAME      STATUS     SSH            ARCH       CPUS    MEMORY    DISK      DIR
docker    Stopped    127.0.0.1:0    aarch64    4       8GiB      100GiB    /Users/ogawatti/.lima/docker

以降、これまで通りに使える。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?