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

Not detecting systemd-nspawn container #326

Open
rascalDan opened this issue Dec 5, 2024 · 1 comment
Open

Not detecting systemd-nspawn container #326

rascalDan opened this issue Dec 5, 2024 · 1 comment

Comments

@rascalDan
Copy link

rascalDan commented Dec 5, 2024

I'm new to needrestart, so accept I might be doing something wrong, for the most part it works great :-) But I have a problem where its not picking up a systemd-nspawn based container and thus I believe it thinks the service (not container) always needs restarting.

Here I'm running OpenWRT in a container, started by PaceMaker as a systemd service.

firebrand ~ # needrestart --version
needrestart 3.8 - Restart daemons after library updates.

firebrand ~ # systemctl --version 
systemd 256 (256.8)
+PAM -AUDIT -SELINUX -APPARMOR +IMA +SMACK +SECCOMP +GCRYPT -GNUTLS +OPENSSL +ACL +BLKID +CURL -ELFUTILS -FIDO2 +IDN2 -IDN -IPTC +KMOD -LIBCRYPTSETUP -LIBCRYPTSETUP_PLUGINS +LIBFDISK +PCRE2 -PWQUALITY -P11KIT -QRENCODE -TPM2 -BZIP2 +LZ4 +XZ -ZLIB +ZSTD -BPF_FRAMEWORK -XKBCOMMON +UTMP -SYSVINIT +LIBARCHIVE

firebrand ~ # machinectl 
MACHINE CLASS     SERVICE        OS      VERSION ADDRESSES 
openwrt container systemd-nspawn openwrt 19.07.7 10.10.0.1…

firebrand ~ # systemctl status systemd-nspawn@openwrt.service 
● systemd-nspawn@openwrt.service - Cluster Controlled systemd-nspawn@openwrt
     Loaded: loaded (/usr/lib/systemd/system/systemd-nspawn@.service; disabled; preset: disabled)
    Drop-In: /run/systemd/system/systemd-nspawn@openwrt.service.d
             └─50-pacemaker.conf
             /etc/systemd/system/systemd-nspawn@openwrt.service.d
             └─main.conf
     Active: active (running) since Tue 2024-12-03 12:25:25 GMT; 1 day 23h ago
 Invocation: b1b099469c274101ae28ac6d73811f5a
       Docs: man:systemd-nspawn(1)
   Main PID: 107789 (systemd-nspawn)
     Status: "Container running."
      Tasks: 12 (limit: 16384)
        CPU: 52.449s
     CGroup: /machine.slice/systemd-nspawn@openwrt.service
             ├─payload
             │ ├─107791 /sbin/procd
             │ ├─108072 /sbin/ubusd
             │ ├─108088 /sbin/urngd
             │ ├─108209 /sbin/logd -S 640
             │ ├─108248 /sbin/rpcd -s /var/run/ubus.sock -t 30
             │ ├─108357 /sbin/netifd
             │ ├─108382 /usr/sbin/crond -f -c /etc/crontabs -l 5
             │ ├─108482 /usr/sbin/pppd nodetach ipparam plusnet ifname pppoe-plusnet lcp-echo-interva>
             │ ├─108887 /usr/sbin/miniupnpd -f /var/etc/miniupnpd.conf
             │ ├─108924 /usr/sbin/dropbear -F -P /var/run/dropbear.1.pid -s -g -p 10.10.0.1:22 -p 192>
             │ └─109119 /usr/sbin/uhttpd -f -h /www -r OpenWrt -x /cgi-bin -t 60 -T 30 -k 20 -A 1 -n >
             └─supervisor
               └─107789 systemd-nspawn --quiet --keep-unit --boot --link-journal=try-guest --network->

Running in list mode:

firebrand ~ # needrestart -ra -lk -v
[main] eval /etc/needrestart/needrestart.conf
[main] eval /etc/needrestart/conf.d/pacemaker.conf
[main] needrestart v3.8
[main] running in root mode
[Core] Using UI 'NeedRestart::UI::stdio'...
[main] systemd detected
[main] #107791 uses obsolete binary /sbin/procd
# many of these
...
[main] #107789 unexpected cgroup '/machine.slice/systemd-nspawn@openwrt.service/supervisor'
...
[main] #107791 unexpected cgroup '/machine.slice/systemd-nspawn@openwrt.service/payload'
[main] trying systemctl status
[main] #108357 is systemd-nspawn@openwrt.service
...
Restarting services...
[main] using restart.d file systemd-nspawn@openwrt.service
 /etc/needrestart/restart.d/systemd-nspawn@openwrt.service

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.

I presume that if it detects a container, it understands that the binary paths a relative to the container root and thus all is well, but I've not seen it do that, so I'm guessing there.

I created a script to handle restarting OpenWRT in a custom way (its currently empty) but the problem remains that it always wants to do it, not that its doing in some problematic way.

Thanks.

@rascalDan
Copy link
Author

rascalDan commented Dec 5, 2024

I just noticed there's a PR for this... even if I didn't see an existing issue.

I think just fffe4a0 is all that's needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant