On Wed, Oct 26, 2022 at 12:14 PM Michael Biebl <bi...@debian.org> wrote: > > Am 26.10.22 um 11:49 schrieb Jędrzej Dudkiewicz: > > I'm sorry if it was answered earlier, but I *really* couldn't find > > anything about it. > > > > I have few packages that are installed as part of a larger system on > > Debian running on BeagleBone. These packages frequently (for some > > strange reason - I'm not the only developer) modify files that go to > > the /etc/rsyslog.d/ directory. These files are not part of [...] > > sometimes all of them. Because of this each package contains the > > following: > > > > systemctl restart rsyslog > > > > in its postinstall script. As this causes rsyslog to be restarted a > > few times in a row it sometimes results in rsyslog not functioning. > > This shouldn't be a problem in theory. > That said, rsyslog could be part of the upgrade process, so maybe is in > an inconsistent state when you trigger the restart. > Would be interested to know more about the specific failures you > encountered.
I'm sorry but unfortunately I can't provide more info: I am not responsible for installing these packages, this is done by other people, in addition it is for most part automatic and happens very rarely - we care about it only because we update these machines (BeagleBones) in bulk few dozens at a time and in case of failure machine immediate "administrative action" is taken (manual rsyslog restart). But there are two symptoms - either rsyslog does not start or it starts but there are no entries from running services. > > Thus, my question: > > > > Is there a way to restart rsyslog only once, after all packages are > > installed? I hope for something similar to "dh $@ --with-systemd" in > > "rules" file (but "dh -l" does not show anything that looks like it > > should work). My guess is that it should possible to somehow combine > > "dh $@ --with-systemd" to achieve what I want, but I don't even know > > where should I start. > > The rsyslog package already offers a dpkg trigger which does > `invoke-rc.d rsyslog try-restart || true` > > This trigger is activated by packages installing files into /etc/rsyslog.d > > But you can activate that trigger explicitly as well via > dpkg-trigger --now-await rsyslog > > > So, if your package ships a file in /etc/rsyslog.d/ everything should > work ootb. If you create the file dynamically via maintscripts, you need > to add an explicit dpkg trigger in your maintscripts. As you wrote there is currently no such dpkg-trigger so there is no way for us to do it - even if you added it we are still on Debian 9 without a real way to upgrade all systems. What we currently settled for is: * install files to /etc/rsyslog.d/ from *.deb * modify installed files as required * update using `apt-get` with ` -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" ` This way rsyslog is restarted once as far as I can tell and it seems to work - of course this will overwrite all local changes, but this isn't a real problem as there is a strict policy in place preventing administrators from modifying configuration files, so this should _somehow_ work. I hope so at least. Thanks a lot. Regards, -- Jędrzej Dudkiewicz I really hate this damn machine, I wish that they would sell it. It never does just what I want, but only what I tell it.