Issue
I have a python service which issues the foll. command via a subprocess call:
RUNLEVEL=1 apt-get install <package>
This package, as part of it's installation, issues a systemctl status smb command which is getting stuck forever. The reason for giving RUNLEVEL=1 is to prevent nginx (a dependency of the package) from starting up on port 80 as soon as it is installed.
Any ideas on what could possibly be wrong? Please ask for more info.
Edit: The systemctl process is stuck waiting for pager to return. And the pager process is stuck indefinitely waiting on a read.
root@64_29:~# ps -ef | grep smb
root 9528 9462 0 16:32 pts/2 00:00:00 /bin/systemctl status smb.service
root@64_29:~# strace -p 9528
Process 9528 attached
waitid(P_PID, 9529,
root@64_29:~# ps -ef | grep 9529
root 9529 9528 0 16:32 pts/2 00:00:00 pager
root@64_29:~# strace -p 9529
Process 9529 attached
read(2,
Also to prevent using RUNLEVEL=1, I mask nginx before installing the custom package, so no longer providing RUNLEVEL=1.
Solution
Ok, so I finally found the solution to this problem. It had nothing to do with the RUNLEVEL. Basically whenever a process spawned apt-get install command, and the package, during it's install issued a systemctl command, the pager (which was symlinked to more) would get stuck. To prevent systemctl from spawning pager, before spawning apt-get export SYSTEMD_PAGER= (basically set it to empty string)
Answered By - Harsh Savla