6

On every desktop startup, I have a dialog asking for password. The cause is policy kit.

I haven't found what exactly is raising the prompt, but it brings me to the question:

Do I need policy kit? If so, why?

If not, how do I remove it?

sudo apt remove polkit*
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'polkit-1-auth-agent' for glob 'polkit*'
Note, selecting 'polkit-kde-agent-1' for glob 'polkit*'
Package 'polkit-kde-agent-1' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
sudo apt remove polkit-1-auth-agent
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Virtual packages like 'polkit-1-auth-agent' can't be removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Pablo Bianchi
  • 15,657
  • 3
    Don't- you'll break your system. Policy kit is the inherent security of the linux system. Don't remove part of your system (same for python and many others) – kanehekili May 21 '21 at 22:53
  • Right. I just tried it with a VM! Boom. Thanks. Any idea how to track down what is causing policy kit to ask for password when my desktop starts up? – Stephen Boston May 21 '21 at 22:59

1 Answers1

13

polkit (formerly Policy Kit) provides two important services.

From the project documentation:

an authorization API intended to be used by privileged programs (“MECHANISMS”) offering service to unprivileged programs (“SUBJECTS”) often through some form of inter-process communication mechanism.

...and...

allows users to obtain temporary authorization through authenticating either an administrative user or the owner of the session the client belongs to.

The first provides a safe way for user-level applications to ask for root-level actions. You might use this regularly without noticing in Desktop systems -- like suspending, or mounting newly-inserted hardware. Polkit is part of that mysterious glue that makes the desktop work.

The second is (most commonly) the GUI "admin privileges are required for this actions" dialog.


polkit is a necessary element in all Ubuntu Desktop (GUI) systems. Removing polkit will destroy your Ubuntu Desktop (GUI) system. It's generally not needed if you run headless (without GUI / Ubuntu Server), though folks do sometimes add software that needs polkit.

user535733
  • 62,253
  • 1
    Are you sure this causes errors on server? A lot of my systems installed with ubuntu server never had polkit installed, and I haven't removed it. (Note: I fully agree that polkit is needed for desktop -- even desktop installed on server.) – user10489 Jan 30 '22 at 21:16
  • @user10489 The phrase used in the answer is "...and may cause..." Some people do strange stuff with servers. Many users, like you, do not encounter any problems. – user535733 Jan 30 '22 at 21:23
  • 2
    in all Ubuntu Desktop systems. It's not needed if you run headless. – Robert Riedl Jan 31 '22 at 08:54
  • Note that the package network-manager depends by the package polkitd. So, probably you may want to keep it. – Valerio Bozz Jul 20 '23 at 13:56