lima icon indicating copy to clipboard operation
lima copied to clipboard

FATA[0604] did not receive an event with the "running" status (unreachable to Internet with `--network=vzNAT`)

Open fyqtian opened this issue 8 months ago • 11 comments

Description

I want to expose the Docker container port to other hosts. limactl start --vm-type=vz --network=vzNAT template://docker

version

❯ sw_vers
ProductName:		macOS
ProductVersion:		14.7.5
BuildVersion:		23H527
❯ uname -m
arm64
❯ limactl --version
limactl version 1.0.2

run start command


❯ limactl start --vm-type=vz --network=vzNAT  template://docker

? Creating an instance "docker" Proceed with the current configuration
INFO[0001] Starting the instance "docker" with VM driver "vz"
WARN[0001] vmType vz: ignoring networks[0]: [Metric]
INFO[0001] Attempting to download the image              arch=aarch64 digest="sha256:6e1f90d3e81b90202b46c3573590867e575e504af2c63dd5c9b529f174e3d793" location="https://cloud-images.ubuntu.com/releases/24.04/release-20241119/ubuntu-24.04-server-cloudimg-arm64.img"
INFO[0001] Using cache "/Users/fanv/Library/Caches/lima/download/by-url-sha256/9c02b8a6b63e6cb015dc7b94afbe8611f228f355b77ccda89e6f42077c8f5aef/data"
INFO[0001] Converting "/Users/fanv/.lima/docker/basedisk" (qcow2) to a raw disk "/Users/fanv/.lima/docker/diffdisk"
3.50 GiB / 3.50 GiB [---------------------------------------] 100.00% 1.24 GiB/s
INFO[0004] Expanding to 100GiB
INFO[0005] [hostagent] hostagent socket created at /Users/fanv/.lima/docker/ha.sock
INFO[0005] [hostagent] Starting VZ (hint: to watch the boot progress, see "/Users/fanv/.lima/docker/serial*.log")
INFO[0005] SSH Local Port: 55274
INFO[0005] [hostagent] Waiting for the essential requirement 1 of 2: "ssh"
INFO[0005] [hostagent] [VZ] - vm state change: running
INFO[0015] [hostagent] Waiting for the essential requirement 1 of 2: "ssh"
INFO[0032] [hostagent] Waiting for the essential requirement 1 of 2: "ssh"
INFO[0033] [hostagent] The essential requirement 1 of 2 is satisfied
INFO[0033] [hostagent] Waiting for the essential requirement 2 of 2: "user session is ready for ssh"
INFO[0034] [hostagent] The essential requirement 2 of 2 is satisfied
INFO[0034] [hostagent] Waiting for the optional requirement 1 of 1: "user probe 1/1"
INFO[0034] [hostagent] Forwarding "/run/user/502/docker.sock" (guest) to "/Users/fanv/.lima/docker/sock/docker.sock" (host)
INFO[0034] [hostagent] Guest agent is running
INFO[0034] [hostagent] Not forwarding TCP 127.0.0.54:53
INFO[0034] [hostagent] Not forwarding TCP 127.0.0.53:53
INFO[0034] [hostagent] Not forwarding TCP [::]:22
INFO[0074] [hostagent] Waiting for the optional requirement 1 of 1: "user probe 1/1"
INFO[0115] [hostagent] Waiting for the optional requirement 1 of 1: "user probe 1/1"
INFO[0155] [hostagent] Waiting for the optional requirement 1 of 1: "user probe 1/1"
INFO[0195] [hostagent] Waiting for the optional requirement 1 of 1: "user probe 1/1"
INFO[0236] [hostagent] Waiting for the optional requirement 1 of 1: "user probe 1/1"
INFO[0276] [hostagent] Waiting for the optional requirement 1 of 1: "user probe 1/1"
INFO[0316] [hostagent] Waiting for the optional requirement 1 of 1: "user probe 1/1"
INFO[0357] [hostagent] Waiting for the optional requirement 1 of 1: "user probe 1/1"
INFO[0397] [hostagent] Waiting for the optional requirement 1 of 1: "user probe 1/1"
INFO[0438] [hostagent] Waiting for the optional requirement 1 of 1: "user probe 1/1"
INFO[0479] [hostagent] Waiting for the optional requirement 1 of 1: "user probe 1/1"
INFO[0519] [hostagent] Waiting for the optional requirement 1 of 1: "user probe 1/1"
INFO[0560] [hostagent] Waiting for the optional requirement 1 of 1: "user probe 1/1"
INFO[0600] [hostagent] Waiting for the optional requirement 1 of 1: "user probe 1/1"
FATA[0604] did not receive an event with the "running" status

