lima-vm / lima

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

`limactl start` fails to bind to SSH port (ssh: connect to host 127.0.0.1 port 60022: Connection refused) #17

Open agatti opened 3 years ago

agatti commented 3 years ago

On my machine/configuration SSH seems to not be able to bind to port 60022 and therefore things fail to start. I've checked whether I already have anything else listening on that port on the localhost interface but the port is indeed available.

The image to boot is the default one, and I'm running macOS 11.3.1. QEMU comes from MacPorts and entitlements are correctly installed. Debug log follows:

agatti@tardigrade ~ % limactl --debug start
DEBU[0000] interpreting argument "default" as an instance name "default"
INFO[0000] Using the existing instance "default"
INFO[0000] Starting QEMU
DEBU[0000] qCmd.Args: [/opt/local/bin/qemu-system-x86_64 -cpu Haswell-v4 -machine q35,accel=hvf -smp 4,sockets=1,cores=4,threads=1 -m 4096 -drive if=pflash,format=raw,readonly,file=/opt/local/share/qemu/edk2-x86_64-code.fd -drive file=/Users/agatti/.lima/default/diffdisk,if=virtio -boot c -cdrom /Users/agatti/.lima/default/cidata.iso -net nic,model=virtio -net user,net=192.168.5.0/24,hostfwd=tcp:127.0.0.1:60022-:22 -device virtio-rng-pci -device virtio-vga -device virtio-keyboard-pci -device virtio-mouse-pci -parallel none -name lima-default -pidfile /Users/agatti/.lima/default/qemu-pid]
INFO[0000] SSH: 127.0.0.1:60022
INFO[0000] Waiting for the essential requirement 1 of 3: "ssh"
DEBU[0000] executing script "ssh"
DEBU[0000] executing ssh for script "ssh": /usr/bin/ssh [ssh -o ControlMaster=auto -o ControlPath=/Users/agatti/.lima/default/ssh.sock -o ControlPersist=5m -o StrictHostKeyChecking=no -o NoHostAuthenticationForLocalhost=yes -o GSSAPIAuthentication=no -o PreferredAuthentications=publickey -o Compression=no -o BatchMode=yes -p 60022 127.0.0.1 -- /bin/bash]
DEBU[0000] stdout="", stderr="ssh: connect to host 127.0.0.1 port 60022: Connection refused\r\n", err=failed to execute script "ssh": stdout="", stderr="ssh: connect to host 127.0.0.1 port 60022: Connection refused\r\n": exit status 255

[then keeps looping on waiting for ssh]

Is there anything else I should check to get this to at least start?

AkihiroSuda commented 3 years ago

Do you seen any error on the QEMU VGA screen or on the serial console (Ctrl-Alt-2)?

vidner commented 3 years ago

I have the same issue, i tried to manually run the ssh command with verbose option and its says the ControlPath does not exist.

ssh -vvv -o ControlMaster=auto -o ControlPath=/Users/vidner/.lima/default/ssh.sock -o ControlPersist=5m -o StrictHostKeyChecking=no -o NoHostAuthenticationForLocalhost=yes -o GSSAPIAuthentication=no -o PreferredAuthentications=publickey -o Compression=no -o BatchMode=yes -p 60022 127.0.0.1 -- /bin/bash
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/vidner/.ssh/config
debug1: /Users/vidner/.ssh/config line 21: Skipping Host block because of negated match for 127.0.0.1
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: /etc/ssh/ssh_config line 52: Applying options for *
debug2: resolve_canonicalize: hostname 127.0.0.1 is address
debug1: auto-mux: Trying existing master
debug1: Control socket "/Users/vidner/.lima/default/ssh.sock" does not exist
debug2: ssh_connect_direct
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 60022.
debug1: connect to address 127.0.0.1 port 60022: Connection refused
ssh: connect to host 127.0.0.1 port 60022: Connection refused
agatti commented 3 years ago

@AkihiroSuda unfortunately I don't see any errors in the QEMU window or in the serial console...

AkihiroSuda commented 3 years ago

MacPorts version of QEMU might be compiled without support for libslirp (unconfirmed): https://github.com/macports/macports-ports/blob/master/emulators/qemu/Portfile

Could you try homebrew package of QEMU?

