lima-vm / lima

Linux virtual machines, with a focus on running containers
https://lima-vm.io/
Apache License 2.0
15.13k stars 591 forks source link

rpc error: "error reading server preface: EOF" #2599

Open jandubois opened 1 month ago

jandubois commented 1 month ago

I've see this once (not reproducible) while starting a default instance using latest master branch:

INFO[0022] [hostagent] Forwarding "/run/lima-guestagent.sock" (guest) to "/Users/jan/.lima/default/ga.sock" (host)
WARN[0022] [hostagent] guest agent events closed unexpectedly  error="rpc error: code = Unavailable desc = connection error: desc = \"error reading server preface: EOF\""
INFO[0022] [hostagent] The optional requirement 1 of 2 is satisfied
JSamir commented 2 weeks ago

I getting this too (reproducible) with colima:

❯ colima start \
    --arch x86_64 \
    --vm-type=vz \
    --vz-rosetta \
    --mount-type=virtiofs \
    --memory 8 \
    --cpu 8 \
    --network-address \
    --very-verbose
TRAC[0000] cmd ["limactl" "info"]
TRAC[0000] cmd ["system_profiler" "-json" "SPHardwareDataType"]
TRAC[0000] cmd ["limactl" "list" "colima" "--json"]
TRAC[0000] error retrieving running instance: instance 'colima' does not exist
INFO[0000] starting colima
INFO[0000] runtime: docker
INFO[0000] creating and starting ...                     context=vm
TRAC[0000] cmd ["limactl" "start" "--tty=false" "/var/folders/cx/92gcnn3j4sj3_rc35f2snhhr0000gq/T/colima.yaml"]
> Terminal is not available, proceeding without opening an editor
> `mountType: 9p` is experimental
> Starting the instance "colima" with VM driver "qemu"
> "Attempting to download the image" arch=x86_64 digest= location=/Users/A3389496/.cache/colima/caches/e6a9564d615abecd0b900517181080ab06de3cdbc367f4848d10f18693ce3ce5.raw
> Downloaded the image from "/Users/A3389496/.cache/colima/caches/e6a9564d615abecd0b900517181080ab06de3cdbc367f4848d10f18693ce3ce5.raw"
> [hostagent] hostagent socket created at /Users/A3389496/.colima_lima/colima/ha.sock
> [hostagent] Using system firmware ("/opt/homebrew/share/qemu/edk2-x86_64-code.fd")
> [hostagent] Starting QEMU (hint: to watch the boot progress, see "/Users/A3389496/.colima_lima/colima/serial*.log")
> SSH Local Port: 49239
> [hostagent] Waiting for the essential requirement 1 of 2: "ssh"
> [hostagent] Waiting for the essential requirement 1 of 2: "ssh"
> [hostagent] Waiting for the essential requirement 1 of 2: "ssh"
> [hostagent] Waiting for the essential requirement 1 of 2: "ssh"
> [hostagent] Waiting for the essential requirement 1 of 2: "ssh"
> [hostagent] The essential requirement 1 of 2 is satisfied
> [hostagent] Waiting for the essential requirement 2 of 2: "user session is ready for ssh"
> [hostagent] The essential requirement 2 of 2 is satisfied
> [hostagent] Waiting for the guest agent to be running
> [hostagent] Forwarding "/var/run/docker.sock" (guest) to "/Users/A3389496/.config/colima/default/docker.sock" (host)
> [hostagent] Forwarding "/var/run/docker.sock" (guest) to "/Users/A3389496/.config/colima/docker.sock" (host)
> [hostagent] Forwarding "/run/lima-guestagent.sock" (guest) to "/Users/A3389496/.colima_lima/colima/ga.sock" (host)
> "[hostagent] guest agent events closed unexpectedly" error="rpc error: code = Unavailable desc = connection error: desc = \"error reading server preface: EOF\""
> [hostagent] Guest agent is running
> [hostagent] Waiting for the final requirement 1 of 1: "boot scripts must have finished"
> [hostagent] Not forwarding TCP 127.0.0.53:53
> [hostagent] Not forwarding TCP 127.0.0.54:53
> [hostagent] Not forwarding TCP [::]:22
> [hostagent] The final requirement 1 of 1 is satisfied
> READY. Run `limactl shell colima` to open the shell.
INFO[0058] provisioning ...                              context=docker
TRAC[0058] cmd ["lima" "sudo" "mkdir" "-p" "/etc/docker"]
TRAC[0058] cmd int ["lima" "sudo" "sh" "-c" "cat > /etc/docker/daemon.json"]
TRAC[0058] cmd ["lima" "sh" "-c" "grep 'host.lima.internal' /etc/hosts | awk -F' ' '{print $1}'"]
TRAC[0058] cmd ["lima" "sudo" "mkdir" "-p" "/etc/systemd/system/docker.service.d"]
TRAC[0059] cmd int ["lima" "sudo" "sh" "-c" "cat > /etc/systemd/system/docker.service.d/docker.conf"]
TRAC[0059] cmd ["lima" "sudo" "systemctl" "daemon-reload"]
TRAC[0061] cmd ["lima" "sudo" "systemctl" "restart" "docker"]
TRAC[0064] cmd ["docker" "context" "inspect" "colima"]
TRAC[0064] cmd ["docker" "context" "create" "colima" "--description" "colima" "--docker" "host=unix:///Users/A3389496/.config/colima/default/docker.sock"]
> colima
> Successfully created context "colima"
TRAC[0064] cmd ["docker" "context" "use" "colima"]
> colima
> Current context is now "colima"
INFO[0064] starting ...                                  context=docker
TRAC[0064] cmd ["lima" "sudo" "service" "docker" "start"]
TRAC[0067] cmd ["lima" "sudo" "docker" "info"]
TRAC[0068] cmd ["lima" "docker" "info"]
TRAC[0069] cmd ["limactl" "list" "colima" "--json"]
TRAC[0069] cmd ["/opt/homebrew/bin/colima" "daemon" "status" "default"]
TRAC[0069] cmd ["limactl" "stop" "colima"]
> Sending SIGINT to hostagent process 1509
> Waiting for the host agent and the driver processes to shut down
> [hostagent] Received SIGINT, shutting down the host agent
> [hostagent] Shutting down the host agent
> [hostagent] Stopping forwarding "/var/run/docker.sock" (guest) to "/Users/A3389496/.config/colima/default/docker.sock" (host)
> [hostagent] Stopping forwarding "/var/run/docker.sock" (guest) to "/Users/A3389496/.config/colima/docker.sock" (host)
> [hostagent] Stopping forwarding "/run/lima-guestagent.sock" (guest) to "/Users/A3389496/.colima_lima/colima/ga.sock" (host)
> [hostagent] Shutting down QEMU with ACPI
> [hostagent] Sending QMP system_powerdown command
> [hostagent] QEMU has exited
TRAC[0073] cmd ["limactl" "list" "colima" "--json"]
TRAC[0073] cmd ["limactl" "start" "colima"]
> Using the existing instance "colima"
> Starting the instance "colima" with VM driver "qemu"
> [hostagent] hostagent socket created at /Users/A3389496/.colima_lima/colima/ha.sock
> [hostagent] Using system firmware ("/opt/homebrew/share/qemu/edk2-x86_64-code.fd")
> [hostagent] Starting QEMU (hint: to watch the boot progress, see "/Users/A3389496/.colima_lima/colima/serial*.log")
> SSH Local Port: 49299
> [hostagent] Waiting for the essential requirement 1 of 2: "ssh"
> [hostagent] Waiting for the essential requirement 1 of 2: "ssh"
> [hostagent] Waiting for the essential requirement 1 of 2: "ssh"
> [hostagent] Waiting for the essential requirement 1 of 2: "ssh"
> [hostagent] Waiting for the essential requirement 1 of 2: "ssh"
> [hostagent] The essential requirement 1 of 2 is satisfied
> [hostagent] Waiting for the essential requirement 2 of 2: "user session is ready for ssh"
> [hostagent] The essential requirement 2 of 2 is satisfied
> [hostagent] Waiting for the guest agent to be running
> [hostagent] Forwarding "/var/run/docker.sock" (guest) to "/Users/A3389496/.config/colima/default/docker.sock" (host)
> [hostagent] Forwarding "/var/run/docker.sock" (guest) to "/Users/A3389496/.config/colima/docker.sock" (host)
> [hostagent] Forwarding "/run/lima-guestagent.sock" (guest) to "/Users/A3389496/.colima_lima/colima/ga.sock" (host)
> [hostagent] Guest agent is running
> [hostagent] Waiting for the final requirement 1 of 1: "boot scripts must have finished"
> [hostagent] Not forwarding TCP 127.0.0.54:53
> [hostagent] Not forwarding TCP 127.0.0.53:53
> [hostagent] Not forwarding TCP [::]:22
> [hostagent] The final requirement 1 of 1 is satisfied
> READY. Run `limactl shell colima` to open the shell.
TRAC[0124] cmd ["lima" "sudo" "cat" "/etc/colima/colima.json"]
TRAC[0125] cmd ["lima" "sudo" "mkdir" "-p" "/etc/colima"]
TRAC[0125] cmd ["lima" "sudo" "mkdir" "-p" "/etc/colima"]
TRAC[0125] cmd int ["lima" "sudo" "sh" "-c" "cat > /etc/colima/colima.json"]
TRAC[0125] cmd ["lima" "sudo" "cat" "/etc/colima/colima.json"]
TRAC[0125] cmd ["lima" "sudo" "mkdir" "-p" "/etc/colima"]
TRAC[0125] cmd ["lima" "sudo" "mkdir" "-p" "/etc/colima"]
TRAC[0126] cmd int ["lima" "sudo" "sh" "-c" "cat > /etc/colima/colima.json"]
INFO[0126] done
TRAC[0126] cmd ["limactl" "list" "--json"]
JSamir commented 2 weeks ago

It was gone after I executed

sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/libexec/bootpd
/usr/libexec/ApplicationFirewall/socketfilterfw --unblock /usr/libexec/bootpd

as described here: https://github.com/lima-vm/socket_vmnet?tab=readme-ov-file#ip-address-is-not-assigned