Bug 430726 - Plasma-systemmonitor gives wrong information about the processes running under firejail
Summary: Plasma-systemmonitor gives wrong information about the processes running unde...
Status: CONFIRMED
Alias: None
Product: ksystemstats
Classification: Frameworks and Libraries
Component: General (other bugs)
Version First Reported In: unspecified
Platform: Manjaro Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-23 05:40 UTC by ParsaMousavi
Modified: 2025-05-21 13:08 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ParsaMousavi 2020-12-23 05:40:07 UTC
First of all,thank you for developing this application.It's been a while that I was looking for a nice graphical linux monitoring tool.

I don't know whether it's a priority for you to consider firejail or not,but plasma-systemmonitor gives wrong information about programs running under firejail.It might be because of the pid-namespace in which the firejail programs reside(former KSysGuard have been doing it correctly,maybe because of the daemon "ksysguardd" running as root in the background)

I think one of the main advantages of this new system-monitoring software is that it can add up the mem usage of all processes of an application,the area in which ksysguard was lacking.But it's almost useless for me as I mostly run my programs under firejail.

So it would be a nice feature if it supports firejail and at the same time can show the total memory usage(I have a custom script that makes use of the "smem" tool and reports the total memory usage based on the process' PSS,and I'm sure it's the most accurate one in terms of memory usage analysis.If I manually add up the mem usage of all processes of an app shown by ksysguard,whether under firejail or not,it's almost accurate,but in plasma-systemmonitor neither "memory" nor "Private memory" works as intended for firejailed programs).



STEPS TO REPRODUCE
1. Install firejail
2. Run a program like firefox under firejail by running this: "firejail firefox"
3. Compare the results shown by "plasma-systemmonitor" with this script:
```
sudo smem -t -a | grep -i firefox | awk 'NR!=1  {Total+=$(NF-1)} END {if(Total!="") {print Total/1024" MB"} }'
```


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Manjaro 20.2
KDE Plasma Version: 5.20.2
KDE Frameworks Version: 5.75.0
Qt Version: 5.15.1
Comment 1 Arjen Hiemstra 2021-01-22 11:26:32 UTC
The application grouping in plasma-systemmonitor works based on cgroups. Depending on what firejail does, this may not work correctly together. If it does things as root or a different user, it's going to be very hard to fix as we are limited in what data we can retrieve from non-user processes. That said, I do think it may be worth to have a look and see if we can support it.
Comment 2 David Edmundson 2021-02-09 10:57:46 UTC
I checked this.

Firejail if used with firecfg does spawn everything into the right cgroup correctly.
Firejail also has it's own cgroup'ing code but it looks somewhat broken.


PIDs have their /proc/`pid`/smaps protected, which is why our memory reading fails. Arjen, can we fall back to stat?
Comment 3 Arjen Hiemstra 2021-02-09 11:27:56 UTC
> PIDs have their /proc/`pid`/smaps protected, which is why our memory reading fails. Arjen, can we fall back to stat?

If we do that, we display incorrect information, since the displayed value will no longer be the PSS value, as we can only get that from smaps. This might work for some small stuff that is statically linked but would almost certainly display the wrong values for something like a firejailed firefox.
Comment 4 Arjen Hiemstra 2025-05-21 13:08:58 UTC
For Plasma 6.4, we reworked how memory usage is handled, we now have a "memory" column that tries to use the best source available rather than always using PSS. This should improve the situation for some things, as it will no longer not display anything at all. That said, we still will not be able to read PSS of firejailed processes, due to `/proc/PID/smaps_rollup` being protected. So the displayed memory usage will not be the same as the mentioned application.