Skip to content

Krunkit: support SSHOverVsock and replace SSH-based guestagent connection with vsock#4822

Merged
AkihiroSuda merged 1 commit into
lima-vm:masterfrom
unsuman:krunkit/add-guest-agent-conn
Apr 24, 2026
Merged

Krunkit: support SSHOverVsock and replace SSH-based guestagent connection with vsock#4822
AkihiroSuda merged 1 commit into
lima-vm:masterfrom
unsuman:krunkit/add-guest-agent-conn

Conversation

@unsuman
Copy link
Copy Markdown
Member

@unsuman unsuman commented Apr 9, 2026

Since the upstream issue(libkrun/krunkit#79) is now fixed, this PR transitions the krunkit driver from using SSH local socket forwarding for guestagent communication to virtio-vsock implementation.

@unsuman unsuman added the area/vmdrivers VM driver infrastructure label Apr 9, 2026
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SSHOverVsock can be implemented too?

Copy link
Copy Markdown
Member Author

@unsuman unsuman Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think it should be possible but maybe in a different PR?

[EDIT]: NVM, I'll do it in this PR itself

@unsuman unsuman force-pushed the krunkit/add-guest-agent-conn branch 2 times, most recently from 0e0e40c to 74a847d Compare April 13, 2026 18:36
@unsuman unsuman changed the title krunkit: replace SSH-based guestagent connection with vsock Krunkit: support SSHOverVsock and replace SSH-based guestagent connection with vsock Apr 13, 2026
@unsuman unsuman force-pushed the krunkit/add-guest-agent-conn branch from 74a847d to dd630c0 Compare April 13, 2026 18:40
@AkihiroSuda AkihiroSuda added this to the v2.1.2 milestone Apr 14, 2026
Copy link
Copy Markdown
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, but with this commit I can no longer start an existing instance (Fedora 43)

$ limactl --debug start gpu
[...]
INFO[0000] [hostagent] hostagent socket created at /Users/suda/.lima/gpu/ha.sock 
DEBU[0000] [hostagent] Start udp DNS listening on: 127.0.0.1:62489 
DEBU[0000] [hostagent] Start tcp DNS listening on: 127.0.0.1:57693 
DEBU[0001] received an event                             event="{2026-04-23 03:22:57.454603 +0900 JST {false false false [] 57692 <nil> <nil> <nil>}}"
INFO[0001] SSH Local Port: 57692                        
INFO[0001] [hostagent] Driver stopped due to error: "exit status 2" 
INFO[0001] [hostagent] Shutting down the host agent     
INFO[0001] [hostagent] Waiting for the essential requirement 1 of 3: "ssh" 
DEBU[0001] received an event                             event="{2026-04-23 03:22:57.469493 +0900 JST {false false true [] 0 <nil> <nil> <nil>}}"
DEBU[0001] External driver krunkit stopped successfully 
FATA[0001] exiting, status={Running:false Degraded:false Exiting:true Errors:[] SSHLocalPort:0 CloudInitProgress:<nil> PortForward:<nil> Vsock:<nil>} (hint: see "/Users/suda/.lima/gpu/ha.stderr.log") 

ha.stderr.log:

[...]
{"level":"info","msg":"hostagent socket created at /Users/suda/.lima/gpu/ha.sock","time":"2026-04-23T03:22:56+09:00"}
{"level":"debug","msg":"Start udp DNS listening on: 127.0.0.1:62489","time":"2026-04-23T03:22:56+09:00"}
{"level":"debug","msg":"Start tcp DNS listening on: 127.0.0.1:57693","time":"2026-04-23T03:22:56+09:00"}
{"level":"info","msg":"Driver stopped due to error: \"exit status 2\"","time":"2026-04-23T03:22:57+09:00"}
{"level":"info","msg":"Shutting down the host agent","time":"2026-04-23T03:22:57+09:00"}
{"level":"info","msg":"Waiting for the essential requirement 1 of 3: \"ssh\"","time":"2026-04-23T03:22:57+09:00"}
{"level":"debug","msg":"executing script \"ssh\"","time":"2026-04-23T03:22:57+09:00"}
{"level":"debug","msg":"External driver krunkit stopped successfully","time":"2026-04-23T03:22:57+09:00"}

driver.stderr.log:

[...]
time="2026-04-23T03:22:56+09:00" level=info msg="Starting krun VM (hint: to watch the progress, see \"/Users/suda/.lima/gpu/krunkit.log\")"
time="2026-04-23T03:22:56+09:00" level=info msg="krunkitCmd.Args: [krunkit --memory 4096 --cpus 4 --device virtio-serial,logFilePath=/Users/suda/.lima/gpu/serial.log --krun-log-level 3 --restful-uri none:// --device virtio-blk,path=/Users/suda/.lima/gpu/disk,format=raw --device virtio-blk,path=/Users/suda/.lima/gpu/cidata.iso --device virtio-vsock,port=2222,socketURL=/Users/suda/.lima/gpu/ga.sock,connect --device virtio-net,type=unixgram,fd=14,mac=52:55:55:83:5b:be]"
time="2026-04-23T03:22:56+09:00" level=info msg="ssh.overVsock is false, using usernet forwarder for SSH"
time="2026-04-23T03:22:57+09:00" level=error msg="Error during Start" error="exit status 2"
time="2026-04-23T03:22:57+09:00" level=debug msg="Start error channel closed"
time="2026-04-23T03:22:57+09:00" level=debug msg="Received AdditionalSetupForSSH request"
time="2026-04-23T03:22:57+09:00" level=debug msg="AdditionalSetupForSSH succeeded"
time="2026-04-23T03:22:57+09:00" level=debug msg="Received GetInfo request"
time="2026-04-23T03:22:57+09:00" level=debug msg="Received GetInfo request"
time="2026-04-23T03:22:57+09:00" level=debug msg="Received Stop request"
time="2026-04-23T03:22:57+09:00" level=warning msg="Failed to send interrupt signal" error="os: process already finished"
time="2026-04-23T03:22:57+09:00" level=debug msg="Stop succeeded"

@unsuman
Copy link
Copy Markdown
Member Author

unsuman commented Apr 22, 2026

I can no longer start an existing instance (Fedora 43)

Oh I forgot to add a check for krunkitVersion >= 1.2.1, can you check again after upgrading Krunkit?

@AkihiroSuda
Copy link
Copy Markdown
Member

1.2.1

Did you install it from the source?
It doesn't seem available in slp/krunkit tap yet?
https://github.com/slp/homebrew-krunkit/blob/main/Formula/krunkit.rb

@AkihiroSuda
Copy link
Copy Markdown
Member

AkihiroSuda commented Apr 22, 2026

Or if we are now supported to use https://github.com/slp/homebrew-krun/blob/master/Formula/krunkit.rb (slp/krun, not slp/krunkit), the document has to be updated

https://github.com/search?q=repo%3Alima-vm%2Flima+slp%2Fkrunkit&type=code

@unsuman
Copy link
Copy Markdown
Member Author

unsuman commented Apr 22, 2026

Yup, I think slp/krunkit is now deprecated, can you uninstall and try with new slp/krun tap? I remember installing by this:

brew tap slp/krun
brew install krunkit

@AkihiroSuda
Copy link
Copy Markdown
Member

Yes, it works for me with krunkit v1.2.1.

Please update the docs and https://github.com/search?q=repo%3Alima-vm%2Flima+slp%2Fkrunkit&type=code , then LGTM

@unsuman unsuman force-pushed the krunkit/add-guest-agent-conn branch 2 times, most recently from 5edd4c0 to f1fcced Compare April 22, 2026 20:56
…tion with vsock

Signed-off-by: Ansuman Sahoo <anshumansahoo500@gmail.com>
@unsuman unsuman force-pushed the krunkit/add-guest-agent-conn branch from f1fcced to a990219 Compare April 22, 2026 21:04
Copy link
Copy Markdown
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda AkihiroSuda merged commit 9d9ee35 into lima-vm:master Apr 24, 2026
34 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/vmdrivers VM driver infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants