Unit polkitd.service is masked

After a failed Ubuntu version upgrade, a computer started behaving oddly. After initially failing to boot, we managed to make it get to the command line - but it refuses to network (so no apt, no LDAP, no NFS...). I could SSH into the machine, but no outgoing traffic attempts succeeded. Apparently the upgrade uninstalled network-manager, so I tried to get it back by scp-ing the required .deb files, but... no go. modemmanager, network-manager fail with

Error getting authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit polkitd.service is masked. (g-io-error-quark, 36)

and policykit-1 is saying

polkitd.service is a disabled or a static unit not running, not starting it.

So looking at polkitd, indeed, it is masked:

$ systemctl is-enabled polkitd.service
masked-runtime

(a working system shows static).

What is happening, and how do I repair my failed node?

EDIT in response to comments:

$ ls /etc/systemd/system
avahi-daemon.service
avahi-daemon.socket
click-system-hooks.service
dbus-org.freedesktop.Avahi.service
dbus-org.freedesktop.ModemManager1.service
dbus-org.freedesktop.nm-dispatcher.service
default.target.wants
display-manager.service.wants
gdm.service
getty.target.wants
graphical.target.wants
halt.target.wants
hibernate.target.wants
hybrid-sleep.target.wants
kexec.target.wants
multi-user.target.wants
nfs-client.target
nfs-server.service
ofono.service
osspd.service
plymouth-log.service
plymouth.service
polkitd.service.d
portmap.service
poweroff.target.wants
printer.target.wants
reboot.target.wants
resolvconf.service
shutdown.target.wants
sockets.target.wants
sshd.service
suspend.target.wants
sysinit.target.wants
syslog.service
urfkill.service

EDIT

# ls -al /etc/systemd/system/polkitd.service.d/
total 8
drwxr-xr-x  2 root root 4096 Dec 15 10:50 .
drwxr-xr-x 19 root root 4096 Dec 15 10:50 ..

I deleted the empty directory in question and rebooted; the service is now static as it should be, I managed to install network-manager.

However, network was still unreachable, so something else was wrong. I can ping my gateway... so I took a look at resolv.conf, and it was a broken link:

$ ls -al /etc/resolv.conf
lrwxrwxrwx 1 root root 29 May 14  2015 /etc/resolv.conf -> ../run/resolvconf/resolv.conf

So I copied it from another machine; now network works! I also had to install nfs-common and nfs-kernel-server, because for some reason they had disappeared (and I did not notice) to get my autofs running.


Solution 1:

Forced by the bounty deadline, I repeat blubberdiblub's answer:

/etc/systemd/system/polkitd.service.d doesn't exist on my Ubuntu system. Is yours a directory and is it empty? If yes, does rmdir /etc/systemd/system/polkitd.service.d and rebooting help?

Yes, it is - and yes, it does. I did precisely as suggested, and the error disappeared.