agatti commented 3 years ago

Tried installing homebrew's version, nothing really changed. Short of rebuilding QEMU myself, is there anything else I can try?

idrissneumann commented 3 years ago

Same errors here (installed with homebrew):

ineumann ~ $ limactl --debug start
DEBU[0000] interpreting argument "default" as an instance name "default" 
INFO[0000] Using the existing instance "default"        
INFO[0000] Downloading "https://github.com/containerd/nerdctl/releases/download/v0.9.0/nerdctl-full-0.9.0-linux-arm64.tar.gz" 
DEBU[0000] file "/var/folders/gj/052mqkk12r55d2xv7lymqf640000gn/T/lima-download-nerdctl975222294/nerdctl-full-0.9.0-linux-arm64.tar.gz" is cached as "/Users/ineumann/Library/Caches/lima/download/by-url-sha256/08927199d45dbbfa40ed207c68567a6913b7b347c62c033a5c501220bd8958b2/data" 
INFO[0000] Using cache "/Users/ineumann/Library/Caches/lima/download/by-url-sha256/08927199d45dbbfa40ed207c68567a6913b7b347c62c033a5c501220bd8958b2/data" 
INFO[0000] [hostagent] Starting QEMU (hint: to watch the boot progress, see "/Users/ineumann/.lima/default/serial.log") 
DEBU[0000] [hostagent] qCmd.Args: [/opt/homebrew/bin/qemu-system-aarch64 -cpu cortex-a72 -machine virt,accel=hvf,highmem=off -smp 4,sockets=1,cores=4,threads=1 -m 4096 -drive if=pflash,format=raw,readonly,file=/opt/homebrew/share/qemu/edk2-aarch64-code.fd -boot order=c,splash-time=0,menu=on -drive file=/Users/ineumann/.lima/default/diffdisk,if=virtio -cdrom /Users/ineumann/.lima/default/cidata.iso -net nic,model=virtio -net user,net=192.168.5.0/24,hostfwd=tcp:127.0.0.1:60022-:22 -device virtio-rng-pci -display none -vga none -device ramfb -device usb-ehci -device usb-kbd -device usb-mouse -parallel none -chardev socket,id=char-serial,path=/Users/ineumann/.lima/default/serial.sock,server,nowait,logfile=/Users/ineumann/.lima/default/serial.log -serial chardev:char-serial -chardev socket,id=char-qmp,path=/Users/ineumann/.lima/default/qmp.sock,server,nowait -qmp chardev:char-qmp -name lima-default -pidfile /Users/ineumann/.lima/default/qemu.pid] 
DEBU[0000] received an event                             event="{2021-06-23 16:37:15.771105 +0100 CET {false false false [] 60022}}"
INFO[0000] SSH Local Port: 60022                        
INFO[0000] [hostagent] Waiting for the essential requirement 1 of 4: "ssh" 
DEBU[0000] [hostagent] executing script "ssh"           
DEBU[0000] [hostagent] stdout="", stderr="ssh: connect to host 127.0.0.1 port 60022: Connection refused\r\n", err=failed to execute script "ssh": stdout="", stderr="ssh: connect to host 127.0.0.1 port 60022: Connection refused\r\n": exit status 255 
INFO[0000] [hostagent] QEMU has exited                  
DEBU[0000] received an event                             event="{2021-06-23 16:37:15.820858 +0100 CET {false false true [] 0}}"
FATA[0000] exiting, status={Running:false Degraded:false Exiting:true Errors:[] SSHLocalPort:0} (hint: see "/Users/ineumann/.lima/default/ha.stderr.log") 
ineumann ~ $ cat /Users/ineumann/.lima/default/ha.stderr.log
{"level":"info","msg":"Starting QEMU (hint: to watch the boot progress, see \"/Users/ineumann/.lima/default/serial.log\")","time":"2021-06-23T16:37:15+01:00"}
{"level":"debug","msg":"qCmd.Args: [/opt/homebrew/bin/qemu-system-aarch64 -cpu cortex-a72 -machine virt,accel=hvf,highmem=off -smp 4,sockets=1,cores=4,threads=1 -m 4096 -drive if=pflash,format=raw,readonly,file=/opt/homebrew/share/qemu/edk2-aarch64-code.fd -boot order=c,splash-time=0,menu=on -drive file=/Users/ineumann/.lima/default/diffdisk,if=virtio -cdrom /Users/ineumann/.lima/default/cidata.iso -net nic,model=virtio -net user,net=192.168.5.0/24,hostfwd=tcp:127.0.0.1:60022-:22 -device virtio-rng-pci -display none -vga none -device ramfb -device usb-ehci -device usb-kbd -device usb-mouse -parallel none -chardev socket,id=char-serial,path=/Users/ineumann/.lima/default/serial.sock,server,nowait,logfile=/Users/ineumann/.lima/default/serial.log -serial chardev:char-serial -chardev socket,id=char-qmp,path=/Users/ineumann/.lima/default/qmp.sock,server,nowait -qmp chardev:char-qmp -name lima-default -pidfile /Users/ineumann/.lima/default/qemu.pid]","time":"2021-06-23T16:37:15+01:00"}
{"level":"info","msg":"Waiting for the essential requirement 1 of 4: \"ssh\"","time":"2021-06-23T16:37:15+01:00"}
{"level":"debug","msg":"executing script \"ssh\"","time":"2021-06-23T16:37:15+01:00"}
{"level":"debug","msg":"stdout=\"\", stderr=\"ssh: connect to host 127.0.0.1 port 60022: Connection refused\\r\\n\", err=failed to execute script \"ssh\": stdout=\"\", stderr=\"ssh: connect to host 127.0.0.1 port 60022: Connection refused\\r\\n\": exit status 255","time":"2021-06-23T16:37:15+01:00"}
{"error":"exit status 1","level":"info","msg":"QEMU has exited","time":"2021-06-23T16:37:15+01:00"}
exit status 1

And the homebrew dependancies:

Screenshot 2021-06-23 at 16 37 08

(QEMU 6.0.0 and libslirp 4.6.1)

And precision about the mac:

Screenshot 2021-06-23 at 16 39 10

(MBP 13 Ship M1)

AkihiroSuda commented 3 years ago

Qemu still requires a patch for ARM Mac

https://gist.github.com/nrjdalal/e70249bb5d2e9d844cc203fd11f74c55

agatti commented 3 years ago

@AkihiroSuda in my case, I'm using an Intel-based macbook so it can't be that?

AkihiroSuda commented 3 years ago

@agatti please show *.log files under ~/.lima/default

idrissneumann commented 3 years ago

@AkihiroSuda Thanks it works well with the patch of QEMU.

Screenshot 2021-06-23 at 23 22 22

Seems pretty promising! Thanks again.

unixorn commented 3 years ago

I'm seeing this same issue. I'm on an Intel MacBook Pro, macOS 11.4 (20F71).

❯ limactl --debug start
DEBU[0000] interpreting argument "default" as an instance name "default"
? Creating an instance "default" Proceed with the default configuration
INFO[0001] Downloading "https://github.com/containerd/nerdctl/releases/download/v0.9.0/nerdctl-full-0.9.0-linux-amd64.tar.gz"
DEBU[0001] file "/var/folders/dw/55kvh5_57x340vm7251kgvmm0000gn/T/lima-download-nerdctl004299890/nerdctl-full-0.9.0-linux-amd64.tar.gz" is cached as "/Users/jpb/Library/Caches/lima/download/by-url-sha256/4c048fab91ba88527ad58a6b4dc4c3bfa35e828b8147565456b76d362ec2e6cb/data"
INFO[0001] Using cache "/Users/jpb/Library/Caches/lima/download/by-url-sha256/4c048fab91ba88527ad58a6b4dc4c3bfa35e828b8147565456b76d362ec2e6cb/data"
INFO[0002] Attempting to download the image from "~/Downloads/hirsute-server-cloudimg-amd64.img"
INFO[0002] Attempting to download the image from "https://cloud-images.ubuntu.com/hirsute/current/hirsute-server-cloudimg-amd64.img"
DEBU[0002] file "/Users/jpb/.lima/default/basedisk" is cached as "/Users/jpb/Library/Caches/lima/download/by-url-sha256/e1fed960ebd29619676c7ab7535bc83f7fb2ad71739edb6fde4e17bce0b61a47/data"
INFO[0003] Using cache "/Users/jpb/Library/Caches/lima/download/by-url-sha256/e1fed960ebd29619676c7ab7535bc83f7fb2ad71739edb6fde4e17bce0b61a47/data"
INFO[0003] [hostagent] Starting QEMU (hint: to watch the boot progress, see "/Users/jpb/.lima/default/serial.log")
DEBU[0003] [hostagent] qCmd.Args: [/usr/local/bin/qemu-system-x86_64 -cpu Haswell-v4 -machine q35,accel=hvf -smp 4,sockets=1,cores=4,threads=1 -m 4096 -drive if=pflash,format=raw,readonly,file=/usr/local/share/qemu/edk2-x86_64-code.fd -boot order=c,splash-time=0,menu=on -drive file=/Users/jpb/.lima/default/diffdisk,if=virtio -cdrom /Users/jpb/.lima/default/cidata.iso -net nic,model=virtio -net user,net=192.168.5.0/24,hostfwd=tcp:127.0.0.1:60022-:22 -device virtio-rng-pci -display none -device virtio-vga -device virtio-keyboard-pci -device virtio-mouse-pci -parallel none -chardev socket,id=char-serial,path=/Users/jpb/.lima/default/serial.sock,server,nowait,logfile=/Users/jpb/.lima/default/serial.log -serial chardev:char-serial -chardev socket,id=char-qmp,path=/Users/jpb/.lima/default/qmp.sock,server,nowait -qmp chardev:char-qmp -name lima-default -pidfile /Users/jpb/.lima/default/qemu.pid]
DEBU[0003] received an event                             event="{2021-06-23 22:26:47.702068 -0600 MDT {false false false [] 60022}}"
INFO[0003] SSH Local Port: 60022
INFO[0003] [hostagent] Waiting for the essential requirement 1 of 4: "ssh"
DEBU[0003] [hostagent] executing script "ssh"
DEBU[0003] [hostagent] stdout="", stderr="ssh: connect to host 127.0.0.1 port 60022: Connection refused\r\n", err=failed to execute script "ssh": stdout="", stderr="ssh: connect to host 127.0.0.1 port 60022: Connection refused\r\n": exit status 255
INFO[0013] [hostagent] Waiting for the essential requirement 1 of 4: "ssh"
DEBU[0013] [hostagent] executing script "ssh"
DEBU[0019] [hostagent] stdout="", stderr="kex_exchange_identification: read: Connection reset by peer\r\n", err=failed to execute script "ssh": stdout="", stderr="kex_exchange_identification: read: Connection reset by peer\r\n": exit status 255
INFO[0029] [hostagent] Waiting for the essential requirement 1 of 4: "ssh"
DEBU[0029] [hostagent] executing script "ssh"
DEBU[0029] [hostagent] stdout="", stderr="jpb@127.0.0.1: Permission denied (publickey).\r\n", err=failed to execute script "ssh": stdout="", stderr="jpb@127.0.0.1: Permission denied (publickey).\r\n": exit status 255
INFO[0039] [hostagent] Waiting for the essential requirement 1 of 4: "ssh"

qemu info:

❯ brew info qemu
qemu: stable 6.0.0 (bottled), HEAD
Emulator for x86 and PowerPC
https://www.qemu.org/
/usr/local/Cellar/qemu/6.0.0 (161 files, 569.8MB) *
  Poured from bottle on 2021-06-23 at 20:24:00
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/qemu.rb
License: GPL-2.0-only
==> Dependencies
Build: libtool ✔, meson ✔, ninja ✔, pkg-config ✔
Required: glib ✔, gnutls ✔, jpeg ✔, libpng ✔, libslirp ✔, libssh ✔, libusb ✔, lzo ✔, ncurses ✔, nettle ✔, pixman ✔, snappy ✔, vde ✔
==> Options
--HEAD
    Install HEAD version
==> Analytics
install: 16,161 (30 days), 40,020 (90 days), 126,729 (365 days)
install-on-request: 16,057 (30 days), 39,861 (90 days), 125,610 (365 days)
build-error: 0 (30 days)
❯
AkihiroSuda commented 3 years ago

@unixorn https://github.com/AkihiroSuda/lima/issues/17#issuecomment-867005906

elixir67 commented 3 years ago

@agatti and @unixorn I have the same issue with intel based macbook pro, macos 11.5.2, did you find any solution? Thanks in advance!

