liske / needrestart

Restart daemons after library updates.
GNU General Public License v2.0
444 stars 71 forks source link

Question: ways to ignore disposable LXC containers? #260

Open elboulangero opened 1 year ago

elboulangero commented 1 year ago

Hello,

we have a machine, it is a autopkgtest worker. Meaning that this machine is constantly testing packages in throwaway LXC containers. There's always around 10 LXC containers up.

These are disposable containers: they are created, then within the container we run apt to update and install the packages required, then we run the tests, then we dispose of the container.

Our issue is that we run needrestart on the host once a day, and everytime needrestart runs, it picks some items within the LXC containers, and notify us that we should restart those containers. Of course, for our case it doesn't make sense, since those containers will be destroyed in a few minutes.

Question: how can I make needrestart ignore those LXC containers? I'm playing with the needrestart.conf file right now, but so far I didn't find the solution.

Thanks in advance!

elboulangero commented 1 year ago

I found a Debian ticket with a similar need, but different approach: https://bugs.debian.org/889552

In this ticket, Paul suggests to ignore processes that are too young. That would also work for my use-case, I suppose. The advantage of this approach it that it's not limited to LXC containers, it would also work for chroots.

liske commented 1 year ago

Would an option to disable container scanning or ignore containers by name patterns would help?

elboulangero commented 1 year ago

Hello! Yes, ignoring containers by name patterns would help. Our disposable lxc containers are named ci-017-222a371c for example, so I would be happy if I could ignore containers named ^ci-.*.