Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support restarting LXD-based containers #26

Closed
JohnstonJ opened this issue May 22, 2016 · 4 comments
Closed

Support restarting LXD-based containers #26

JohnstonJ opened this issue May 22, 2016 · 4 comments
Assignees
Milestone

Comments

@JohnstonJ
Copy link

As per:

https://github.com/liske/needrestart/blob/f9cd0d3169be4eda7cf84357072ff935c81e9b5d/README.Cont.md

it is stated that there is container support for restarting containers. Notably absent is LXD: https://linuxcontainers.org/lxd/

If an LXD container is in use, the command for restarting it would be:

lxc restart <container>
@liske
Copy link
Owner

liske commented May 23, 2016

LXD does not implement containers itself but uses LXC in the background. So there is no need to support LXD explicitly, isn't it? Do you have a LXD environment available and did you give the most recent needrestart a try?

@JohnstonJ
Copy link
Author

Sort of. LXD uses liblxc but none of the old LXC command-line tools. So for example, lxc-stop is not even on my system. So according to the needrestart readme, it can't work since that tool isn't installed.

Even if it was installed, I am not sure if this is advisable or supportable or if it even works. I think the LXD daemon assumes it has full control over the state of the containers under its control. See for example the container state management here https://github.com/lxc/lxd/blob/8d58e07c63808b0f13bdf8777fcfe7edcdb352f0/lxd/container_state.go which uses LXD-specific configuration variables, LXD-specific logging, and so forth. lxc-stop would bypass all that and so that sounds fragile to me.

That said, I couldn't find any documentation/guidance on whether this is actually not supported or not. (They do recommend not mixing LXC and LXD in other ways, e.g. lxc/incus@33bc6b9 ).

@liske liske self-assigned this May 24, 2016
@liske
Copy link
Owner

liske commented May 24, 2016

Did you try to run needrestart while running a container (under control of LXD) using a outdated library? Did needrestart already detect the container? If so, it might become hard to differ between pure LXC and LXD containers...

Could you please provide the content /proc/<pid>/cgroup of a process within a LXC container?

@lenucksi
Copy link

lenucksi commented Oct 9, 2016

Here are the contents of a process within a LXD container that needrestart wants to restart.

container is the name of the container the process runs in.

cat /proc/6992/cgroup
11:blkio:/lxc/container/system.slice/avahi-daemon.service
10:memory:/lxc/container/system.slice/avahi-daemon.service
9:pids:/lxc/container/system.slice/avahi-daemon.service
8:hugetlb:/lxc/container
7:perf_event:/lxc/container
6:cpuset:/lxc/container
5:net_cls,net_prio:/lxc/container
4:freezer:/lxc/container
3:cpu,cpuacct:/lxc/container/system.slice/avahi-daemon.service
2:devices:/lxc/container/system.slice/avahi-daemon.service
1:name=systemd:/lxc/container/system.slice/avahi-daemon.service

@liske liske added this to the v2.11 milestone Dec 10, 2016
liske added a commit that referenced this issue Dec 10, 2016
@liske liske closed this as completed Dec 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants