Package: atop Version: 2.6.0-2 Severity: normal Dear Maintainer,
Thanks for your supporting and maintaining debian atop package, we have been running atop as a quite useful monitoring tool in bytedance for years. But recenly, when trying to make a new package based on 2.6.0-2, we find two unexpected behaviors in debian/rules file (although these two have been there for long times, we just notice them recently :) ). 1st. Should activate atopacctd before activating the atop daemon. * Backgournd Reading from atop mannual, we know that there are four ways to get access to the terminated process accounting records: - environment variable ATOPACCT - the atopacctd daemon (the preferred way) - the separate psacct package - using the file /var/cache/atop.d/atop.acct * Problem By reading the source code, to use the preferred way: atopacct daemon, we should ensure that atopacctd starts before atop. But the current mechanism is that atop starts earlier than atopacctd. Although atop's daily restarting mechanism (instead, atopacct will not restart daily until being restarted deliberately) makes atop reads from /run/pacct_shadow.d/*.paf again, we still think this should be repaired. * Reproduce Install atop package, get atop and atopacct's pid, check their fds: # ps aux |grep atop root 473309 4.7 0.0 37056 15792 ? S<Ls 15:50 0:00 /usr/bin/atop -w /var/log/atop/atop_20211111 root 473377 0.0 0.0 12012 128 ? S< 15:50 0:00 /usr/sbin/atopacctd root 473742 0.0 0.0 18084 1024 pts/0 S+ 15:50 0:00 grep atop # ls -l /proc/473309/fd total 0 lr-x------ 1 root root 64 Nov 11 15:50 0 -> /dev/null l-wx------ 1 root root 64 Nov 11 15:50 1 -> /var/log/atop/daily.log l-wx------ 1 root root 64 Nov 11 15:50 2 -> /var/log/atop/daily.log lr-x------ 1 root root 64 Nov 11 15:50 3 -> /var/cache/atop.d/atop.acct lrwx------ 1 root root 64 Nov 11 15:50 4 -> socket:[503893125] l-wx------ 1 root root 64 Nov 11 15:50 5 -> /var/log/atop/atop_20211111 lrwx------ 1 root root 64 Nov 11 15:50 6 -> socket:[503893413] # ls -l /proc/473377/fd total 0 lr-x------ 1 root root 64 Nov 11 15:50 0 -> /run/pacct_source l-wx------ 1 root root 64 Nov 11 15:50 1 -> /run/pacct_shadow.d/0000000000.paf lrwx------ 1 root root 64 Nov 11 15:50 2 -> socket:[503865811] l-wx------ 1 root root 64 Nov 11 15:50 3 -> /run/pacct_shadow.d/current lrwx------ 1 root root 64 Nov 11 15:50 4 -> socket:[503860044] lrwx------ 1 root root 64 Nov 11 15:50 5 -> socket:[503860045] * Fix See the patch in the end :) 2nd. Load atop.default file into the package to make it take effect * Background We find that atop.default is not loaded into atop package, but this file is sometimes used to read environment file in systemd service. * Fix See the patch in the end :) We have tried to fix these two issues via a patch as follows: **********************The beginning of patch********************* >From 5f962975fa340e75a9a75e94deb8fd8a618ee918 Mon Sep 17 00:00:00 2001 From: Fei Li <lifei.shir...@bytedance.com> Date: Wed, 10 Nov 2021 20:45:45 +0800 Subject: [PATCH] Fix debian/rules Two fixes for debian/rules: - Activate atopacctd before activating the atop daemon, so that atop can read exited process data from /run/pacct_shadow.d/*.paf instead of /var/cache/atop.d/atop.acct once installed. - Load atop.default file into the package to make it take effect. Signed-off-by: Fei Li <lifei.shir...@bytedance.com> Co-authored-by: Teng Hu <huteng...@bytedance.com> --- debian/rules | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/rules b/debian/rules index 7990f9d..8f3e091 100755 --- a/debian/rules +++ b/debian/rules @@ -5,18 +5,19 @@ override_dh_auto_clean: dh_auto_clean - rm -f debian/atop.service debian/atopacct.service debian/atop.init debian/atopacct.init + rm -f debian/atop.service debian/atop.default debian/atopacct.service debian/atop.init debian/atopacct.init rm -f atop atopsar override_dh_installinit: - dh_installinit --name=atop dh_installinit --name=atopacct + dh_installinit --name=atop override_dh_auto_install: dh_auto_install make sysvinstall DESTDIR=$(shell pwd)/debian/atop make systemdinstall DESTDIR=$(shell pwd)/debian/atop cp atop.service debian/atop.service + cp atop.default debian/atop.default cp atopacct.service debian/atopacct.service cp atop.init debian/atop.init cp atopacct.init debian/atopacct.init -- 2.20.1 **********************The end of patch********************** -- System Information: Debian Release: 10.5 Architecture: amd64 (x86_64) Kernel: Linux 5.4 Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages atop depends on: ii libc6 2.28-10 ii libglib2.0-0 2.58.3-2+deb10u2 ii libncurses6 6.1+20181013-2+deb10u2 ii libtinfo6 6.1+20181013-2+deb10u2 ii lsb-base 10.2019051400 ii zlib1g 1:1.2.11.dfsg-1 Versions of packages atop recommends: ii cron [cron-daemon] 3.0pl1-134+deb10u1 atop suggests no packages. -- no debconf information