GeekSocket Plug in and be Geekified

Finding the data usage culprit [ packagekitd ]

Yesterday morning, I noticed that my laptop was using high bandwidth. It was nearly 1MBps. It was little bit suspicious for me. At first, I thought it must be Chrome, but later I realized Chrome does not auto update itself. Now the question is, who is using the data.

One change I observed was after using that much amount of data, it stopped showing notification about update. This never happened before, so I thought it may be something related to updates. As I use two GNOME extensions to display the current speed and data usage, I came to know the usage.


How to find the per app data usage?

I was searching for a file or native command in order to find the individual data usage of software. Found no command or file which logs the per process data.

I was aware of tcpdump and Wireshark but instead of capturing and evaluating packets, I tried netstat, lsof, ifstat which were showing either current connections or total usage per device.

[bhavin@localhost ~]$ ifstat
#kernel
Interface        RX Pkts/Rate    TX Pkts/Rate    RX Data/Rate    TX Data/Rate  
                 RX Errs/Drop    TX Errs/Drop    RX Over/Rate    TX Coll/Rate  
lo                     0 0             0 0             0 0             0 0      
                       0 0             0 0             0 0             0 0      
enp7s0                 0 0             0 0             0 0             0 0      
                       0 0             0 0             0 0             0 0      
wlp8s0                39 0            36 0          4467 0          4400 0      
                       0 0             0 0             0 0             0 0

To see the current tcp connections  lsof -niTCP -sTCP:ESTABLISHED

After searching a bit, I came across this article about tools to see the network usage, I decided to use nethogs.

$ sudo nethogs <interface name>

nethogs running packagekitd

I found that the process using bandwidth was /usr/libexec/packagekitd


What is packagekitd ?

It is the daemon process used by GNOME Software to check for updates and download them. It uses pkcon tool to download the packages, it is different than dnf check-update. It starts when the device boots up and checks and downloads packages, if updates are available.


How to disable auto download ?

After searching again, I came to know that RHEL provides GUI option to disable auto download of the packages. Fedora does not have any GUI option to disable this.

So now we have two options, either disable the service or change the settings through commands so that packagekitd will not auto download. Don’t forget to update your system regularly using dnf.

1. Disabling the packagekit service

If you disable the service, GNOME Software will not be able to install anything. Masking the service will do that trick.

$ sudo systemctl mask packagekit.service

See this answer for more details.

2. Change the configuration of packagekit

GNOME Software used to store the configuration using dconf, it is something like registry keys on Windows. This answer shows how to disable it, but it does not work on latest Fedora releases.

On latest Fedora and RHEL releases Gsettings is used, which again uses dconf at the back end. List of commands provided by gsettings. You can read more about dconf and gsettings here

Let’s check the description of the key for auto download of updates.

[bhavin@localhost ~]$ gsettings describe org.gnome.software download-updates

If enabled, GNOME Software automatically downloads updates in the 
background and prompts the user to install them when ready.

To disable the auto download, we can set this key to false.

$ gsettings set org.gnome.software download-updates false

I have found this answer here and here.


GNOME extensions that I used

https://extensions.gnome.org/extension/1085/simple-net-speed

https://extensions.gnome.org/extension/104/netspeed


Comments

Comments are not enabled on this site. The old comments might still be displayed. You can reply on one of the platforms listed in ‘Posted on’ list, or email me.

vishal_vvr on Sat Oct 7, 2017 08:35 IST

good hack :)