abiosoft / abiosoft/colima

Running Without KVM?

Aperta
#434 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
30.8k
Fork
613
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I'm attempting to run Colima on WSL2 to debug an issue using for a controlled development environment. However, this produces an error saying `Waiting for the essential requirement 1 of 5: "ssh"`. Diving deeper, we can see this is an issue with KVM not being supported.

### Install Info

Colima was installed on Ubuntu 22.04 in WSL2 (Windows) using Homebrew: `brew install colima`. The version info is:

```
colima version 0.4.5
git commit: c0743565c722d9af03bbfd8f75910ac876bf3b56
```

### Output and Logs

Attempting to run `colima start` produces the following terminal output:

```bash
$ colima start --very-verbose
TRAC[0000] cmd ["limactl" "info"]
TRAC[0000] cmd ["limactl" "list" "colima" "--json"]
INFO[0000] starting colima
INFO[0000] runtime: docker
TRAC[0000] cmd ["limactl" "list" "colima" "--json"]
INFO[0000] starting ... context=vm
TRAC[0000] cmd ["limactl" "start" "colima"]
> Using the existing instance "colima"
> [hostagent] Starting QEMU (hint: to watch the boot progress, see "/home/ahusz/.lima/colima/serial.log")
> SSH Local Port: 33449
> [hostagent] Waiting for the essential requirement 1 of 5: "ssh"
> [hostagent] QEMU has exited
> exiting, status={Running:false Degraded:false Exiting:true Errors:[] SSHLocalPort:0} (hint: see "/home/ahusz/.lima/colima/ha.stderr.log")
FATA[0000] error starting vm: error at 'starting': exit status 1
```

`serial.log` is empty, however, `ha.stderr.log` contains the necessary information:

