mac-vz / macvz

macOS Virtualization for linux
MIT License
85 stars 6 forks source link

Failed to run example docker instance #22

Open jjaychen1e opened 2 years ago

jjaychen1e commented 2 years ago

Describe the bug FATA[0015] hostagent ("/Users/jjaychen/.macvz/docker/vz.pid") did not start up in 15s (hint: see "/Users/jjaychen/.macvz/docker/ha.stderr.log")

To Reproduce Run macvz start https://raw.githubusercontent.com/mac-vz/macvz/main/examples/docker.yaml, or mccvc start docker

Versions (please complete the following information):

Additional context

{"level":"fatal","msg":"stat /Users/jjaychen/.macvz/_config/user: no such file or directory","time":"2022-07-13T23:32:10+08:00"}

balajiv113 commented 2 years ago

@JJAYCHEN1e Thanks for raising bug.

Could you please also share if its intel or m1 mac

jjaychen1e commented 2 years ago

@balajiv113 Thanks for replying, I'm using a M1 Mac.

balajiv113 commented 2 years ago

Thanks for the info. Will check and let you know

balajiv113 commented 2 years ago

I found a bug in code which looked for ssh private key before it is generated.

I have just released a new version v0.0.4. Could you try with that please :)

To update, just running brew install macvz again is sufficient

jjaychen1e commented 2 years ago

@balajiv113 I've tried v0.0.4, I got another error when run macvz start https://raw.githubusercontent.com/mac-vz/macvz/main/examples/docker.yaml:

INFO[0000] Using cache "/Users/jjaychen/Library/Caches/lima/download/by-url-sha256/358295da728c41e4057ee8ec8dc2c32bdcdd68f0e5807d5a1a85e3d066aab5b1/data"
INFO[0000] Using cache "/Users/jjaychen/Library/Caches/lima/download/by-url-sha256/3600f143c75230ab3a3ae85c2435df4e518ebd0c3228227f317ff4598fcea6b7/data"
INFO[0000] Using cache "/Users/jjaychen/Library/Caches/lima/download/by-url-sha256/1a321ff82ac77f52fbb71a1f52b01a645be50aa980ea0e8f701e506a8f7e69f7/data"
FATA[0027] hostagent ("/Users/jjaychen/.macvz/docker/vz.pid") did not start up in 15s (hint: see "/Users/jjaychen/.macvz/docker/ha.stderr.log")

log:

{"level":"debug","msg":"executing [ssh-keygen -t ed25519 -q -N  -f /Users/jjaychen/.macvz/_config/user]","time":"2022-07-14T11:56:50+08:00"}
{"level":"debug","msg":"OpenSSH version 8.6.1 detected","time":"2022-07-14T11:56:50+08:00"}
{"level":"debug","msg":"AES accelerator seems available, prioritizing aes128-gcm@openssh.com and aes256-gcm@openssh.com","time":"2022-07-14T11:56:50+08:00"}
{"level":"info","msg":"Waiting for the host requirement 1 of 1: \"Host IP Bind\"","time":"2022-07-14T11:56:50+08:00"}
{"level":"debug","msg":"executing script \"Host IP Bind\"","time":"2022-07-14T11:56:50+08:00"}
{"level":"info","msg":"in start: Error Domain=VZErrorDomain Code=1 Description=\"Internal Virtualization error. The virtual machine failed to start.\" UserInfo={\n    NSLocalizedFailure = \"Internal Virtualization error.\";\n    NSLocalizedFailureReason = \"The virtual machine failed to start.\";\n}","time":"2022-07-14T11:56:50+08:00"}
{"level":"fatal","msg":"RUNerror during start of VM","time":"2022-07-14T11:56:50+08:00"}

I also tried to remove ~/.macvz and uninstall & install macvc, still the same error.

BalajiVijayakumar1195 commented 2 years ago

Ah !! Thanks for checking it out.

Let me take a look again. I tried 0.0.4 with Intel, things were smooth again. Will give a shot with M1 and get back on this

balajiv113 commented 2 years ago

Also if possible could you please share the log under ~/.macvz/docker/vz.stderr.log

jjaychen1e commented 2 years ago

Also if possible could you please share the log under ~/.macvz/docker/vz.stderr.log

