Disabling PackageKit.sh

The “Install package X” prompt is really annoying since I miss type a lot I figured that it is provide by the /etc/profile.d/PackageKit.sh. I know I can delete it, but when the next release comes it will be back, so I want to know if I can somehow remove/disable it permanently.

I was thinking that I could rewrite my user .bashrc to not load it, but then I would have to basically rewrite the whole system bashrc which could change on new release, so that again seems pointless.

Another idea that I had is to just not source the system bashrc but that seems potentially stupid

1 Like

Hi @broccoli , welcome to the community. Please take a look at the introductory posts in the #start-here category if you’ve not had a chance yet.

This function is provided by the PackageKit-command-not-found package, so you can uninstall that:

sudo dnf remove PackageKit-command-not-found
1 Like

Thank you! It didn’t even occur to me that it could be a package since it’s just a script

1 Like

You can find what package a file belongs to using rpm (for packages installed on your system), and using dnf for packages in the repositories:

# I don't have PackageKit-command-not-found installed, so a different file:
$ rpm -qf /etc/profile.d/flatpak.sh 
flatpak-1.12.7-5.fc36.x86_64

With dnf:

$ sudo dnf whatprovides '/etc/profile.d/PackageKit.sh'
PackageKit-command-not-found-1.2.5-1.fc36.x86_64 : Ask the user to install command line programs automatically
Repo        : fedora
Matched from:
Filename    : /etc/profile.d/PackageKit.sh

Now that I think of it, you can even remove the file directly with dnf and it will figure out the package to remove:

sudo dnf remove /etc/profile.d/PackageKit.sh

For eg:

$ sudo dnf remove /etc/profile.d/flatpak.sh 
Dependencies resolved.
========================================================================================================================================
 Package                                       Architecture          Version                      Repository                       Size
========================================================================================================================================
Removing:
 flatpak                                       x86_64                1.12.7-5.fc36                @updates                        5.4 M
Removing dependent packages:
 fedora-flathub-remote                         noarch                1-2.fc36                     @fedora                         5.9 k
 gnome-software                                x86_64                42.4-1.fc36                  @updates                        8.1 M
Removing unused dependencies:
 appstream                                     x86_64                0.15.2-1.fc36                @updates-testing                2.7 M
 appstream-data                                noarch                36-3.fc36                    @updates-testing                 13 M
 fwupd                                         x86_64                1.8.3-1.fc36                 @updates                        8.1 M
 fwupd-efi                                     x86_64                1.3-1.fc36                   @updates-testing                153 k
 fwupd-plugin-flashrom                         x86_64                1.8.3-1.fc36                 @updates                         36 k
 fwupd-plugin-modem-manager                    x86_64                1.8.3-1.fc36                 @updates                        134 k
 fwupd-plugin-uefi-capsule-data                x86_64                1.8.3-1.fc36                 @updates                        2.2 M
 libxmlb                                       x86_64                0.3.9-1.fc36                 @updates-testing                293 k

Transaction Summary
========================================================================================================================================
Remove  11 Packages

Freed space: 40 M
Is this ok [y/N]: 
3 Likes

I had no idea you could do this. I’ve always nested it like dnf remove $(rpm -qf /path/to/file).

1 Like

The “specifying packages” section of man dnf is worth taking a look at. My understanding is that one can use “capabilities” with dnf, which include files provided by packages, provides, and of course the package names etc.

2 Likes