log

❯ cat ~/.lima/docker/serial*.log

Ubuntu 24.04.1 LTS lima-docker hvc0

lima-docker login: %

fyqtian avatar May 15 '25 04:05 fyqtian

Try running these commands manually in limactl shell docker

https://github.com/lima-vm/lima/blob/b87e7214e6eeb3b3ea8d59b272f2218079ac32e4/templates/docker.yaml#L38-L56

AkihiroSuda avatar May 15 '25 05:05 AkihiroSuda

What is the working directory? I am at /Users/fanv when I run limactl shell docker.

fyqtian avatar May 15 '25 07:05 fyqtian

What is the working directory? I am at /Users/fanv when I run limactl shell docker.

Any directory

AkihiroSuda avatar May 15 '25 07:05 AkihiroSuda

fanv@lima-docker:/Users/fanv/.lima/docker$ dockerd-rootless-setuptool.sh install
dockerd-rootless-setuptool.sh: command not found

fyqtian avatar May 15 '25 07:05 fyqtian

These steps seems to have failed?

https://github.com/lima-vm/lima/blob/b87e7214e6eeb3b3ea8d59b272f2218079ac32e4/templates/docker.yaml#L28-L37

AkihiroSuda avatar May 15 '25 07:05 AkihiroSuda

And the network is broken

fanv@lima-docker:/Users/fanv/.lima/docker$ curl https://google.com --verbose
* Host google.com:443 was resolved.
* IPv6: (none)
* IPv4: 142.250.199.206
*   Trying 142.250.199.206:443...

fyqtian avatar May 15 '25 07:05 fyqtian

Does it work if you remove --network=vzNAT?

AkihiroSuda avatar May 15 '25 07:05 AkihiroSuda

Yes, I ran the default configuration originally limactl start template://docker, not trying the --vm-type=vz

fyqtian avatar May 15 '25 07:05 fyqtian

limactl start --vm-type=vz template://docker is working

 limactl start --vm-type=vz  template://docker