```json
{"level":"debug","msg":"Creating iso file /home/ahusz/.lima/colima/cidata.iso","time":"2022-09-26T10:27:48-05:00"}
{"level":"debug","msg":"Using /tmp/diskfs_iso3681316796 as workspace","time":"2022-09-26T10:27:48-05:00"}
{"level":"debug","msg":"firmware candidates = [/home/ahusz/.local/share/qemu/edk2-x86_64-code.fd /home/linuxbrew/.linuxbrew/share/qemu/edk2-x86_64-code.fd /usr/share/OVMF/OVMF_CODE.fd /usr/share/qemu/ovmf-x86_64-code.bin /usr/share/edk2-ovmf/x64/OVMF_CODE.fd]","time":"2022-09-26T10:27:48-05:00"}
{"level":"debug","msg":"OpenSSH version 8.9.1 detected","time":"2022-09-26T10:27:48-05:00"}
{"level":"debug","msg":"AES accelerator seems available, prioritizing aes128-gcm@openssh.com and aes256-gcm@openssh.com","time":"2022-09-26T10:27:48-05:00"}
{"level":"debug","msg":"Start udp server listening on: 127.0.0.1:56819","time":"2022-09-26T10:27:48-05:00"}
{"level":"info","msg":"Starting QEMU (hint: to watch the boot progress, see \"/home/ahusz/.lima/colima/serial.log\")","time":"2022-09-26T10:27:48-05:00"}
{"level":"debug","msg":"Start tcp server listening on: 127.0.0.1:36759","time":"2022-09-26T10:27:48-05:00"}
{"level":"debug","msg":"qCmd.Args: [/home/linuxbrew/.linuxbrew/bin/qemu-system-x86_64 -m 2048 -cpu host -machine q35,accel=kvm -smp 2,sockets=1,cores=2,threads=1 -drive if=pflash,format=raw,readonly=on,file=/home/linuxbrew/.linuxbrew/share/qemu/edk2-x86_64-code.fd -boot order=d,splash-time=0,menu=on -drive file=/home/ahusz/.lima/colima/basedisk,media=cdrom,readonly=on -drive file=/home/ahusz/.lima/colima/diffdisk,if=virtio -cdrom /home/ahusz/.lima/colima/cidata.iso -netdev user,id=net0,net=192.168.5.0/24,dhcpstart=192.168.5.15,hostfwd=tcp:127.0.0.1:33449-:22 -device virtio-net-pci,netdev=net0,mac=52:55:55:dc:a1:cc -device virtio-rng-pci -display none -device virtio-vga -device virtio-keyboard-pci -device virtio-mouse-pci -device qemu-xhci,id=usb-bus -parallel none -chardev socket,id=char-serial,path=/home/ahusz/.lima/colima/serial.sock,server=on,wait=off,logfile=/home/ahusz/.lima/colima/serial.log -serial chardev:char-serial -chardev socket,id=char-qmp,path=/home/ahusz/.lima/colima/qmp.sock,server=on,wait=off -qmp chardev:char-qmp -name lima-colima -pidfile /home/ahusz/.lima/colima/qemu.pid]","time":"2022-09-26T10:27:48-05:00"}
{"level":"info","msg":"Waiting for the essential requirement 1 of 5: \"ssh\"","time":"2022-09-26T10:27:48-05:00"}
{"level":"debug","msg":"executing script \"ssh\"","time":"2022-09-26T10:27:48-05:00"}
{"level":"debug","msg":"executing ssh for script \"ssh\": /usr/bin/ssh [ssh -F /dev/null -o IdentityFile=\"/home/ahusz/.lima/_config/user\" -o IdentityFile=\"/home/ahusz/.ssh/git\" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o NoHostAuthenticationForLocalhost=yes -o GSSAPIAuthentication=no -o PreferredAuthentications=publickey -o Compression=no -o BatchMode=yes -o IdentitiesOnly=yes -o Ciphers=\"^aes128-gcm@openssh.com,aes256-gcm@openssh.com\" -o User=ahusz -o ControlMaster=auto -o ControlPath=\"/home/ahusz/.lima/colima/ssh.sock\" -o ControlPersist=5m -p 33449 127.0.0.1 -- /bin/bash]","time":"2022-09-26T10:27:48-05:00"}
{"level":"debug","msg":"stdout=\"\", stderr=\"ssh: connect to host 127.0.0.1 port 33449: Connection refused\\r\\n\", err=failed to execute script \"ssh\": stdout=\"\", stderr=\"ssh: connect to host 127.0.0.1 port 33449: Connection refused\\r\\n\": exit status 255","time":"2022-09-26T10:27:48-05:00"}
{"level":"debug","msg":"qemu[stderr]: Could not access KVM kernel module: No such file or directory","time":"2022-09-26T10:27:48-05:00"}
{"level":"debug","msg":"qemu[stderr]: qemu-system-x86_64: failed to initialize kvm: No such file or directory","time":"2022-09-26T10:27:48-05:00"}
{"error":"exit status 1","level":"info","msg":"QEMU has exited","time":"2022-09-26T10:27:48-05:00"}
```

The key lines seem to be:

```json
{"level":"debug","msg":"stdout=\"\", stderr=\"ssh: connect to host 127.0.0.1 port 33449: Connection refused\\r\\n\", err=failed to execute script \"ssh\": stdout=\"\", stderr=\"ssh: connect to host 127.0.0.1 port 33449: Connection refused\\r\\n\": exit status 255","time":"2022-09-26T10:27:48-05:00"}
{"level":"debug","msg":"qemu[stderr]: Could not access KVM kernel module: No such file or directory","time":"2022-09-26T10:27:48-05:00"}
{"level":"debug","msg":"qemu[stderr]: qemu-system-x86_64: failed to initialize kvm: No such file or directory","time":"2022-09-26T10:27:48-05:00"}
```

After ensuring the necessary packages for KVM were installed, we can see that KVM cannot be used currently:

```bash
$ sudo apt -y install bridge-utils cpu-checker libvirt-clients libvirt-daemon qemu qemu-kvm
$ kvm-ok
INFO: Your CPU does not support KVM extensions
INFO: For more detailed results, you should run this as root
HINT: sudo /usr/sbin/kvm-ok
```

### Additional Info

I'm running Windows 10 Home, which cannot installed the Hyper-V role, which seems to be necessary for KVM support on WSL2 for nested virtualization, and it seems it's a bit [complicated](https://www.reddit.com/r/bashonubuntuonwindows/comments/laje6e/info_your_cpu_does_not_support_kvm_extensions/) (requiring insider builds and compiling your own kernel), so it's more hassle than it's worth for me with my own Linux laptop.

### Summary

It would be nice, however, to be able to disable KVM support if possible so I can run Colima frictionless on WSL2, even at a major performance hit.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.