aws-greengrass-nucleus
aws-greengrass-nucleus copied to clipboard
getChildPids does not work on Busybox based Linuxes
The function getChildPids uses the ps command and flags not supported by Busybox
Process proc = Runtime.getRuntime().exec(new String[]{"ps", "-ax", "-o", "pid,ppid"});
https://github.com/aws-greengrass/aws-greengrass-nucleus/blob/87d89a61342f20e2e84f505af38bd89f68514c2f/src/main/java/com/aws/greengrass/util/platforms/unix/UnixPlatform.java#L489
Busyboxy supports -o and -T and that is it,
cf. https://busybox.net/downloads/BusyBox.html cf. https://git.busybox.net/busybox/tree/procps/ps.posix
One way to get the list of all the child processes for a given process that works on on Linux systems is to readdir on /proc/{pid}/task/ to get he list of child processes. You can check the parent process for each by reading the 4th field of the stat file /proc/{pid}/task/{tid}/stat.
The process group id is also available in the 5th field. (In the case of my running core there are 37 child processes in this group for example).
Hello, Thank you for reporting this issue to us. I have verified the issue and we will work to resolve it.
- Is busybox the only option in your use case?
- Greengrass requires the
sudo
command to exist, which busybox does not provide. I just want to check that your system does havesudo
because even if we make busybox work, we'd still require sudo.
We could provide sudo as a simple shell script: exec $* Then make that script SUID: https://unix.stackexchange.com/questions/279223/how-do-i-set-up-busybox-to-allow-a-non-root-user-to-set-the-date https://unix.stackexchange.com/questions/279223/how-do-i-set-up-busybox-to-allow-a-non-root-user-to-set-the-date But it would be special work for busy box.
On Apr 7, 2021, at 11:19 AM, Michael Dombrowski @.***> wrote:
Hello, Thank you for reporting this issue to us. I have verified the issue and we will work to resolve it.
Is busybox the only option in your use case? Greengrass requires the sudo command to exist, which busybox does not provide. I just want to check that your system does have sudo because even if we make busybox work, we'd still require sudo. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/aws-greengrass/aws-greengrass-nucleus/issues/910#issuecomment-815124249, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJO6RJ2QATWIOYNSAJ3SUDTHSO2LANCNFSM42QK4IDA.
Hello, Thank you for reporting this issue to us. I have verified the issue and we will work to resolve it.
* Is busybox the only option in your use case?
Yes, busybox is the only option as it is how our vendor's embedded Linux vendor implements all of the core Linux commands.
* Greengrass requires the `sudo` command to exist, which busybox does not provide. I just want to check that your system does have `sudo` because even if we make busybox work, we'd still require sudo.
The system does not have sudo, and our vendor is not supporting it at this time.