I'm running macOS Server 5.6.1 on High Sierra (10.13.4) and I was trying to modify a system launch daemon plist file the other day as my apache installation wasn't working after migration.
sudo wouldn't allow me to change anything due to SIP restrictions, so I decided that I'd try to get a root login shell and try to modify the plist file that way. I'd previously enabled the root user years ago when I first got the computer. I opened a Terminal window and tried
login root and entering the password. Nothing. I tried a few different possible passwords but none of them worked.
At this point, I figure that I must have forgotten which of the dozens of passwords I used for the root account. No problem, though, because I can reset the root password, right? So I open Directory Utility, authenticate, and click "Change Root Password..." in the menu. I try logging in again—to no avail.
I'm a little confused now, but I decide to try disabling the root user in the menu and then re-enable it. However, clicking on "Disable root user" does nothing, and it never changes back to "Enable root user". Trying
dsenableroot -d returns
dsenableroot:: ***Failed to disable root user. Slightly concerned now, I try
sudo dscl . -passwd /Users/root, but that fails with the message
<dscl_cmd> DS Error: -14009 (eDSUnknownNodeName). I also try
sudo passwd root, which gives me
passwd: Unknown user name 'root'.
Now I'm very worried. How on earth could the root user just disappear??
top and the Activity Monitor show plenty of processes owned by root, but
dscl . -list /Users UniqueID doesn't have an entry for root, or a UID of
0. In fact, as far as I can tell, the root user simply does not exist. Even in the File Info dialogs in Finder, files and folders owned by root show "Fetching..." in the area where the owner name should be (see image).
As I don't use this computer on a daily basis, and certainly don't log on as root often, I have no idea when this started or for how long I've not had a root user. I'm pretty sure it's been at least a month or two, but other than that I don't know.
Can someone please help me figure out what the heck is going on here and how to fix it?