I wanted to use a software not installed in my system in the command line and when I put in the command the system said command not found, do you want to install it?
How does this work?
I wanted to use a software not installed in my system in the command line and when I put in the command the system said command not found, do you want to install it?
How does this work?
It uses a tool called PackageKit-command-not-found
. That package installs a profile.d script that defines the shell function command_not_found_handle()
, which bash calls automatically when a command isn’t found.
Thanks! How does this work without sudo? Is PackageKit part of Wheel or something?
PackageKit is a system daemon. The client (in this case /usr/libexec/pk-command-not-found
) talks to PackageKit over D-Bus, with permission mediated by polkit. PackageKit ships the following polkit rule:
polkit.addRule(function(action, subject) {
if ((action.id == "org.freedesktop.packagekit.package-install" ||
action.id == "org.freedesktop.packagekit.package-remove") &&
subject.active == true && subject.local == true &&
subject.isInGroup("wheel")) {
return polkit.Result.YES;
}
});
This allows admins (in the ‘wheel’ group) logged in directly (not over SSH) to install packages without root. The same policy applies to GNOME Software and to the pkcon
command.