failed to set up forwarding tcp port (`"Failed to set up forward from \"/run/lima-guestagent.sock\" (guest) to \"/Users/xxx/.lima/colima/ga.sock\" (host)"`)
- Dominant language
- Go
- Stars
- 21.9k
- Forks
- 957
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 53
Description
### Description
I run nginx in the colima docker environment, and I can access it normally at the beginning, but after a period of time, I can no longer access it, and I will encounter this problem almost every time I run for a long time;
I tried using limactl to start the virtual machine and run docker, the result is the same
colima version `0.5.0`
limactl version `0.14.1`
os: macOS 13.1 M1
vmType: vz
I found the following log
```json
{"level":"debug","msg":"guest agent event: {Time:2022-12-15 09:58:04.406679394 +0000 UTC LocalPortsAdded:[{IP::: Port:8081} {IP:0.0.0.0 Port:8081}] LocalPortsRemoved:[] Errors:[]}","time":"2022-12-15T17:58:05+08:00"}
{"level":"info","msg":"Forwarding TCP from [::]:8081 to 0.0.0.0:8081","time":"2022-12-15T17:58:05+08:00"}
{"level":"info","msg":"Forwarding TCP from 0.0.0.0:8081 to 0.0.0.0:8081","time":"2022-12-15T17:58:05+08:00"}
{"error":"failed to run [ssh -F /dev/null -o IdentityFile=\"/Users/xxx/.lima/_config/user\" -o IdentityFile=\"/Users/xxx/.ssh/github_rsa\" -o IdentityFile=\"/Users/xxx/.ssh/id_rsa\" -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=xxx -o ControlMaster=auto -o ControlPath=\"/Users/xxx/.lima/colima/ssh.sock\" -o ControlPersist=5m -T -O forward -L 0.0.0.0:8081:0.0.0.0:8081 -N -f -p 54479 127.0.0.1 --]: \"\": exit status 255","level":"warning","msg":"failed to set up forwarding tcp port 8081 (negligible if already forwarded)","time":"2022-12-15T17:58:05+08:00"}
{"error":"unexpected EOF","level":"warning","msg":"connection to the guest agent was closed unexpectedly","time":"2022-12-15T18:24:13+08:00"}
{"level":"info","msg":"Forwarding \"/run/lima-guestagent.sock\" (guest) to \"/Users/xxx/.lima/colima/ga.sock\" (host)","time":"2022-12-15T18:24:23+08:00"}
{"error":"exit status 255","level":"warning","msg":"Failed to set up forward from \"/run/lima-guestagent.sock\" (guest) to \"/Users/xxx/.lima/colima/ga.sock\" (host)","time":"2022-12-15T18:24:23+08:00"}
{"error":null,"level":"warning","msg":"Failed to clean up \"/Users/xxx/.lima/colima/ga.sock\" (host) after forwarding failed","time":"2022-12-15T18:24:23+08:00"}
{"error":"stat /Users/xxx/.lima/colima/ga.sock: no such file or directory","level":"warning","msg":"connection to the guest agent was closed unexpectedly","time":"2022-12-15T18:24:23+08:00"}
{"level":"info","msg":"Forwarding \"/run/lima-guestagent.sock\" (guest) to \"/Users/xxx/.lima/colima/ga.sock\" (host)","time":"2022-12-15T18:24:33+08:00"}
{"error":"exit status 255","level":"warning","msg":"Failed to set up forward from \"/run/lima-guestagent.sock\" (guest) to \"/Users/xxx/.lima/colima/ga.sock\" (host)","time":"2022-12-15T18:24:33+08:00"}
{"error":null,"level":"warning","msg":"Failed to clean up \"/Users/xxx/.lima/colima/ga.sock\" (host) after forwarding failed","time":"2022-12-15T18:24:33+08:00"}
{"error":"stat /Users/xxx/.lima/colima/ga.sock: no such file or directory","level":"warning","msg":"connection to the guest agent was closed unexpectedly","time":"2022-12-15T18:24:33+08:00"}
{"level":"info","msg":"Forwarding \"/run/lima-guestagent.sock\" (guest) to \"/Users/xxx/.lima/colima/ga.sock\" (host)","time":"2022-12-15T18:24:43+08:00"}
{"error":"exit status 255","level":"warning","msg":"Failed to set up forward from \"/run/lima-guestagent.sock\" (guest) to \"/Users/xxx/.lima/colima/ga.sock\" (host)","time":"2022-12-15T18:24:43+08:00"}
{"error":null,"level":"warning","msg":"Failed to clean up \"/Users/xxx/.lima/colima/ga.sock\" (host) after forwarding failed","time":"2022-12-15T18:24:43+08:00"}
{"error":"stat /Users/xxx/.lima/colima/ga.sock: no such file or directory","level":"warning","msg":"connection to the guest agent was closed unexpectedly","time":"2022-12-15T18:24:43+08:00"}
{"level":"info","msg":"Forwarding \"/run/lima-guestagent.sock\" (guest) to \"/Users/xxx/.lima/colima/ga.sock\" (host)","time":"2022-12-15T18:24:53+08:00"}
{"error":"exit status 255","level":"warning","msg":"Failed to set up forward from \"/run/lima-guestagent.sock\" (guest) to \"/Users/xxx/.lima/colima/ga.sock\" (host)","time":"2022-12-15T18:24:53+08:00"}
{"error":null,"level":"warning","msg":"Failed to clean up \"/Users/xxx/.lima/colima/ga.sock\" (host) after forwarding failed","time":"2022-12-15T18:24:53+08:00"}
{"error":"stat /Users/xxx/.lima/colima/ga.sock: no such file or directory","level":"warning","msg":"connection to the guest agent was closed unexpectedly","time":"2022-12-15T18:24:53+08:00"}
{"level":"info","msg":"Forwarding \"/run/lima-guestagent.sock\" (guest) to \"/Users/xxx/.lima/colima/ga.sock\" (host)","time":"2022-12-15T18:25:03+08:00"}
{"error":"exit status 255","level":"warning","msg":"Failed to set up forward from \"/run/lima-guestagent.sock\" (guest) to \"/Users/xxx/.lima/colima/ga.sock\" (host)","time":"2022-12-15T18:25:03+08:00"}
{"error":null,"level":"warning","msg":"Failed to clean up \"/Users/xxx/.lima/colima/ga.sock\" (host) after forwarding failed","time":"2022-12-15T18:25:03+08:00"}
{"error":"stat /Users/xxx/.lima/colima/ga.sock: no such file or directory","level":"warning","msg":"connection to the guest agent was closed unexpectedly","time":"2022-12-15T18:25:03+08:00"}
{"level":"info","msg":"Forwarding \"/run/lima-guestagent.sock\" (guest) to \"/Users/xxx/.lima/colima/ga.sock\" (host)","time":"2022-12-15T18:25:13+08:00"}
{"error":"exit status 255","level":"warning","msg":"Failed to set up forward from \"/run/lima-guestagent.sock\" (guest) to \"/Users/xxx/.lima/colima/ga.sock\" (host)","time":"2022-12-15T18:25:13+08:00"}
{"error":null,"level":"warning","msg":"Failed to clean up \"/Users/xxx/.lima/colima/ga.sock\" (host) after forwarding failed","time":"2022-12-15T18:25:13+08:00"}
{"error":"stat /Users/xxx/.lima/colima/ga.sock: no such file or directory","level":"warning","msg":"connection to the guest agent was closed unexpectedly","time":"2022-12-15T18:25:13+08:00"}
{"level":"info","msg":"Forwarding \"/run/lima-guestagent.sock\" (guest) to \"/Users/xxx/.lima/colima/ga.sock\" (host)","time":"2022-12-15T18:25:23+08:00"}
{"error":"exit status 255","level":"warning","msg":"Failed to set up forward from \"/run/lima-guestagent.sock\" (guest) to \"/Users/xxx/.lima/colima/ga.sock\" (host)","time":"2022-12-15T18:25:23+08:00"}
{"error":null,"level":"warning","msg":"Failed to clean up \"/Users/xxx/.lima/colima/ga.sock\" (host) after forwarding failed","time":"2022-12-15T18:25:23+08:00"}
{"error":"stat /Users/xxx/.lima/colima/ga.sock: no such file or directory","level":"warning","msg":"connection to the guest agent was closed unexpectedly","time":"2022-12-15T18:25:23+08:00"}
{"level":"info","msg":"Forwarding \"/run/lima-guestagent.sock\" (guest) to \"/Users/xxx/.lima/colima/ga.sock\" (host)","time":"2022-12-15T18:25:33+08:00"}
{"error":"exit status 255","level":"warning","msg":"Failed to set up forward from \"/run/lima-guestagent.sock\" (guest) to \"/Users/xxx/.lima/colima/ga.sock\" (host)","time":"2022-12-15T18:25:33+08:00"}
{"error":null,"level":"warning","msg":"Failed to clean up \"/Users/xxx/.lima/colima/ga.sock\" (host) after forwarding failed","time":"2022-12-15T18:25:33+08:00"}
{"error":"stat /Users/xxx/.lima/colima/ga.sock: no such file or directory","level":"warning","msg":"connection to the guest agent was closed unexpectedly","time":"2022-12-15T18:25:33+08:00"}
```
```sh
colima status
FATA[0003] error retrieving current runtime: empty value
```
```sh
limactl ls
NAME STATUS SSH VMTYPE ARCH CPUS MEMORY DISK DIR
colima Running 127.0.0.1:54479 vz aarch64 2 2GiB 1GiB ~/.lima/colima
```
Contributor guide
Research direction
Start by reviewing the guest-agent forwarding logs and reproducing the failure with `colima status` and `limactl ls`. Trace the guest-agent socket and SSH TCP-port forwarding path described in the issue. Done means long-running port forwarding remains available and `colima status` can retrieve the runtime after the failure scenario.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- infrastructure, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100