mirror of
https://github.com/nestriness/nestri.git
synced 2026-11-03 22:22:39 +02:00
feat: attach a shell to a running box
The host can now ask a box for a shell on a pseudo-terminal, the way a container runtime attaches to a container. `HostToGuest::Attach` starts the process, and the guest then dials the host on a vsock port of its own (7001) and carries the terminal's bytes over a small framed stream: data both ways, a resize, a hangup, and the exit status last. A screenful of output on the JSON-lines control channel would hold every other message in the box behind it, which is why it is not there. A failure to start is the exception, and is said on the control channel because nothing has connected to the data port yet. A shell is not a launch: it never ends the box, and the box ending ends it. It is started through the same reaper as everything else, so it cannot become the zombie that exists to be prevented. With a terminal on the other end the PTY is ordinary; without one it is put in raw mode so a command run for its output gets its bytes back unrewritten. Closing the stream hangs the shell up, process group and all. The frame codec is a pure bytes-in, frames-out module in nesprotocol with a payload cap and no skipping of unknown tags, since a length read from a guest is read across a trust boundary. No version bump: adding a message does not need one, and a guest that predates it simply never dials. The runtime stage gains strace, lsof and less, so a root shell in a box is not one that cannot trace a process. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
e5447a91e4
commit
d0ec87a139
@@ -322,10 +322,16 @@ RUN pacman -Syu --noconfirm --needed \
|
||||
pipewire pipewire-audio wireplumber opus \
|
||||
python libunwind sdl2-compat \
|
||||
python-xlib python-urllib3 python-pyzstd \
|
||||
strace lsof less \
|
||||
&& rm -f /usr/share/libalpm/hooks/dbus-reload.hook \
|
||||
&& pacman -Rdd --noconfirm systemd systemd-sysvcompat openssh \
|
||||
&& pacman -Scc --noconfirm
|
||||
|
||||
# `strace`, `lsof` and `less` are for the operator's shell (`neslet box exec`):
|
||||
# a root shell in a box that cannot trace a process, list what it has open or
|
||||
# page through a log is the situation that feature exists to get out of. They
|
||||
# are a few hundred kilobytes between them.
|
||||
#
|
||||
# `libunwind` is Wine's, not ours. `ntdll.so` links it, so without it every
|
||||
# process Wine starts dies at `could not load ntdll.so`, which is the first
|
||||
# thing it loads and reads like Wine itself being broken. Found 2026-09-12,
|
||||
|
||||
Reference in New Issue
Block a user