Le problème
Impossible de démarrer le service polkitd, ce qui affecte également d'autres services.
# systemctl restart polkit ** (pkttyagent:32189): WARNING **: 13:59:48.884: Unable to register authentication agent: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.PolicyKit1 was not provided by any .service files Error registering authentication agent: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.PolicyKit1 was not provided by any .service files (g-dbus-error-quark, 2) Job for polkit.service failed because the control process exited with error code. See "systemctl status polkit.service" and "journalctl -xe" for details.
# systemctl status polkit ● polkit.service - Authorization Manager Loaded: loaded (/usr/lib/systemd/system/polkit.service; static; vendor preset: enabled) Active: failed (Result: exit-code) since Sat 2019-03-23 13:59:48 IST; 4min 13s ago Docs: man:polkit(8) Process: 32193 ExecStart=/usr/lib/polkit-1/polkitd --no-debug (code=exited, status=1/FAILURE) Main PID: 32193 (code=exited, status=1/FAILURE) Mar 23 13:59:48 [hostname] systemd[1]: Starting Authorization Manager... Mar 23 13:59:48 [hostname] systemd[1]: polkit.service: main process exited, code=exited, status=1/FAILURE Mar 23 13:59:48 [hostname] systemd[1]: Failed to start Authorization Manager. Mar 23 13:59:48 [hostname] systemd[1]: Unit polkit.service entered failed state. Mar 23 13:59:48 [hostname] systemd[1]: polkit.service failed.
La solution
Ce problème a été causé par des autorisations incorrectes pour les fichiers et répertoires liés à polkit. Polkit est utilisé pour contrôler les privilèges à l'échelle du système. Il fournit un moyen organisé pour les processus non privilégiés de communiquer avec les privilégiés. Contrairement aux systèmes tels que sudo, il n'accorde pas l'autorisation root à un processus entier, mais permet plutôt un niveau de contrôle plus fin de la stratégie système centralisée.
1. Assurez-vous que l'utilisateur et le groupe polkitd sont présents, sinon essayez de réinstaller le RPM :
# getent passwd polkitd polkitd:x:999:997:User for polkitd:/:/sbin/nologin # getent group polkitd polkitd:x:997:
2. Réinitialisez les autorisations et la propriété des utilisateurs/groupes pour tous les fichiers fournis par les packages polkit et polkit-pkla-compat :
# rpm -Va polkit # rpm --setugids polkit polkit-pkla-compat # rpm --setperms polkit polkit-pkla-compat
3. Vérifiez à nouveau si le problème est à nouveau rencontré. Si tel est le cas, essayez de réinstaller/mettre à jour le RPM vers la dernière version :
# yum reinstall polkit ... Resolving Dependencies --> Running transaction check ---> Package polkit.x86_64 0:0.112-18.0.1.el7 will be reinstalled --> Finished Dependency Resolution Dependencies Resolved ========================================================================================================================================================== Package Arch Version Repository Size ========================================================================================================================================================== Reinstalling: polkit x86_64 0.112-18.0.1.el7 rhel7_latest 168 k Transaction Summary ========================================================================================================================================================== Reinstall 1 Package Total download size: 168 k Installed size: 473 k Is this ok [y/d/N]: y Downloading packages: polkit-0.112-18.0.1.el7.x86_64.rpm | 168 kB 00:00:02 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : polkit-0.112-18.0.1.el7.x86_64 1/1 Verifying : polkit-0.112-18.0.1.el7.x86_64 1/1 Installed: polkit.x86_64 0:0.112-18.0.1.el7
4. Vérifiez l'état du service dbus, s'il est désactivé, redémarrez le service :
# systemctl status dbus ● dbus.service - D-Bus System Message Bus Loaded: loaded (/usr/lib/systemd/system/dbus.service; static; vendor preset: disabled) Active: active (running) since Fri 2019-03-22 20:56:05 IST; 17h ago Docs: man:dbus-daemon(1) Main PID: 13721 (dbus-daemon) CGroup: /system.slice/dbus.service └─13721 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation Mar 23 13:57:09 [hostname] dbus[13721]: [system] Activating via systemd: service name='org.freedesktop.login1' unit='dbus-org.freedesktop.login1.service' Mar 23 13:57:34 [hostname] dbus[13721]: [system] Failed to activate service 'org.freedesktop.login1': timed out Mar 23 14:07:50 [hostname] dbus[13721]: [system] Unable to reload configuration: Failed to open "/usr/share/dbus-1/system.conf": Permission denied Mar 23 14:07:50 [hostname] dbus-daemon[13721]: Unable to reload configuration: Failed to open "/usr/share/dbus-1/system.conf": Permission denied Mar 23 14:07:50 [hostname] dbus[13721]: [system] Unable to reload configuration: Failed to open "/usr/share/dbus-1/system.conf": Permission denied Mar 23 14:07:50 [hostname] dbus-daemon[13721]: Unable to reload configuration: Failed to open "/usr/share/dbus-1/system.conf": Permission denied Mar 23 14:07:50 [hostname] dbus[13721]: [system] Unable to reload configuration: Failed to open "/usr/share/dbus-1/system.conf": Permission denied Mar 23 14:07:50 [hostname] dbus-daemon[13721]: Unable to reload configuration: Failed to open "/usr/share/dbus-1/system.conf": Permission denied Mar 23 14:07:50 [hostname] dbus-daemon[13721]: Unable to reload configuration: Failed to open "/usr/share/dbus-1/system.conf": Permission denied Mar 23 14:07:50 [hostname] dbus[13721]: [system] Unable to reload configuration: Failed to open "/usr/share/dbus-1/system.conf": Permission denied
Dans ci-dessus, le service est démarré, mais l'autorisation refusée est due au service polkitd non actif.
5. Exécutez le service polkitd avec l'option de débogage :
# /usr/lib/polkit-1/polkitd Error switcing to user polkitd: Error changing to home directory /: Permission denied <<< Exiting with code 1
L'erreur constatée est due au fait que l'utilisateur polkitd n'est pas en mesure de changer de répertoire personnel. Vérifiez le répertoire personnel :
# cat /etc/passwd |grep polkitd polkitd:x:999:998:User for polkitd:/:/sbin/nologin
Peut voir que le répertoire personnel est "/", vérifier l'autorisation de /tmp, /home, /etc, /var, /bin, /run et /
# ls -l / total 32 lrwxrwxrwx. 1 root root 7 Jan 2 20:11 bin -> usr/bin dr-xr-xr-x. 4 root root 4096 Mar 22 20:54 boot drwxr-xr-x. 87 root root 8192 Mar 23 14:07 etc drwxr-xr-x. 3 root root 20 Jan 2 23:45 home lrwxrwxrwx. 1 root root 7 Jan 2 20:11 lib -> usr/lib lrwxrwxrwx. 1 root root 9 Jan 2 20:11 lib64 -> usr/lib64 dr-xr-x---. 8 root root 4096 Mar 14 21:01 root drwxr-xr-x. 30 root root 1000 Mar 23 14:07 run lrwxrwxrwx. 1 root root 8 Jan 2 20:11 sbin -> usr/sbin drwxr-xr-x. 19 root root 4096 Jan 2 20:19 var
# ls -ld / drwx------. 17 root root 4096 Jan 2 20:17 /
6. La permission vue de "/" est de 700 au lieu de 555, rectifiez et redémarrez le service :
# ls -ld / drwx------. 17 root root 4096 Jan 2 20:17 /
# chmod 555 /
# ls -ld dr-xr-xr-x. 17 root root 4096 Jan 2 20:17 .
# systemctl start polkit # systemctl status polkit ● polkit.service - Authorization Manager Loaded: loaded (/usr/lib/systemd/system/polkit.service; static; vendor preset: enabled) Active: active (running) since Sat 2019-03-23 14:47:16 IST; 48s ago Docs: man:polkit(8) Main PID: 2186 (polkitd) CGroup: /system.slice/polkit.service └─2186 /usr/lib/polkit-1/polkitd --no-debug Mar 23 14:47:16 [hostname] polkitd[2186]: Loading rules from directory /usr/share/polkit-1/rules.d Mar 23 14:47:16 [hostname] polkitd[2186]: Finished loading, compiling and executing 3 rules Mar 23 14:47:16 [hostname] systemd[1]: Started Authorization Manager. Mar 23 14:47:16 [hostname] polkitd[2186]: Acquired the name org.freedesktop.PolicyKit1 on the system bus Mar 23 14:47:16 [hostname] polkitd[2186]: Registered Authentication Agent for unix-process:2181:6445595 (system bus name :1.145 [/usr/bin/pkttyagent ...US.UTF-8) Mar 23 14:47:16 [hostname] polkitd[2186]: Unregistered Authentication Agent for unix-process:2181:6445595 (system bus name :1.145, object path /org/f...from bus) Mar 23 14:47:40 [hostname] polkitd[2186]: Registered Authentication Agent for unix-process:2216:6448064 (system bus name :1.147 [/usr/bin/pkttyagent ...US.UTF-8) Mar 23 14:47:40 [hostname] polkitd[2186]: Unregistered Authentication Agent for unix-process:2216:6448064 (system bus name :1.147, object path /org/f...from bus) Mar 23 14:47:55 [hostname] polkitd[2186]: Registered Authentication Agent for unix-process:2234:6449521 (system bus name :1.148 [/usr/bin/pkttyagent ...US.UTF-8) Mar 23 14:47:55 [hostname] polkitd[2186]: Unregistered Authentication Agent for unix-process:2234:6449521 (system bus name :1.148, object path /org/f...from bus) Hint: Some lines were ellipsized, use -l to show in full.
Le service polkitd avec les informations de débogage :
# /usr/lib/polkit-1/polkitd Successfully changed to user polkitd 14:55:06.874: Loading rules from directory /etc/polkit-1/rules.d 14:55:06.874: Loading rules from directory /usr/share/polkit-1/rules.d 14:55:06.875: Finished loading, compiling and executing 3 rules Entering main event loop Connected to the system bus 14:55:06.876: Lost the name org.freedesktop.PolicyKit1 - exiting Shutting down Exiting with code 0Remarque :Il est recommandé de redémarrer le nœud après la modification et de vérifier que le système s'exécute sans problème.