Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Could not find uid associated with service

On my iMac with Yosemite (just upgraded from 10.09) I see error messages coming in on the console every minute:


20.10.14 21:26:46,477 com.apple.xpc.launchd[1]: (com.apple.mdworker.bundles[3803]) Could not find uid associated with service: 0: Undefined error: 0 501

20.10.14 21:26:59,142 com.apple.xpc.launchd[1]: (com.apple.cfprefsd.xpc.agent[3806]) Could not find uid associated with service: 0: Undefined error: 0 501

20.10.14 21:27:01,433 com.apple.xpc.launchd[1]: (com.apple.cfprefsd.xpc.agent) Service only ran for 2 seconds. Pushing respawn out by 8 seconds.


This pattern keeps repeating.


UID 501 does not exist. That was an old user that I have deleted a long ago.


mddiagnose shows that there is some configuration for that UID. So it seems as if mdworker (or timemachine?) still has some configuration for this user which doesn't exist anymore.


Does anyone have an idea how to get rid of that? mddiagnose doesn't really show where it obtains the user information...


Thanks!

iMac, OS X Yosemite (10.10)

Posted on Oct 20, 2014 12:35 PM

Reply
19 replies

Nov 17, 2014 11:23 PM in response to gvde

I found the answer in this discussion.


https://discussions.apple.com/thread/6615545


There’s a com.apple.Spotlight folder buried within the /private/var/folders hierarchy. (I suspect that it always has the name /private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight, but am not sure.)


Within that folder is a folder for each UID on your system that Spotlight believes needs to be indexed. That’s not getting cleaned up when deleting a user.


Removing the folder named “501” (in your case), and rebooting, should resolve the problem.


(It’s also possible that you need to ensure that no files left on your system are owned by uid 501. I’m not sure — I tried this first, so by the time I found the solution above, I didn’t have any left owned by the user I’d deleted.)

Nov 20, 2014 10:46 AM in response to Anton Rang

No, that isn't the solution.


Tried it myself (had the same problem) and it didn't work.


The actual cause are non-existent UIDs (of users who have been deleted from the Mac) that are still the owner of now "orphaned" files on the Mac.


The solution: using the sudo chown command, change the ownership of the orphaned files to a valid user. Since my orphaned files happened to be associated with an app on my Mac, I changed the ownership of those files to root and then rebooted.


Presto, no more error messages!


gvde (the original poster) can search for these orphaned files on his system using the following command:

sudo find . -user 501 -exec ls -ld {} \;

Dec 1, 2014 9:30 AM in response to k3comms

A bit more info.


I deleted the 505 directory and ran the command again:

sudo find . -user 501 -exec ls -ld {} \;


which did not reveal any files but the error was still appearing in the log!


Eventually re-ran the find command and the 505 directory had been recreated with the original files.


I have a gremlin I think!

Dec 18, 2014 9:09 PM in response to gvde

After opening the CONSOLE today I discovered I too have the same problem on my Yosemite 10.10.1 iMac. The following two lines repeat perpetually every 10 seconds:


Dec 19 13:55:28 iMac com.apple.xpc.launchd[1] (com.apple.mdworker.bundles[14932]): Could not find uid associated with service: 0: Undefined error: 0 505

Dec 19 13:55:28 iMac com.apple.xpc.launchd[1] (com.apple.mdworker.bundles): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.


Since the stated Error is 505, I conjured up the following info in the Terminal:


iMac:var james$ sudo find . -user 505 -exec ls -ld {} \;

Password:

drwx------ 5 505 _spotlight 170 Nov 5 16:33 ./folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight/505

drwx------ 2 505 _spotlight 68 Nov 5 16:33 ./folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight/505/0

drwx------ 2 505 _spotlight 68 Nov 5 16:33 ./folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight/505/C

drwx------ 2 505 _spotlight 68 Nov 5 16:33 ./folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight/505/T

iMac:var james$


What should I do at this point?



Not sure if it is related, but a few days ago I successfully tried some Terminal commands to keep my Computer from being renamed with "(2)" (and so on) at the end:


James-iMac:~ james$ sudo /usr/libexec/PlistBuddy -c 'Add :ProgramArguments: string --no-namechange' /System/Library/LaunchDaemons/com.apple.discoveryd.plist

Password:

