Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Allow for signal forwarding during exec #1830
Comments
|
It's not that lxc exec doesn't handle sigterm properly it's that it doesn't forward signals at all :) We just don't support it right now and I'm not sure to what extent we can even support this given the existing go-lxc API (do we know the process PID to which we should forward the signal?) |
|
This isn't really related to it being a GUI application, it's just any application which doesn't exit when its stdin is closed. Probably the right thing to do here is receive SIGTERM in the client and cancel. |
stgraber
changed the title from
lxc exec does not handle SIGTERM correctly for GUI apps
to
Allow for signal forwarding during exec
Mar 30, 2016
stgraber
added
the
Feature
label
Mar 30, 2016
stgraber
added this to the later milestone
Mar 30, 2016
|
Easier steps to reproduce:
|
stgraber
modified the milestones:
later,
soon
Apr 25, 2016
|
Just realized that this is blocked on us having a better go-lxc API, as right now we don't get the PID of the running task and so can't send signals to it. |
stgraber
modified the milestones:
later,
soon
Apr 27, 2016
|
@stgraber is there an alternate non-LXD command we can use to execute commands within a container? |
|
@jpillora you can just run sshd and ssh into your container |
|
For security purposes, our containers have no host network access. I'm approaching a solution I think though, I'm running an agent, also written in Go, alongside LXD and so I'm directly using |
bzeller
commented
May 17, 2016
|
I wrote a small wrapper tool that helps me to execute applications inside the containers and send signals to them. You can check it out here : |
|
Thanks @bzeller. Since it seems the heart of the issue is that Edit: Got POC for my idea and it seems to work. Since there's no way to get SSH to listen on a unix socket, I'll use something like this to forward onto the container's port 22. This way SSH will do all the heavy lifting :) root@container123:~# ./sockfwd
2016/04/22 19:05:20 listening on /tmp/fwd.sock
2016/04/22 19:05:31 connected to 127.0.0.1:22root@host:~# socat - UNIX-CONNECT:/var/lib/lxd/containers/container123/rootfs/tmp/fwd.sock
SSH-2.0-OpenSSH_6.9p1 Ubuntu-2ubuntu0.1Next step is to dial in with https://godoc.org/golang.org/x/crypto/ssh and I'll have my programmatic control from there Edit: This is now working well :) I released my small socket forwarding program here https://github.com/jpillora/sockfwd and it is running in the containers I need SSH access to |
stgraber
modified the milestones:
later,
soon
Oct 4, 2016
stgraber
assigned
brauner
Oct 6, 2016
stgraber
modified the milestones:
soon,
lxd-2.5
Oct 11, 2016
|
Once lxc/go-lxc#68 is merged I can send a branch that adds a function |
|
Fwiw, the branch (without the signal forwarding) is here: https://github.com/brauner/lxd/commits/2016-10-12/exec_signal_forwarding. It needs to be build against a version of |
bzeller
commented
Oct 12, 2016
|
That sounds good to me |
bzeller commentedMar 30, 2016
Required information
Issue description
When running GUI applications inside a LXD container, sending SIGTERM
to the "lxc exec" PID will result in the lxc process going away but the process
inside the container will continue to run.
Steps to reproduce