I'm sorry, it's empty. I upload all log files under ~/.macvz/docker/ here:

ha.stderr.log ha.stdout.log vz.stderr.log vz.stdout.log

balajiv113 commented 2 years ago

@JJAYCHEN1e Sorry for the trouble again :) Can you give a try now. Did a new release to fix the issue.

The issue was, for m1 mac the kernel, disk images should be arm one. But it was picking amd images.

jjaychen1e commented 2 years ago

@JJAYCHEN1e Sorry for the trouble again :) Can you give a try now. Did a new release to fix the issue.

The issue was, for m1 mac the kernel, disk images should be arm one. But it was picking amd images.

It's almost the same(version 0.0.4-1):

...
INFO[0181] Downloaded image from "https://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-arm64.tar.gz"
FATA[0214] hostagent ("/Users/jjaychen/.macvz/docker/vz.pid") did not start up in 15s (hint: see "/Users/jjaychen/.macvz/docker/ha.stderr.log")

ha.stderr.log ha.stdout.log vz.stderr.log vz.stdout.log

balajiv113 commented 2 years ago

Hope you have tried by removing the ~/.macvz folder. If not could you give a try once.

jjaychen1e commented 2 years ago

Hope you have tried by removing the ~/.macvz folder. If not could you give a try once.

I tried again, but I got the same log. Thanks for you patience!!

balajiv113 commented 2 years ago

Thanks a lot for testing 👍

Will do a full test with M1 and let you know ASAP.

0xADD1E commented 2 years ago

I'd like to get someone else to confirm this, but @JJAYCHEN1e if, per chance, you're running the latest macOS 13 Beta, I believe this might be an issue with VZLinuxBootLoader itself in this release

jjaychen1e commented 2 years ago

I'd like to get someone else to confirm this, but @JJAYCHEN1e if, per chance, you're running the latest macOS 13 Beta, I believe this might be an issue with VZLinuxBootLoader itself in this release

I'm using macOS 12.4

daudcanugerah commented 2 years ago

same error macOs 12.2.1 (M1) ha.stderr.log: {"level":"debug","msg":"executing [ssh-keygen -t ed25519 -q -N -f /Users/ivosights/.macvz/_config/user]","time":"2022-07-22T06:25:58+07:00"} {"level":"debug","msg":"OpenSSH version 8.6.1 detected","time":"2022-07-22T06:25:58+07:00"} {"level":"debug","msg":"AES accelerator seems available, prioritizing aes128-gcm@openssh.com and aes256-gcm@openssh.com","time":"2022-07-22T06:25:58+07:00"} {"level":"info","msg":"Waiting for the host requirement 1 of 1: \"Host IP Bind\"","time":"2022-07-22T06:25:58+07:00"} {"level":"debug","msg":"executing script \"Host IP Bind\"","time":"2022-07-22T06:25:58+07:00"} {"level":"info","msg":"in start: Error Domain=VZErrorDomain Code=1 Description=\"Internal Virtualization error. The virtual machine failed to start.\" UserInfo={\n NSLocalizedFailure = \"Internal Virtualization error.\";\n NSLocalizedFailureReason = \"The virtual machine failed to start.\";\n}","time":"2022-07-22T06:25:58+07:00"} {"level":"fatal","msg":"RUNerror during start of VM","time":"2022-07-22T06:25:58+07:00"}

balajiv113 commented 2 years ago

Thanks @daudcanugerah for double checking and verifying. Currently am stuck as I don't have a M1 to debug on. Looking for ways to debug. Will soon fix this.

balajiv113 commented 2 years ago

@JJAYCHEN1e I hope it should work now. The ubuntu kernel for arm is compressed. Virtualization framework needs the kernel to be uncompressed.

Can you please try to do brew install macvz --head to install based on current main. I will do a release once its verified fixed.

daudcanugerah commented 2 years ago

ok i try

daudcanugerah commented 2 years ago
  1. run brew install macvz --HEAD Warning: mac-vz/tap/macvz HEAD-a58360b is already installed and up-to-date.

  2. delete ~/.macvz and run macvz start https://raw.githubusercontent.com/mac-vz/macvz/main/examples/docker.yaml error: {"level":"debug","msg":"OpenSSH version 8.6.1 detected","time":"2022-07-22T14:15:30+07:00"} {"level":"debug","msg":"AES accelerator seems available, prioritizing aes128-gcm@openssh.com and aes256-gcm@openssh.com","time":"2022-07-22T14:15:30+07:00"} {"level":"fatal","msg":"failed to read ssh public key \"/Users/ivosights/.macvz/_config/user.pub\": open /Users/ivosights/.macvz/_config/user.pub: no such file or directory","time":"2022-07-22T14:15:30+07:

  3. run mkdir -p ~/.macvz/_config and copy local ssh.pub and run macvz start docker still same error {"level":"debug","msg":"OpenSSH version 8.6.1 detected","time":"2022-07-22T14:16:13+07:00"} {"level":"debug","msg":"AES accelerator seems available, prioritizing aes128-gcm@openssh.com and aes256-gcm@openssh.com","time":"2022-07-22T14:16:13+07:00"} {"level":"info","msg":"Waiting for the host requirement 1 of 1: \"Host IP Bind\"","time":"2022-07-22T14:16:13+07:00"} {"level":"debug","msg":"executing script \"Host IP Bind\"","time":"2022-07-22T14:16:13+07:00"} {"level":"info","msg":"in start: Error Domain=VZErrorDomain Code=1 Description=\"Internal Virtualization error. The virtual machine failed to start.\" UserInfo={\n NSLocalizedFailure = \"Internal Virtualization error.\";\n NSLocalizedFailureReason = \"The virtual machine failed to start.\";\n}","time":"2022-07-22T14:16:13+07:00"} {"level":"fatal","msg":"RUNerror during start of VM","time":"2022-07-22T14:16:13+07:00"}

balajiv113 commented 2 years ago

@daudcanugerah Please do brew reinstall macvz. Since its already installed on head it won't update the binary if we don't do reinstall

Thanks for trying it out :)

daudcanugerah commented 2 years ago

after reinstall macvz, still get same error {"level":"debug","msg":"OpenSSH version 8.6.1 detected","time":"2022-07-22T20:03:18+07:00"} {"level":"debug","msg":"AES accelerator seems available, prioritizing aes128-gcm@openssh.com and aes256-gcm@openssh.com","time":"2022-07-22T20:03:18+07:00"} {"level":"info","msg":"Waiting for the host requirement 1 of 1: \"Host IP Bind\"","time":"2022-07-22T20:03:18+07:00"} {"level":"debug","msg":"executing script \"Host IP Bind\"","time":"2022-07-22T20:03:18+07:00"} {"level":"info","msg":"in start: Error Domain=VZErrorDomain Code=1 Description=\"Internal Virtualization error. The virtual machine failed to start.\" UserInfo={\n NSLocalizedFailure = \"Internal Virtualization error.\";\n NSLocalizedFailureReason = \"The virtual machine failed to start.\";\n}","time":"2022-07-22T20:03:18+07:00"} {"level":"fatal","msg":"RUNerror during start of VM","time":"2022-07-22T20:03:18+07:00"}

jjaychen1e commented 2 years ago

@daudcanugerah Same to me.

{"level":"debug","msg":"executing [ssh-keygen -t ed25519 -q -N  -f /Users/jjaychen/.macvz/_config/user]","time":"2022-07-22T19:55:12+08:00"}
{"level":"debug","msg":"OpenSSH version 8.6.1 detected","time":"2022-07-22T19:55:12+08:00"}
{"level":"debug","msg":"AES accelerator seems available, prioritizing aes128-gcm@openssh.com and aes256-gcm@openssh.com","time":"2022-07-22T19:55:12+08:00"}
{"level":"info","msg":"Waiting for the host requirement 1 of 1: \"Host IP Bind\"","time":"2022-07-22T19:55:12+08:00"}
{"level":"debug","msg":"executing script \"Host IP Bind\"","time":"2022-07-22T19:55:12+08:00"}
{"level":"info","msg":"in start: Error Domain=VZErrorDomain Code=1 Description=\"Internal Virtualization error. The virtual machine failed to start.\" UserInfo={\n    NSLocalizedFailure = \"Internal Virtualization error.\";\n    NSLocalizedFailureReason = \"The virtual machine failed to start.\";\n}","time":"2022-07-22T19:55:12+08:00"}
{"level":"fatal","msg":"RUNerror during start of VM","time":"2022-07-22T19:55:12+08:00"}
daudcanugerah commented 2 years ago