? Creating an instance "docker" Proceed with the current configuration
WARN[0001] treating lima version "<unknown>" from "/Users/fanv/.lima/test/lima-version" as very latest release
INFO[0001] Starting the instance "docker" with VM driver "vz"
INFO[0001] Attempting to download the image              arch=aarch64 digest="sha256:6e1f90d3e81b90202b46c3573590867e575e504af2c63dd5c9b529f174e3d793" location="https://cloud-images.ubuntu.com/releases/24.04/release-20241119/ubuntu-24.04-server-cloudimg-arm64.img"
INFO[0001] Using cache "/Users/fanv/Library/Caches/lima/download/by-url-sha256/9c02b8a6b63e6cb015dc7b94afbe8611f228f355b77ccda89e6f42077c8f5aef/data"
INFO[0001] Converting "/Users/fanv/.lima/docker/basedisk" (qcow2) to a raw disk "/Users/fanv/.lima/docker/diffdisk"
3.50 GiB / 3.50 GiB [---------------------------------------] 100.00% 1.09 GiB/s
INFO[0004] Expanding to 100GiB
INFO[0005] [hostagent] hostagent socket created at /Users/fanv/.lima/docker/ha.sock
INFO[0005] [hostagent] Starting VZ (hint: to watch the boot progress, see "/Users/fanv/.lima/docker/serial*.log")
INFO[0006] SSH Local Port: 65286
INFO[0005] [hostagent] [VZ] - vm state change: running
INFO[0005] [hostagent] Waiting for the essential requirement 1 of 2: "ssh"
INFO[0015] [hostagent] Waiting for the essential requirement 1 of 2: "ssh"
INFO[0016] [hostagent] The essential requirement 1 of 2 is satisfied
INFO[0016] [hostagent] Waiting for the essential requirement 2 of 2: "user session is ready for ssh"
INFO[0018] [hostagent] The essential requirement 2 of 2 is satisfied
INFO[0018] [hostagent] Waiting for the optional requirement 1 of 1: "user probe 1/1"
INFO[0018] [hostagent] Forwarding "/run/user/502/docker.sock" (guest) to "/Users/fanv/.lima/docker/sock/docker.sock" (host)
INFO[0018] [hostagent] Guest agent is running
INFO[0018] [hostagent] Not forwarding TCP [::]:22
INFO[0018] [hostagent] Not forwarding TCP 127.0.0.53:53
INFO[0018] [hostagent] Not forwarding TCP 127.0.0.54:53
INFO[0059] [hostagent] Waiting for the optional requirement 1 of 1: "user probe 1/1"
INFO[0075] [hostagent] The optional requirement 1 of 1 is satisfied
INFO[0075] [hostagent] Waiting for the guest agent to be running
INFO[0075] [hostagent] Waiting for the final requirement 1 of 1: "boot scripts must have finished"
INFO[0077] [hostagent] The final requirement 1 of 1 is satisfied
INFO[0077] READY. Run `limactl shell docker` to open the shell.
INFO[0077] Message from the instance "docker":
To run `docker` on the host (assumes docker-cli is installed), run the following commands:
------
docker context create lima-docker --docker "host=unix:///Users/fanv/.lima/docker/sock/docker.sock"
docker context use lima-docker
docker run hello-world
------
❯ docker context create lima-docker --docker "host=unix:///Users/fanv/.lima/docker/sock/docker.sock"docker context use lima-docker
❯ docker context create lima-docker --docker "host=unix:///Users/fanv/.lima/docker/sock/docker.sock"
lima-docker
Successfully created context "lima-docker"
❯ docker context use lima-docker
lima-docker
Current context is now "lima-docker"
❯ docker ps ls
"docker ps" accepts no arguments.
See 'docker ps --help'.

Usage:  docker ps [OPTIONS]

List containers
❯ docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

fyqtian avatar May 15 '25 07:05 fyqtian

I'm also encountering this, although, on a different OS image, and with the guest successfully starting but lacking any internet connectivity.

I found two separate issues breaking internet connectivity:

  1. DNS is unreachable.
  2. Network connection is routed incorrectly.

The former can be fixed by adding any reachable DNS servers to /etc/resolv.conf. For example:

# /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 192.168.5.2

The latter is a lot more difficult because it requires fiddling with the default routes. These are the default routes created on my guest:

$ ip r
default via 192.168.106.1 dev lima0 proto dhcp src 192.168.106.4 metric 100
default via 192.168.5.2 dev eth0 proto dhcp src 192.168.5.15 metric 200
192.168.5.0/24 dev eth0 proto kernel scope link src 192.168.5.15 metric 200
192.168.106.0/24 dev lima0 proto kernel scope link src 192.168.106.4 metric 100

As you can see, the lima0 interface comes first.

A quick fix is removing the first default route via

$ ip route del default

However, this breaks connectivity between the VMs, which for me, is the reason I'm using vnNAT in the first place.

Unfortunately, I didn't manage to move the routes around without breaking DHCP for the lima0 interface. However, it's possible to simply add a new default:

ip route add default via 192.168.5.2

However, the connection for lima0 is constantly going up and down, and it feels kinda random whether there is an IP assigned or not. Especially when running more than one VM.


$ sw_vers
ProductName:            macOS
ProductVersion:         15.4.1
BuildVersion:           24E263

$ uname -m
arm64

$ limactl --version
limactl version 1.0.7

Leandros avatar May 21 '25 13:05 Leandros

However, this breaks connectivity between the VMs, which for me, is the reason I'm using vnNAT in the first place.

For connectivity between the VMs, user-v2 can be used rather than vzNAT. https://lima-vm.io/docs/config/network/user-v2/

AkihiroSuda avatar May 21 '25 15:05 AkihiroSuda