Ubuntu Server 16.04.3中polkitd服务无法识别问题求助
Hey there, let's work through this polkitd issue you're facing. That error pops up because the traditional service command (for sysvinit) doesn't recognize polkitd—Ubuntu 16.04 uses systemd as its default init system, and polkitd is managed directly via systemd tools instead. Here's your step-by-step fix:
Step 1: Use the correct systemd command for polkitd
Instead of sudo service polkitd reload, try the systemd-native command that's designed for this service:
sudo systemctl reload polkitd
If you need to restart the service entirely (not just reload configs), use:
sudo systemctl restart polkitd
This should bypass the "unrecognized service" error since we're using the right tool for systemd-managed services.
Step 2: Verify polkit is properly installed
If the systemd commands still fail, check if the polkit packages are intact. Run this to list polkit-related packages:
dpkg -l | grep polkit
Look for entries for polkitd and polkit. If they show as uninstalled or have a broken status, reinstall them with:
sudo apt-get update && sudo apt-get install --reinstall polkitd polkit
Step 3: Repair the systemd unit file (if needed)
Polkitd relies on a systemd unit file to run. Check if this critical file exists:
ls /lib/systemd/system/polkitd.service
If the file is missing, the reinstall from Step 2 should restore it. If it exists but you still have issues, reload the systemd daemon to pick up any changes to unit files:
sudo systemctl daemon-reload
Then start polkitd again to apply the fix:
sudo systemctl start polkitd
Step 4: Confirm polkitd is running
To make sure everything's working as expected, check the service status:
systemctl status polkitd
You should see output showing active (running) in green if the service is up and healthy.
Quick note on why service didn't work
Ubuntu 16.04 uses systemd by default, but it still supports legacy sysvinit scripts for some older services. Unfortunately, polkitd doesn't have a sysvinit script, so the service command can't find it—hence the "unrecognized service" message. Sticking with systemctl for polkitd is the correct approach here.
内容的提问来源于stack exchange,提问作者Zazula