I finally find it need sign the binary manually similar as https://github.com/lima-vm/lima#qemu-crashes-with-hv_error, while I didn't see the HV_ERROR in the logs. Then it turns to another issue, similar as https://github.com/lima-vm/lima#stuck-on-waiting-for-the-essential-requirement-1-of-x-ssh, while my libslirp is already v4.6.1. Any idea on that?

image

image

image

gtch commented 2 years ago

I am encountering a similar problem on an M1 Mac mini running macOS 12.0.1. When I run limactl start it gets stuck on the Waiting for the essential requirement 1 of 5: "ssh" message:

% limactl start         
? Creating an instance "default" Proceed with the default configuration
INFO[0001] Attempting to download the image from "~/Downloads/impish-server-cloudimg-arm64.img"  digest=
INFO[0001] Attempting to download the image from "https://cloud-images.ubuntu.com/impish/current/impish-server-cloudimg-arm64.img"  digest=
INFO[0001] Using cache "/Users/admin/Library/Caches/lima/download/by-url-sha256/a9f81252e41821dac2357ea4c9b5a5a1c71526b41bc4473d6365fa3594b86dd9/data" 
INFO[0001] Attempting to download the nerdctl archive from "https://github.com/containerd/nerdctl/releases/download/v0.13.0/nerdctl-full-0.13.0-linux-arm64.tar.gz"  digest="sha256:8a744638b01cd53c437a0d2a54c66f0ec4a918b75e93056393e7076bbf06a173"
INFO[0001] Using cache "/Users/admin/Library/Caches/lima/download/by-url-sha256/b8e4d6c61f4294e7e6808bbb6c9d63e6515065b53f377046e0a42a4b4731e5cc/data" 
INFO[0003] [hostagent] Starting QEMU (hint: to watch the boot progress, see "/Users/admin/.lima/default/serial.log") 
INFO[0003] SSH Local Port: 60022                        
INFO[0003] [hostagent] Waiting for the essential requirement 1 of 5: "ssh" 
INFO[0032] [hostagent] Waiting for the essential requirement 1 of 5: "ssh" 
INFO[0042] [hostagent] Waiting for the essential requirement 1 of 5: "ssh" 
INFO[0052] [hostagent] Waiting for the essential requirement 1 of 5: "ssh" 

However the error in ~/.lima/default/ha.stderr.log is different to @elixir67; I'm getting a "Permission denied (publickey)" message like this:

{"level":"info","msg":"Waiting for the essential requirement 1 of 5: \"ssh\"","time":"2021-11-20T13:21:08+11:00"}
{"level":"debug","msg":"executing script \"ssh\"","time":"2021-11-20T13:21:08+11:00"}
{"level":"debug","msg":"executing ssh for script \"ssh\": /usr/bin/ssh [ssh -F /dev/null -o IdentityFile=\"/Users/admin/.lima/_config/user\" -o IdentityFile=\"/Users/admin/.ssh/id_ed25519\" -o IdentityFile=\"/Users/admin/.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=admin -o ControlMaster=auto -o ControlPath=\"/Users/admin/.lima/default/ssh.sock\" -o ControlPersist=5m -p 60022 127.0.0.1 -- /bin/bash]","time":"2021-11-20T13:21:08+11:00"}
{"level":"debug","msg":"stdout=\"\", stderr=\"admin@127.0.0.1: Permission denied (publickey).\\r\\n\", err=failed to execute script \"ssh\": stdout=\"\", stderr=\"admin@127.0.0.1: Permission denied (publickey).\\r\\n\": exit status 255","time":"2021-11-20T13:21:08+11:00"}

I'm using the latest versions of everything including libslirp v4.6.1:

% HOMEBREW_NO_ANALYTICS=true brew info lima qemu libslirp
lima: stable 0.7.3 (bottled)
Linux virtual machines
https://github.com/lima-vm/lima
/opt/homebrew/Cellar/lima/0.7.3 (34 files, 26.2MB) *
  Poured from bottle on 2021-11-20 at 13:11:59
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/lima.rb
License: Apache-2.0
==> Dependencies
Build: go ✘
Required: qemu ✔
==> Caveats
zsh completions have been installed to:
  /opt/homebrew/share/zsh/site-functions

