Apple Event: May 7th at 7 am PT

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

com.apple.xpc.launchd & com.apple.mdworker.bundles pollute logs with errors

I made a clean install of Yosemite to MacBook Pro (13-inch, Early 2011), and restored documents and apps from TM backup, no problems so far, but I observe following repeating messages in system log and it concerns me, because apparently, launchd is trying to do something related to spotlight, but fails and this happens every 10 seconds.. I see no suspicious activity apart from too much CPU time spent on mds and mds_stores (but I guess it's due to fresh install, hence Spotlight needs to index everything...).


Any ideas where to dig?


21/10/2557 BE 2:11:43.811 PM com.apple.xpc.launchd[1]: (com.apple.mdworker.bundles[2654]) Could not find uid associated with service: 0: Undefined error: 0 502

21/10/2557 BE 2:11:43.835 PM com.apple.xpc.launchd[1]: (com.apple.mdworker.bundles) Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

21/10/2557 BE 2:11:53.838 PM com.apple.xpc.launchd[1]: (com.apple.mdworker.bundles[2655]) Could not find uid associated with service: 0: Undefined error: 0 502

21/10/2557 BE 2:11:53.838 PM com.apple.xpc.launchd[1]: (com.apple.mdworker.bundles) Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

[goes forever]

Posted on Oct 21, 2014 12:44 AM

Reply
63 replies

Nov 4, 2014 7:58 AM in response to William Paplham

Interesing. Doing a search through the primary HD for the UID causing the every 10 second messages found the UID associated with two applications, Aperature and DxO in my case, and these are files associated with the application which can't be deleted. I have deleted all the rest associated with the UID explained in previous posts here. I'm curious why applications create fake UID's which isn't registered.

Nov 4, 2014 3:26 PM in response to William Paplham

Thank you William. I ran the command and examined the results ... no 501 (only 502 and 503 - my user ID and my wife's).


So I looked into my Users folder and lo and behold there's a .dmg file there in a folder named Deleted Users. I guess this must have happened around 3 or 4 years ago when I set up my iMac.


Do you think that could be the cause of the random shutdowns that I'm experiencing on the iMac?


The logs show a huge number of lines all ending with 501 and then there's a "respawn" line - just before the shutdown.


I don't need that .dmg so I believe that I can safely delete it.


Much appreciate your pointing me in the right direction.


Thanks, again.


David

Nov 5, 2014 5:33 AM in response to wsrphoto

After some thought I did a few things which after one day so far the Mac Pro has not had the error messages every 10 seconds, not even once. First, I removed the files as people have noted in previous posts. Second, I the reinstalled OS-X 10.10 using the command-R option which took about 3 hours and only changed a few settings (Notification) while keeping everything else unchanged. This resolved the issue after booting in safe mode of doubling the total used memory in the initial state after rebooting where it's back to normal. Third, I effectively shut down Spotlight using the privacy menu to exclude the entire Mac from its search. Since I don't use Spotlight, nothing is hurt if it doesn't do anything and all the other apps, Finder, Time Machine, etc., all have their own search tools. So far so good, the problem hasn't returned.

Nov 5, 2014 5:43 AM in response to wsrphoto

I don't think that the applications create fake IDs.

I think that the application was probably installed earlier, under a different ID. Different from your current user.

This could be due to several reasons. Like data migration, OS upgrade, etc.

I had failed HDs, where I had to recover user data from a dying HD.

I also did migration, migrating my previous user data onto a new computer.

I think most of you probably had the same, which probably caused all of these messages.

Deleting the applications, reinstalling the OS and turning off Spotlight is a bit much.


- If you just want the messages to stop, you can turn off Spotlight. It probably won't cause any other issue.

- Or you can fix the ownership with the commands posted by others.

- Or you can reinstall the OS, without migrating your data. That way the applications under the different user ID won't be migrated, and you won't have these messages.

But doing all 3 of these things is probably a bit too much.

Or lets say not necessary.

Nov 5, 2014 5:56 AM in response to Andras Dombovari

First, the applications were installed by me, not another user. I'm the only person registered on the Mac. The applications weren't deleted nor any data or stuff migrated, I only noted the UID was created by the application installation, by Aperture and DxO plug-ins. I'm not sure why but they use UID 505 and group staff which was the UID in the error mesages on my Mac. The reinstallation was to resolve the memory issues, not this one which was a secondary result. Turning the messages off won't stop Spotlight, and if it's Spotlight's search that's creating the messages, then stopping its searching is an option if you don't use it. The command-R on bootup only reinstalls OS-X while preserving everything else, with only a few changes by some applications to default. As to "not necssary", after trying the recommendations on this thread, what options were left since, as someone noted, the Apple techs said it was a bad installation of Yosemite. So I don't think spending 3+ hours is too much when it resolved one problem and maybe both.

Nov 10, 2014 10:58 PM in response to wsrphoto

Used command to find all files associated with user 502 [which didn't exist]. Got a series of them. I manually changed ownership of the files to me and administrator and removed the icons in "get info" that were searching for the owner. Stopped these annoying console messages completely after restart of computer. Thanks for the terminal command to find user 502. The list made it easy to update the ownership. Thank you so much.

Nov 21, 2014 10:59 AM in response to David King1

Sure, it was pretty straightforward:


open the console, and check for the logs

I have a lot of entries like this:


com.apple.xpc.launchd[1]: (com.apple.mdworker.bundles[14231]) Could not find uid associated with service: 0: Undefined error: 0 501

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


if you don't have these lines, you don't have the same problem.


The last number on the first line (501) will be different on your machine, it is the user ID of the files causing problems; Users start at 500, and each new user moves up by one, etc.

The problem happens when some files are owned by a user that doesn't exist.


So, find that number and then open a shell and type the following:


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


don't forget to replace 501 by whatever number you found in the error.

it can take a while because this will scan the whole hard drive to find files owned by the problem owner.


after that, you can take all the files and change the ownership back to yourself


for this you can type the following:

sudo chown -R <yourusername:yourgroup> <files that were found>


In a previous post, Sonic Soul proposed to make the change automatic by doing this:

sudo find / -uid ERRORUID -exec chown -h YOURUID '{}' \+


It will work too, but I didn't go that route because I found some files that should have been owned by the system, in the /Library folder for example, so I preferred to do it manually.


After the find command doesn't return anything, reboot and it should work.

It has been like night and day since the fix!

Nov 26, 2014 6:36 AM in response to Cyril Kay

I had the same issue after upgrading to Yosemite.

The problem seems to be that there are files on the upgraded machine that are owned by a user that no longer exists, and this stops mds from indexing


This was how I fixed mine:


Note the number at the end of the error messages (probably 50x), For example 503 in the log record below:

com.apple.mdworker.bundles could not find uid associated with service: 0: Undefined error: 0 503


Follow the steps below, replacing my user id and group id numbers with your own !


1. Whilst logged in as your admin user, Launch Terminal

2. Type: id

3. Take note of the numbers after uid= and after gid=

4. This is your current user id and group id, for example: uid=504, gid=20


5. Type: sudo find / -uid 503

You will have to enter your admin password when prompted

This finds all files owned by the unknown user (for example the 503 taken from the error message in the log)


6. Type: sudo find / -uid 503 -exec chown -h 504:20 {} \; -print

You will have to enter your admin password when prompted

This finds all files owned by the unknown user (503 in this example) and changes the userid and group id to that of the current user (504 and 20 respectively in this example)


This will take some time to scan your entire disk (maybe 5 to 10 mins depending on how much data you have), but it will print what it changes.

Once it is done you can confirm it worked by re-running the scan for the unknown user:

Type: sudo find / -uid 503 -exec ls -l {} \;


Now you should get nothing back (apart from maybe an error about /dev/fd/x not being a directory, which you can ignore).


The mds process needs to be restarted to stop errors from still being logged as it seems to have the info cached somewhere.

Type:

sudo launchctl stop /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

sudo launchctl start /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

Dec 4, 2014 10:19 AM in response to cloudranger

Hello,


Just wanted to say thank you! I had two of those phantom users - from the files they owned, I'm guessing they were created during previous upgrades? And I was having serious problems - Illustrator (several versions), EndNote, and several other programs I use every day would only open in safe mode, or sometimes after up to several hours of bouncing icons. And that would start over on the next restart. Many hours were spent with various tech support people and their hold music.


Now, knock on wood, everything tested opens even after a restart. It also seems a bit snappier, but that may just be my improved mood.


In case it's relevant - OS 10.10.1, mid-2010 MacBook Pro.


Barbara

Dec 6, 2014 12:40 PM in response to bmacgreg

Glad it worked out for you. Your problems were much worse than mine. I had just annoying log messages and a performance hit.

I guess though if permissions are screwed then programs will have all sorts of problems trying to open files etc.

Your snappier performance should simply be because you don't have mds turning in the background non stop, trying to access files it can't, and writing loads of log records.

These "phanton" users should only be from files or programs you installed using a user that you later deleted. In my case it was an upgrade of a 5 year old machine which has had users added and deleted many times. It will never happens if you do a clean install as there are no files owned by users that have been deleted, but that was not an option for me.

At the end of the day mds should be a bit cleverer and just skip files it has no permission to read, rather than getting stuck.

Dec 19, 2014 3:35 PM in response to cloudranger

Right - I've ploughed through the whole of this thread - most of which is way beyond my comfort zone - and it leaves me with a puzzle. I have the same problem as everyone else here, the offending number in my case being 501. I did the sudo find / -uid 501 command some time ago and it's still churning out files - thousands of them. The thing is, I'm sure I /used/ to be 501, but the id command tells me I'm 503 now. I'm pretty reluctant to do the command that changes all those files at once (and yikes! it's started churning out files on my Time Machine volume now, so I've interrupted it) especially as a lot of them seem to be in /Library and someone (on an earlier page - sorry I've forgotten who you are) suggested these should be owned by the system not by me.


I suppose one idea, if indeed it's possible, would be to change my own ID back to 501 - but then I'd probably get the same behaviour with 503 in the logs instead.


I'm reluctant to tinker in Terminal at the best of times, but I really don't like what's going on in my logs. Is there an equivalent, for example, to:

sudo find / -uid 501 -exec chown -h 503:20 {} \; -print

that would leave my Time Machine volume untouched... or should I change all that as well?

com.apple.xpc.launchd & com.apple.mdworker.bundles pollute logs with errors

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