How to find out why systemd reloads unit?

Solution 1:

I've run into this after upgrading a Ubuntu system from 18.04 to 20.04

I noticed in the full systemd journal, smbd got reloaded after every dhcp lease renewal (in my case, approximately once an hour)

Aug 20 08:38:54 fileserver dhclient[282]: DHCPREQUEST for 10.12.24.115 on eth0 to 10.12.24.1 port 67 (xid=0x5d719a99)
Aug 20 08:38:54 fileserver dhclient[282]: DHCPACK of 10.12.24.115 from 10.12.24.1 (xid=0x999a715d)
Aug 20 08:38:54 fileserver systemd[1]: Reloading Samba SMB Daemon.
Aug 20 08:38:54 fileserver systemd[1]: Reloaded Samba SMB Daemon.

Some extra googling lead me to https://superuser.com/questions/1289485/samba-reload-on-new-dhcp-lease & /etc/dhcp/dhclient-enter-hooks.d/samba, which reloads the service.

I've checked my backups and this file existed previously for 18.04.

Therefore, the "issue" probably lies with systemd-networkd, which is the network daemon in 20.04.

My own investigation continues, but I hope that helps...