Your message dated Tue, 28 Dec 2021 16:54:27 +0100
with message-id <[email protected]>
and subject line Re: Bug#999448: [External] Re: Bug#999448: atop: Two fixes for 
debian/rules: activate atopacctd before activating atop, load atop.default into 
pkg
has caused the Debian Bug report #999448,
regarding atop: Two fixes for debian/rules: activate atopacctd before 
activating atop, load atop.default into pkg
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
999448: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=999448
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
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 <[email protected]>
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 <[email protected]>
Co-authored-by: Teng Hu <[email protected]>
---
 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

--- End Message ---
--- Begin Message ---
Version: 2.5.0-1

(the behavior is different and correct with dh 13, and atop 2.5.0-1 is
the first version that was uploaded with dh 13)

On Tue, Dec 28, 2021 at 10:53:39PM +0800, 李菲 wrote:
> We made another several attempts, and finally find the diff:
> ByteDance's debian/compat is 10, which is too low to behave
> normally. E.g. can not use the "deb-systemd-invoke" feature,
> thus the line:  "deb-systemd-invoke $_dh_action 'atop-rotate.service'
> 'atop-rotate.timer' 'atop.service' 'atopacct.service' >/dev/null || true".
> does not occur.
> 
> After changing debian/compat to 13 (others files
> under debian/ remain the same with
> https://salsa.debian.org/debian/atop/-/tree/debian/2.6.0-1),
> everything works well!

Ah! Of course. Different debhelper versions might generate different
flavours of maintainer script snippets. That's a totally plausible
explanatoin, thanks for finding it and documenting it

> We can close this issue. :)

Doing so with this message. Pleasure working with you.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany    |  lose things."    Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature |  How to make an American Quilt | Fax: *49 6224 1600421

--- End Message ---

Reply via email to