@JJAYCHEN1e issues that may be related: https://github.com/utmapp/UTM/issues/4099

balajiv113 commented 2 years ago

@JJAYCHEN1e & @daudcanugerah I have now verified its working in mac m1.

There is still 1 issue /dev/rtc file is not created for arm instance for some reason due to this, apt update is failing.

You could start plain ubuntu (without install docker scripts) and install docker manually, this is working fine

brandonros commented 1 week ago

There's still some kind of issue.

$ macvz start https://raw.githubusercontent.com/brandonros/macvz/ubuntu/examples/ubuntu.yaml
INFO[0000] Using cache "/Users/brandon/Library/Caches/lima/download/by-url-sha256/643c41cd053b86b29fbe465c3edbdb9655ea2742ecea759f11c4d51a74af716c/data" 
INFO[0000] Using cache "/Users/brandon/Library/Caches/lima/download/by-url-sha256/8b8b7fc06491fc1e7e2e1b342e3ad7074c717fbcd278b1053418a3bff48b4009/data" 
INFO[0000] Using cache "/Users/brandon/Library/Caches/lima/download/by-url-sha256/b77cb0caf964d0210a59f957545c3b6e8415ab79196dc48a054e591d98d0382e/data" 
FATA[0028] hostagent ("/Users/brandon/.macvz/ubuntu/vz.pid") did not start up in 15s (hint: see "/Users/brandon/.macvz/ubuntu/ha.stderr.log")
images:
- kernel: "https://cloud-images.ubuntu.com/releases/focal/release/unpacked/ubuntu-20.04-server-cloudimg-amd64-vmlinuz-generic"
  initram: "https://cloud-images.ubuntu.com/releases/focal/release/unpacked/ubuntu-20.04-server-cloudimg-amd64-initrd-generic"
  base: "https://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-amd64.tar.gz"
  arch: "x86_64"
- kernel: "https://cloud-images.ubuntu.com/releases/focal/release/unpacked/ubuntu-20.04-server-cloudimg-arm64-vmlinuz-generic"
  initram: "https://cloud-images.ubuntu.com/releases/focal/release/unpacked/ubuntu-20.04-server-cloudimg-arm64-initrd-generic"
  base: "https://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-arm64.tar.gz"
  arch: "aarch64"
mounts:
- location: "~"
  writable: true
disk: 20GB
portForwards:
  - guestPortRange:
      - 1
      - 65535
    hostIP: 0.0.0.0
hostResolver:
  enabled: true
  hosts:
    host.ubuntu.internal: host.macvz.internal
 $ cat /Users/brandon/.macvz/ubuntu/ha.stderr.log
{"level":"debug","msg":"OpenSSH version 9.8.1 detected","time":"2024-11-08T11:02:23-05:00"}
{"level":"debug","msg":"AES accelerator seems available, prioritizing aes128-gcm@openssh.com and aes256-gcm@openssh.com","time":"2024-11-08T11:02:24-05:00"}
{"level":"info","msg":"Waiting for the host requirement 1 of 1: \"Host IP Bind\"","time":"2024-11-08T11:02:24-05:00"}
{"level":"debug","msg":"executing script \"Host IP Bind\"","time":"2024-11-08T11:02:24-05:00"}
{"level":"debug","msg":"stdout=\"\", stderr={\"\" '\\x00' '\\x00'}, err=exit status 1","time":"2024-11-08T11:02:24-05:00"}
{"level":"info","msg":"in start: Error Domain=VZErrorDomain Code=1 Description=\"Internal Virtualization error. The virtual machine failed to start.\" UserInfo={\n    NSLocalizedFailure = \"Internal Virtualization error.\";\n    NSLocalizedFailureReason = \"The virtual machine failed to start.\";\n}","time":"2024-11-08T11:02:24-05:00"}
{"level":"fatal","msg":"RUNerror during start of VM","time":"2024-11-08T11:02:24-05:00"}