qemu: stable 6.1.0 (bottled), HEAD
Emulator for x86 and PowerPC
https://www.qemu.org/
/opt/homebrew/Cellar/qemu/6.1.0_1 (161 files, 550.6MB) *
  Poured from bottle on 2021-11-20 at 13:11:36
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/qemu.rb
License: GPL-2.0-only
==> Dependencies
Build: libtool ✔, meson ✘, ninja ✘, pkg-config ✔
Required: glib ✔, gnutls ✔, jpeg ✔, libpng ✔, libslirp ✔, libssh ✔, libusb ✔, lzo ✔, ncurses ✔, nettle ✔, pixman ✔, snappy ✔, vde ✔
==> Options
--HEAD
    Install HEAD version

libslirp: stable 4.6.1 (bottled)
General purpose TCP-IP emulator
https://gitlab.freedesktop.org/slirp/libslirp
/opt/homebrew/Cellar/libslirp/4.6.1 (11 files, 389.5KB) *
  Poured from bottle on 2021-11-20 at 13:11:22
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/libslirp.rb
License: BSD-3-Clause
==> Dependencies
Build: meson ✘, ninja ✘, pkg-config ✔
Required: glib ✔

It seems something is going wrong with validating the keys, but I can't work out what.

I've poked around in the cidata.iso file and can see the correct public key information being added to USER_DATA so there doesn't seem to be any problem with the keys themselves.

I've tried connecting with both the Lima key (eg ~/.lima/_config/user) my own keys (eg ~/.ssh/id_ed25519 and ~/.ssh/id_rsa) and I get the same "Permission denied (publickey)" error for all of them. Verbose logging of the ssh command used by Lima shows it is trying those keys but they're failing:

% ssh -v -F /dev/null -o IdentityFile=\"/Users/admin/.lima/_config/user\" -o IdentityFile=\"/Users/admin/.ssh/id_ed25519\" -o IdentityFile=\"/Users/admin/.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=admin -o ControlMaster=auto -o ControlPath=\"/Users/admin/.lima/default/ssh.sock\" -o ControlPersist=5m -p 60022 127.0.0.1 -- /bin/bash
OpenSSH_8.6p1, LibreSSL 2.8.3
debug1: Reading configuration data /dev/null
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: auto-mux: Trying existing master
debug1: Control socket "/Users/admin/.lima/default/ssh.sock" does not exist
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 60022.
debug1: Connection established.
debug1: identity file /Users/admin/.lima/_config/user type 3
debug1: identity file /Users/admin/.lima/_config/user-cert type -1
debug1: identity file /Users/admin/.ssh/id_ed25519 type 3
debug1: identity file /Users/admin/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/admin/.ssh/id_rsa type 0
debug1: identity file /Users/admin/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.4p1 Ubuntu-6ubuntu2
debug1: compat_banner: match: OpenSSH_8.4p1 Ubuntu-6ubuntu2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 127.0.0.1:60022 as 'admin'
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: aes128-gcm@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: aes128-gcm@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:s8c4ORGPs+2K8w4DTnDrxxidb5APhOTRlgZlxpsGAXY
debug1: Forcing accepting of host key for loopback/localhost.
debug1: rekey out after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 4294967296 blocks
debug1: Will attempt key: /Users/admin/.lima/_config/user ED25519 SHA256:YeQFMdU+qrYUZcW6vck2tlICGiZFNMDAe3ReGVqJDfk explicit
debug1: Will attempt key: /Users/admin/.ssh/id_ed25519 ED25519 SHA256:qZU5Us6wTWSPs1Ts9b2cMLrDVGPG2dWZn09vvp97Vmw explicit
debug1: Will attempt key: /Users/admin/.ssh/id_rsa RSA SHA256:ZSTNLXmczN9WFdgyKACyLYkrhsH1kmwJTIYPWOKbAYI explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/admin/.lima/_config/user ED25519 SHA256:YeQFMdU+qrYUZcW6vck2tlICGiZFNMDAe3ReGVqJDfk explicit
debug1: Authentications that can continue: publickey
debug1: Offering public key: /Users/admin/.ssh/id_ed25519 ED25519 SHA256:qZU5Us6wTWSPs1Ts9b2cMLrDVGPG2dWZn09vvp97Vmw explicit
debug1: Authentications that can continue: publickey
debug1: Offering public key: /Users/admin/.ssh/id_rsa RSA SHA256:ZSTNLXmczN9WFdgyKACyLYkrhsH1kmwJTIYPWOKbAYI explicit
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
admin@127.0.0.1: Permission denied (publickey).

