feat: vsock support for remote console access #197
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Having a remote console access can be helpful for different reasons, e.g. an easy way to have multiple terminals, not using a serial which can be slow to print a lot of text, etc.
With this new support, a user can simply use vng like before, and add the new
--vsock
option:Then in another terminal, it can connect to the existing VM:
Advanced users can set a different CID with
--vsock-cid
, useful when multiple VMs are started in parallel.It is also possible to change the command that is executed when connected inside the VM. By default,
bash -i
is used, but it is possible to pass something else, e.g.Or zsh, fish, tmux, etc. Or a script, for example to set env vars, change dir and set other dimensions, etc., e.g. starting the VM with:
... and connecting to it from another terminal with:
Note: on my side, 'bash' is a bit weird: I cannot see the command I'm typing. I didn't try to find a solution for a too long time as I'm usually not using bash.
Regarding the kernel config, two new config are now required:
VSOCKETS
andVIRTIO_VSOCKETS
. They seem light enough.While at it, fixed a typo in the README file with the --network option.
Depends-on: #195
Link: #151