[emacs-berlin] tramp contact point

Max(☭) suraev at alumni.ntnu.no
Tue May 7 14:13:03 UTC 2019


Hi.

Pardon the delay, some medical issues kept me busier than I hoped.

I've been playing with systemd-nspawn [1] containers recently - it's a 
really neat implementation which is available on pretty-much any modern 
GNU/Linux distro. What triggerred my curiosity though is machinectl [2] 
- interface tool to manage container interaction. It looks like that's a 
ready-made basis for yet another tramp transport: it allows to copy 
files to and from containers and even run shell commands inside the 
container. Moreover, it can do the same thing transparently over the 
network (see -H parameter).

Here's distilled quickstart:

# Obtain whatever will be run inside the container

machinectl pull-tar 
https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64-root.tar.xz

# Enable corresponding systemd target:

systemctl enable --now machines.target

# Enable and start container

systemctl enable --now 
systemd-nspawn at bionic-server-cloudimg-amd64-root.service

# Open the root shell inside container

machinectl shell bionic-server-cloudimg-amd64-root

Now it's possible to add new user and use it for further interactions:

machinectl shell user at bionic-server-cloudimg-amd64-root

machinectl copy-from user at bionic-server-cloudimg-amd64-root /tmp/test-file

machinectl copy-to user at bionic-server-cloudimg-amd64-root /tmp/test-file


To get the network working inside the container with systemd-networkd on 
the host I've got to create 
/etc/systemd/nspawn/bionic-server-cloudimg-amd64-root.nspawn as follows:

[Network]
VirtualEthernet=no

because default template use virtual ethernet link instead of real network.

That's pretty-much it. Seems like pretty natural addition to existing 
tramp transports.


[1] https://www.freedesktop.org/software/systemd/man/systemd-nspawn.html

[2] https://www.freedesktop.org/software/systemd/man/machinectl.html

cheers,

Max.




More information about the emacs-berlin mailing list