Posted on 03-18-2015 04:50 PM
Hi all,
I've noticed that the machines I image in Target Disk Mode end up having issues with Spotlight. Nothing other than web results (URL, movies, etc) and dictionary terms show up; None of the local applications show. I've seen a couple other posts on JAMF Nation but they are all pretty old, pre-dating Yosemite so those results haven't really worked for me. I've tried the following to see if it would net me the desired results (they didn't):
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
I've also tried this:
rm /.metadata_never_index
rm /.fseventsd/no_log
sudo mdutil -E -a -i on
Source
Pretty much any mdutil command presents me with the same error message:
~ Administrator$ sudo mdutil -E /
Password:
/:
Indexing and searching disabled.
SEA-EIS-EWindell:~ Administrator$
If anyone has any suggestions that would be much appreciated. I really like the ease of Thunderbolt imaging, however if I continue to run into this issue I'm going to have to use Casper Imaging via another method.
Thanks!
Chris
Solved! Go to Solution.
Posted on 03-19-2015 07:58 AM
I would also try deleting the .Spotlight-V100 at the root of the hard drive.
Posted on 03-19-2015 10:13 AM
I created the following script as I was having the same issues. I worked with Apple Enterprise Support and they couldn't figure it out. After hours and hours trying to figure out the issue I discovered a file on the root of my hard drive labeled metadata_never_index. Hopefully the below script will help you. I named it Bruteforce_Spotlight for a little humor.
sudo rm -f /.metadata_never_index
sudo mdutil -i off /
sudo rm -rf /.Spotlight*
sudo mdutil -i on /
sudo mdutil -E /
Posted on 03-20-2015 09:57 AM
@asegura @davidacland It was a combo of both your suggestions that did it for me. I didn't even have to use any of the mdutil commands. I just ran the following:
sudo -Rf /.Spotlight-V100 /.metadata_never_index
After that I saw the indexing start and I was able to find Applications and files using Spotlight. I'll be adding that script to my imaging list.
Thanks for the suggestions and the help!
Chris
Posted on 03-19-2015 05:43 AM
You could try turning on indexing with eh following command: sudo mdutil -i on
After this you could try running your command again to see if it indexes.
Posted on 03-19-2015 07:58 AM
I would also try deleting the .Spotlight-V100 at the root of the hard drive.
Posted on 03-19-2015 10:13 AM
I created the following script as I was having the same issues. I worked with Apple Enterprise Support and they couldn't figure it out. After hours and hours trying to figure out the issue I discovered a file on the root of my hard drive labeled metadata_never_index. Hopefully the below script will help you. I named it Bruteforce_Spotlight for a little humor.
sudo rm -f /.metadata_never_index
sudo mdutil -i off /
sudo rm -rf /.Spotlight*
sudo mdutil -i on /
sudo mdutil -E /
Posted on 03-19-2015 12:02 PM
Thanks everyone. I'll give these a shot and see if they resolve my issue.
Posted on 03-20-2015 09:57 AM
@asegura @davidacland It was a combo of both your suggestions that did it for me. I didn't even have to use any of the mdutil commands. I just ran the following:
sudo -Rf /.Spotlight-V100 /.metadata_never_index
After that I saw the indexing start and I was able to find Applications and files using Spotlight. I'll be adding that script to my imaging list.
Thanks for the suggestions and the help!
Chris
Posted on 03-20-2015 12:37 PM
I'm having trouble getting an Extension Attribute built to see if ".metadata_never_index" exists. What am I missing? Help is appreciated.
Ed
#!/bin/bash
###
#
# Description: Casper extension attribute that checks whether .metadata_never_index is
# detected.
#
if -a '/.metadata_never_index'
then
resultString=".metadata_never_index detected"
else
resultString=".metadata_never_index not detected"
fi
echo "<result>$resultString</result>"
exit 0
Posted on 03-21-2015 12:40 AM
@elund I normally use -f for this.
Also, the IF LOOP would start like:
if [ -f '/.metadata_never_index' ];
then
There is always this site to double check against
Lastly, if the goal is to remove the file to enable spotlight.. You could add the rm command to the if looop if the file has been found.
Posted on 03-24-2015 06:26 AM
@bentoms Thanks for the help! I appreciate it!
Posted on 05-21-2015 10:53 AM
So I have been experimenting with TMI for our desktop staff (especially with the new MacBooks starting to trickle in) and this had been frequently occurring. The above script works great (actually I had provided those exact instructions to our desktop team on fixing spotlight issues in the past, just didn't occur to me to dump it in a script until seeing this thread) , I did open a support call with our TAM but they reported JAMF wasn't ever able to replicate this issue.
In my case it is not 100% the issue will occur when deploying via TMI, but it only occurs when deploying via TMI.
Posted on 09-01-2015 11:44 AM
I have been trying to find a solution to this issue and I am a bit confused by the previous posts. Which one of these scripts will reestablish Spotlight Search? And am I running these as scripts or executable commands?
Any help will be greatly appreciated.
Posted on 09-01-2015 11:54 AM
In the OP case it was this command that works:
sudo -Rf /.Spotlight-V100 /.metadata_never_index
It can be run from a policy using the 'execute command' section.
Posted on 09-01-2015 11:55 AM
@paulvb I have this set as a script that runs during my imaging process. Note, however, that I have the priority set to "Reboot" so it runs when the machine is running the Post-Imaging processes, like binding to the domain, adding printers, etc.
I'm using this script:
sudo -Rf /.Spotlight-V100 /.metadata_never_index
Let me know if you have any further questions.
Thanks!
Chris
Posted on 09-02-2015 11:38 AM
@Kaltsas We see this only on brand new machines. If we erase the "fresh from Apple" disk with Disk Utility first, we don't see the problem. There's a chance that JAMF can't reproduce because they're using test machines instead of brand new, out of the box items.
Thanks to everyone for the fix - it will save us a step in the TMI process. We had tried removing the .Spotlight-V100 file, but hadn't come across the .metadata_never_index.
Posted on 09-02-2015 12:52 PM
The line that has been shared and posted above is missing the "rm" command.
sudo rm -Rf /.Spotlight-V100 /.metadata_never_index
Posted on 09-20-2015 09:32 AM
Thanks jhalvorson. the rm command was the missing key.