James-iMac:~ james$ sudo launchctl unload /System/Library/LaunchDaemons/com.apple.discoveryd.plist &&

> sudo launchctl load /System/Library/LaunchDaemons/com.apple.discoveryd.plist

James-iMac:~ james$ sudo launchctl unload /System/Library/LaunchDaemons/com.apple.discoveryd.plist

James-iMac:~ james$ sudo launchctl load /System/Library/LaunchDaemons/com.apple.discoveryd.plist

James-iMac:~ james$ sudo discoveryutil mdnsflushcache

James-iMac:~ james$ sudo discoveryutil mdnsrestartregistrations

James-iMac:~ james$


Would the above Terminal commands have caused the Error 505 problem?

There's one more thing I should mention, since I don't know if it is related or not. Ever since updating to Yosemite (from Mavericks) I cannot connect my iMac to our office Time Capsule via simply by clicking it in the "Shared" section of the left sidebar in Finder windows. (It says "Not Connected".) But if I click the "Go" menu and then "Connect To Server..." and then type SMB://<ip address of TC> or AFP://<ip address of TC>, I can connect. In fact, it was in my quest today to solve that problem that I decided to open the CONSOLE, only to discover the endless ERROR 505 messages.

Any thoughts would be greatly appreciated.

Thank you.

Dec 28, 2014 4:17 AM in response to JDW1

1- The find command has to be issued from the root directory "/"


either: (for whatever userid you are looking for)

cd /; sudo find . -user 502 -exec ls -ld {} \;

- or -

sudo find / -user 502 -exec ls -ld {} \;


2- Once one has found the files in question, it is necessary to either change their ownership via "chown" or delete them.

Typically, one needs to use a command like:

sudo chown -R <you> <filename>


3- Note that if you use TimeMachine for backup, you will find that these files are propagated throughout the TimeMachine disk.

Which is to say -- until those files "roll-off" TimeMachine, you will get the error, as chown does not operate on TimeMachine files.


4- all of these problems stem from installing or upgrading by using one of the techniques Apple provides to "save" all of your user data.

Simply doing a "re-install" will NOT solve the problem, in fact, it will probably simply re-create it.

It is actually difficult to do a "virgin" install of OSX. In their efforts to be "user friendly" all vendors (not just Apple) have opted to "save your preferences" when doing installs and upgrades. These "preferences" are much more than "skin-deep" and retain many things which are far from obvious -- and which can often lead to conflicts with what you are trying to do; namely, get rid of the "old-cruft" from your system.

Dec 28, 2014 5:35 PM in response to William H. Magill1

William, thank you for your reply. Unfortunately, I don't really understand the guidance you provided because I don't understand the problem itself. I'm not an expert on Terminal commands. What I mentioned in my previous post are commands that I simply found in online forums and then copied and pasted within the Terminal. So here are my questions and comments:


1) You talk about a "user 502", but what is that? (Note that my previous post talks of an ERROR 505, which seems to be totally different than what you're talking about.)


2) When I discovered the repeating errors in the Console, I've been Googled and found this forum. I am totally ignorant about those errors and what causes them. I tried those Terminal commands, but I really have no idea what I am doing. All I want to do is stop those repeating errors in the Console. How specifically do I stop those errors?


3) I do indeed use Time Machine to backup my iMac's internal 1TB HD to an external FW800 2TB HD directly attached to that same iMac. And after my update to Yosemite, I've had problems accessing backups made more than 24 hours ago (via the TM UI, accessed via the menubar "Enter Time Machine" command), unless I dig down in the TM drive manually. If I search the drive manually in the Finder, all the backups are there. It's only the TM UI that was totally screwed up after my upgrade from Mavericks to Yosemite. With that said, I am still ignorant of any correlation between my TM woes and these strange recurring errors in the Console. For more details on that problem, read my thread about that here: Can't browse some older backups via Time Machine interface


4) You seem to be saying that all my problems were caused by upgrading from Mavericks to Yosemite, rather than doing a clean install of Yosemite. And you seem to say the cure is a clean install of Yosemite. However, I did a past upgrade from Snow Leopard to Mavericks with zero problems. Ditto for OS upgrades prior to that. As such, I must assume that the problem lies more with Yosemite than it does with "OS Upgrades" in general. Furthermore, I have read in other threads that folks with the same TM UI problem that I have continue to have that problem even after a clean install of Yosemite, which implies a lingering BUG causing the problem (rather than "cruft" left over from an OS Upgrade).


