without SystemLock being held works fine:
root@xx:~# strace -o $PWD/log -e openat,open,close,fcntl python3 $PWD/foo.py (Reading database ... 25835 files and directories currently installed.) Removing aptitude-common (0.7.4-2ubuntu2) ... COMMAND PID TYPE SIZE MODE M START END PATH iscsid 432 POSIX 4B WRITE 0 0 0 /run/iscsid.pid atd 421 POSIX 4B WRITE 0 0 0 /run/atd.pid cron 418 FLOCK 4B WRITE 0 0 0 /run/crond.pid python3 1207 POSIX 0B WRITE 0 0 0 /var/lib/dpkg/lock-frontend python3 1207 POSIX 0B WRITE 0 0 0 /var/cache/apt/archives/lock dpkg 1215 POSIX 0B WRITE 0 0 0 /var/lib/dpkg/lock Processing triggers for man-db (2.7.5-1) ...
with SystemLock held works fine: # strace -o $PWD/log.locked -e openat,open,close,fcntl python3 $PWD/foo.py (Reading database ... 25835 files and directories currently installed.) Removing aptitude-common (0.7.4-2ubuntu2) ... COMMAND PID TYPE SIZE MODE M START END PATH iscsid 432 POSIX 4B WRITE 0 0 0 /run/iscsid.pid atd 421 POSIX 4B WRITE 0 0 0 /run/atd.pid cron 418 FLOCK 4B WRITE 0 0 0 /run/crond.pid dpkg 2285 POSIX 0B WRITE 0 0 0 /var/lib/dpkg/lock python3 2277 POSIX 0B WRITE 0 0 0 /var/lib/dpkg/lock-frontend python3 2277 POSIX 0B WRITE 0 0 0 /var/cache/apt/archives/lock Processing triggers for man-db (2.7.5-1) ...
In the strace log, we can see that the frontend lock is closed after the dpkg runs (after we have relocked the lock).
without SystemLock being held works fine:
root@xx:~# strace -o $PWD/log -e openat, open,close, fcntl python3 $PWD/foo.py dpkg/lock- frontend apt/archives/ lock
(Reading database ... 25835 files and directories currently installed.)
Removing aptitude-common (0.7.4-2ubuntu2) ...
COMMAND PID TYPE SIZE MODE M START END PATH
iscsid 432 POSIX 4B WRITE 0 0 0 /run/iscsid.pid
atd 421 POSIX 4B WRITE 0 0 0 /run/atd.pid
cron 418 FLOCK 4B WRITE 0 0 0 /run/crond.pid
python3 1207 POSIX 0B WRITE 0 0 0 /var/lib/
python3 1207 POSIX 0B WRITE 0 0 0 /var/cache/
dpkg 1215 POSIX 0B WRITE 0 0 0 /var/lib/dpkg/lock
Processing triggers for man-db (2.7.5-1) ...
with SystemLock held works fine: open,close, fcntl python3 $PWD/foo.py dpkg/lock- frontend apt/archives/ lock
# strace -o $PWD/log.locked -e openat,
(Reading database ... 25835 files and directories currently installed.)
Removing aptitude-common (0.7.4-2ubuntu2) ...
COMMAND PID TYPE SIZE MODE M START END PATH
iscsid 432 POSIX 4B WRITE 0 0 0 /run/iscsid.pid
atd 421 POSIX 4B WRITE 0 0 0 /run/atd.pid
cron 418 FLOCK 4B WRITE 0 0 0 /run/crond.pid
dpkg 2285 POSIX 0B WRITE 0 0 0 /var/lib/dpkg/lock
python3 2277 POSIX 0B WRITE 0 0 0 /var/lib/
python3 2277 POSIX 0B WRITE 0 0 0 /var/cache/
Processing triggers for man-db (2.7.5-1) ...
In the strace log, we can see that the frontend lock is closed after the dpkg runs (after we have relocked the lock).