Colima虚拟机启动异常排查

发现 colima ssh 失败,检查 colima list 输出显示虚拟机状态是 Broken :

colima list 输出显示虚拟机状态是 Broken
PROFILE    STATUS    ARCH      CPUS    MEMORY    DISK     RUNTIME    ADDRESS
default    Broken    x86_64    4       8GiB      60GiB

尝试通过前台运行:

前台运行 colima 服务
colima start --foreground

输出报错:

前台运行 colima 服务报错
INFO[0000] starting colima                              
INFO[0000] runtime: containerd                          
INFO[0000] starting ...                                  context=vm
> Using the existing instance "colima"
> errors inspecting instance: [vz driver is running but host agent is not]
FATA[0000] error starting vm: error at 'starting': exit status 1

究竟什么是 vz driver is running but host agent is not ?

参考 colima start does not honor default config, but then overwrites it #985 可能需要执行:

修复colima启动
colima stop -f
rm -rf /Users/$USER/.colima/_lima/_networks
colima start

修复的关键可能是 colima stop -f 这个命令似乎清理了环境(待后续验证),目前还没有再次遇到,可能的因素有:

  • 最近做了一次macOS系统升级,重启可能是强制没有清理干净环境

参考