I look forward to your reply.


Thank you.

Dec 29, 2014 12:29 AM in response to JDW1

Your are reading it wrong. It's not error 505. It's UID 505. The error is in fact 0.


The 505 (or 502 before) is the UID of a user. Each user has a UID which is mapped to a user name. The latter is usually shown.


The ls command showed this:


drwx------ 5 505 _spotlight 170 Nov 5 16:33 ./folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight/505


If ls shows a number instead of a user name (i.e. the 505 in the third column) this means your system does not know anything about user 505 but still there are files owned by the user with UID 505.


This is caused because at some time there was a user with UID 505 on your system and now it has probably be deleted. Or you manually changed the UID of a user on your system.


It doesn't not cause problems on your system except that it consumes runtime as the system frequently tries to run those services and can't.


Thus cleaning up this could be a good idea.

Dec 29, 2014 2:00 AM in response to gvde

gvide, thank you for the explanation. I am completely ignorant about UID Numbers, but I am aware of the iMac's name which is set in the system preferences and which has not changed since the iMac was set up in early 2009.


As you can read in one of my previous post in this thread, the troublesome UID is 505 and appears to be associated with Spotlight. Can you please tell me the exact steps I need to take to eliminate this problem? (Please be aware though that if 505 is an old UID that needs to be eliminated, then I really have no idea what my current UID is.)


Thank you.

Dec 29, 2014 2:16 AM in response to JDW1

The UID is not "associated" with spotlight. Spotlight indexes files for all users. At some point a user with UID 505 existed on your system. That's why spotlight tries to index files for uid 505 as well.


Open a Terminal window and enter "id". This command shows you the uid (and the gids of all your groups).


You can also check the UIDs of all your users using System Preferences, Users & Groups. Unlock and right-click or control-click on a user to open advanced options for a user. The User ID is the UID of that user. Be careful not to change anything in the advanced options, i.e. press cancel to close the window.


Do you have many users set up on your computer? Did you delete a user at any time?


To erase that folder do a


sudo rm -rf /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight/505


in a Terminal window. Then reboot. This should fix the problem.


I would also recommend to check for other files belonging to that user id. You can run a


sudo find -x / -user 505 -ls


to find all files on your computer which belong to uid 505. You may either want to delete these files or change the owner and move them elsewhere.

Dec 29, 2014 4:11 AM in response to JDW1

This is a brief incredibly simplified, explanation of a complex "Computer Science" situation.


Briefly put - Apple makes using a computer "user friendly." As such it hides many of the things which are actually happening "behind the scenes."


Everything in a computer is "abstracted" from reality to what "makes sense" to a human being.


No computer available to the consumer today operates on "Words" i.e. characters strung together inn some alphabet to provide meaningful information to a human being. All computers operate on "numbers" -- actually on BINARY strings which are themselves abstracted to look like what a human being calls a "number."


Looking at the first level of abstraction, we find that numbers, like 501/502/505, etc., are the "internal representation" of your user-ID, or user-name.


When you first set-up your iMac, you were asked to enter your name - "John Q. JDW1." That "name" became associated with the FIRST userid on your system or UID 501. You then added access (an account) for your significant other - "S.O. JDW1." THAT "name" became associated with the SECOND userid on your system or UID 502. Next you added access for your friend - "JDW1 Friend" - which became UID 503. And so on for each new entity you allow access to your system.


Next, you replace your Significant Other one with Significant Other Two -- that account becomes "UID-next" - UID 504 in our example. You delete the account for SO 1 (UID-502) -- and now the fun begins.


Because "the Internet never forgets" there are parts of your computer which "remember" UID-502. (I'm not going to try to explain WHY this happens, just accept that it does.) However, you, as a human, and because the Operating System (OSX) is "user friendly" will normally never see or encounter this fact.


This brings us to where we (you) are now. These "hidden" items are called "artifacts." And just like a working archaeologist, you need to "sift through" the "sands of your your file system" looking for them.


Now you can follow the instructions provided by others to "find" these artifacts and "fix" (change the ownership or delete) the complaint in the system log file.


Clear as mud?

No doubt - Hope this helps.

Could not find uid associated with service

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.