liske / needrestart

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

Support for systemd-nspawn containers #37

Closed Yakulu closed 8 years ago

Yakulu commented 8 years ago

It should be a good thing if needrestart can support systemd-nspawn containers. I use nspawn for thin / app containing and needrestart does not handle the fact that launched binary is under a specific tree and not under the root tree. So it always asks to restart services. For example :

[Core] Using UI 'NeedRestart::UI::stdio'...
[main] detected systemd
[Core] #881 is a NeedRestart::Interp::Perl
[Core] #1701 is a NeedRestart::Interp::Python
[Core] #1749 is a NeedRestart::Interp::Python
[Core] #1756 is a NeedRestart::Interp::Python
[Core] #2059 is a NeedRestart::Interp::Python
[Core] #2263 is a NeedRestart::Interp::Python
[main] #21148 uses non-existing /usr/lib/postgresql/9.5/bin/postgres
[main] #21148 is a child of #21147
[main] #21211 uses non-existing /usr/lib/postgresql/9.5/bin/postgres
[main] #21211 is a child of #21148
[main] #21212 uses non-existing /usr/lib/postgresql/9.5/bin/postgres
[main] #21212 is a child of #21148
[main] #21213 uses non-existing /usr/lib/postgresql/9.5/bin/postgres
[main] #21213 is a child of #21148
[main] #21214 uses non-existing /usr/lib/postgresql/9.5/bin/postgres
[main] #21214 is a child of #21148
[main] #21215 uses non-existing /usr/lib/postgresql/9.5/bin/postgres
[main] #21215 is a child of #21148
[main] #21147 exe => /usr/bin/systemd-nspawn
[main] #21147 is odoodev_pg95_nspawn.service
[main] #21148 exe => /usr/lib/postgresql/9.5/bin/postgres
[main] #21148 is odoodev_pg95_nspawn.service

Here postgres binary is located under /var/lib/container/name/usr/lib/postgresql/9.5/bin/postgres.

Thank you for the utility and thank you for reading ;)

liske commented 8 years ago

Hi,

I'm not familiar with systemd's nspawn feature. In general, needrestart should be able to handle process' filesystem namespace correctly. Which version of needrestart do you use? The namespace support was enhanced/fixed in 2.8.

HTH, Thomas

Yakulu commented 8 years ago

I used needrestart from debian jessie repository instead of backported one (so 1.2). I tried with 2.8 from bpo and it seems to handle nspawn gracefully. Sorry for the bad noise and thanks for your work !