So is there possibly still a problem with libslirp or another dependency which is breaking this? The behaviour seems a lot like a bug but I don't know how to isolate it.

Jasstkn commented 2 years ago

@AkihiroSuda same problem here with intel mac. any suggestions how to overcome it?

{"level":"debug","msg":"firmware candidates = [/usr/local/share/qemu/edk2-x86_64-code.fd /usr/share/OVMF/OVMF_CODE.fd /usr/share/qemu/ovmf-x86_64-code.bin]","time":"2022-01-19T19:37:00+03:00"}
{"level":"debug","msg":"OpenSSH version 8.1.1 detected","time":"2022-01-19T19:37:00+03:00"}
{"level":"debug","msg":"AES accelerator seems available, prioritizing aes128-gcm@openssh.com and aes256-gcm@openssh.com","time":"2022-01-19T19:37:00+03:00"}
{"level":"info","msg":"Starting QEMU (hint: to watch the boot progress, see \"/Users/username/.lima/default/serial.log\")","time":"2022-01-19T19:37:00+03:00"}
{"level":"debug","msg":"qCmd.Args: [/usr/local/bin/qemu-system-x86_64 -cpu host -machine q35,accel=hvf -smp 4,sockets=1,cores=4,threads=1 -m 4096 -drive if=pflash,format=raw,readonly=on,file=/usr/local/share/qemu/edk2-x86_64-code.fd -boot order=c,splash-time=0,menu=on -drive file=/Users/username/.lima/default/diffdisk,if=virtio -cdrom /Users/username/.lima/default/cidata.iso -netdev user,id=net0,net=192.168.5.0/24,dhcpstart=192.168.5.15,hostfwd=tcp:127.0.0.1:60022-:22 -device virtio-net-pci,netdev=net0,mac=52:55:55:f5:b6:7d -device virtio-rng-pci -display none -device virtio-vga -device virtio-keyboard-pci -device virtio-mouse-pci -parallel none -chardev socket,id=char-serial,path=/Users/username/.lima/default/serial.sock,server=on,wait=off,logfile=/Users/username/.lima/default/serial.log -serial chardev:char-serial -chardev socket,id=char-qmp,path=/Users/username/.lima/default/qmp.sock,server=on,wait=off -qmp chardev:char-qmp -name lima-default -pidfile /Users/username/.lima/default/qemu.pid]","time":"2022-01-19T19:37:00+03:00"}
{"level":"info","msg":"Waiting for the essential requirement 1 of 5: \"ssh\"","time":"2022-01-19T19:37:00+03:00"}
{"level":"debug","msg":"executing script \"ssh\"","time":"2022-01-19T19:37:00+03:00"}
{"level":"debug","msg":"executing ssh for script \"ssh\": /usr/bin/ssh [ssh -F /dev/null -o IdentityFile=\"/Users/username/.lima/_config/user\" -o IdentityFile=\"/Users/username/.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=lima -o ControlMaster=auto -o ControlPath=\"/Users/username/.lima/default/ssh.sock\" -o ControlPersist=5m -p 60022 127.0.0.1 -- /bin/bash]","time":"2022-01-19T19:37:00+03:00"}
{"level":"debug","msg":"stdout=\"\", stderr=\"ssh: connect to host 127.0.0.1 port 60022: Connection refused\\r\\n\", err=failed to execute script \"ssh\": stdout=\"\", stderr=\"ssh: connect to host 127.0.0.1 port 60022: Connection refused\\r\\n\": exit status 255","time":"2022-01-19T19:37:00+03:00"}
{"level":"info","msg":"Waiting for the essential requirement 1 of 5: \"ssh\"","time":"2022-01-19T19:37:10+03:00"}
{"level":"debug","msg":"executing script \"ssh\"","time":"2022-01-19T19:37:10+03:00"}
{"level":"debug","msg":"executing ssh for script \"ssh\": /usr/bin/ssh [ssh -F /dev/null -o IdentityFile=\"/Users/username/.lima/_config/user\" -o IdentityFile=\"/Users/username/.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=lima -o ControlMaster=auto -o ControlPath=\"/Users/username/.lima/default/ssh.sock\" -o ControlPersist=5m -p 60022 127.0.0.1 -- /bin/bash]","time":"2022-01-19T19:37:10+03:00"}
{"level":"debug","msg":"stdout=\"\", stderr=\"kex_exchange_identification: read: Connection reset by peer\\r\\n\", err=failed to execute script \"ssh\": stdout=\"\", stderr=\"kex_exchange_identification: read: Connection reset by peer\\r\\n\": exit status 255","time":"2022-01-19T19:38:25+03:00"}
brew info qemu
qemu: stable 6.2.0 (bottled), HEAD
Emulator for x86 and PowerPC
https://www.qemu.org/
/usr/local/Cellar/qemu/6.2.0 (162 files, 556.7MB) *
  Poured from bottle on 2022-01-18 at 13:18:52
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/qemu.rb
License: GPL-2.0-only
==> Dependencies
Build: libtool ✔, meson ✘, ninja ✘, pkg-config ✔
Required: glib ✔, gnutls ✔, jpeg ✔, libpng ✔, libslirp ✔, libssh ✔, libusb ✔, lzo ✔, ncurses ✔, nettle ✔, pixman ✔, snappy ✔, vde ✔
==> Options
--HEAD
    Install HEAD version
==> Analytics
install: 36,150 (30 days), 88,995 (90 days), 245,593 (365 days)
install-on-request: 23,514 (30 days), 59,300 (90 days), 193,740 (365 days)
build-error: 23 (30 days)
AkihiroSuda commented 2 years ago

@Jasstkn Do you see any output in $HOME/.lima/<INSTANCE>/serial.log ?

Jasstkn commented 2 years ago

@Jasstkn Do you see any output in $HOME/.lima/<INSTANCE>/serial.log ?

Nothing useful it seems. ha.stdout.log ha.stderr.log serial.log

AkihiroSuda commented 2 years ago

@Jasstkn

serial.log


[=3hBdsDxe: loading Boot0008 "ubuntu" from HD(15,GPT,29820B86-B0EA-45D5-A154-ABE3DA041C3D,0x2800,0x35000)/\EFI\ubuntu\shimx64.efi
BdsDxe: starting Boot0008 "ubuntu" from HD(15,GPT,29820B86-B0EA-45D5-A154-ABE3DA041C3D,0x2800,0x35000)/\EFI\ubuntu\shimx64.efi
GNU GRUB  version 2.04

Minimal BASH-like line editing is supported. For the first word, TAB

lists possible command completions. Anywhere else TAB lists possible

device or file completions.

grub>


Seems a duplicate of:
- https://github.com/lima-vm/lima/issues/525

This may work

limactl rm -f default limactl prune limactl start

Jasstkn commented 2 years ago

@Jasstkn

serial.log

�[2J�[01;01H�[=3h�[2J�[01;01H�[0m�[35m�[40m�[0m�[37m�[40mBdsDxe: loading Boot0008 "ubuntu" from HD(15,GPT,29820B86-B0EA-45D5-A154-ABE3DA041C3D,0x2800,0x35000)/\EFI\ubuntu\shimx64.efi
BdsDxe: starting Boot0008 "ubuntu" from HD(15,GPT,29820B86-B0EA-45D5-A154-ABE3DA041C3D,0x2800,0x35000)/\EFI\ubuntu\shimx64.efi
�[02;30HGNU GRUB  version 2.04

   Minimal BASH-like line editing is supported. For the first word, TAB   

   lists possible command completions. Anywhere else TAB lists possible   

   device or file completions.                                            

grub> 

Seems a duplicate of:

This may work

limactl rm -f default
limactl prune
limactl start

it helped! thank you very much!