Go Back   The macosxhints Forums > OS X Help Requests > UNIX - General



Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Old 04-08-2008, 12:46 PM   #1
derekhed
All Star
 
Join Date: Mar 2002
Location: Anchorage, AK
Posts: 762
Question locate.updatedb isn't

I am not sure when this started happening, but I am no longer able to use locate (or 'which' for that matter).

When I run the binary directly, I get this:
derekhed$ ./locate.updatedb
./locate.updatedb: line 89: /var/db/locate.database: Permission denied

The code around line 89 is:
Code:
then
	case X"`$find $tmp -size -257c -print`" in
		X) cat $tmp > $FCODES;;
		*) echo "updatedb: locate database $tmp is empty"
		   exit 1
	esac
fi
I have no idea where to start to fix this. Any help would be appreciated.

Thanks!
__________________
...if only you could see what I've seen with your eyes.
- Batty, Blade Runner

They all float down here...
derekhed is offline   Reply With Quote
Old 04-08-2008, 01:46 PM   #2
ashevin
Triple-A Player
 
Join Date: Jan 2002
Posts: 158
Somehow your username no longer has access to the locate database. Please provide the output of:

Code:
 ls -l /var/db/locate.database
along with the username you're trying to access it as. In addition, the output of the groups command would be helpful.
ashevin is offline   Reply With Quote
Old 04-08-2008, 02:47 PM   #3
derekhed
All Star
 
Join Date: Mar 2002
Location: Anchorage, AK
Posts: 762
Thanks for replying.

derekhed$ ls -l /var/db/locate.database
-r--r--r-- 1 nobody wheel 256 Apr 3 16:00 /var/db/locate.database

derekhed$ groups
derekhed appserveradm appserverusr admin

So it looks like I am not a member of the 'wheel' group, but I am not sure what user is actually running the weekly cron job that rebuilds the locatedb anyway...

I am using XJanitor as this is a laptop. I have an entry in:
/var/cron/tabs/root

That looks like this:
*/15 * * * * /Users/derekhed/scripts/XJanitor.pl

Three questions:
1. Why can't I run this myself from the Terminal?
2. Why isn't it being run from the weekly cron task?
3. Is XJanitor messing things up somehow?
__________________
...if only you could see what I've seen with your eyes.
- Batty, Blade Runner

They all float down here...
derekhed is offline   Reply With Quote
Old 04-08-2008, 04:59 PM   #4
hucklebuck
Prospect
 
Join Date: Jun 2004
Posts: 21
Quote:
Originally Posted by derekhed

When I run the binary directly, I get this:
derekhed$ ./locate.updatedb
./locate.updatedb: line 89: /var/db/locate.database: Permission denied

hi derekhed,

if you look at the periodic weekly code at:

/etc/periodic/weekly/310.locate

you'll see that the locate.updatedb facility is run as user nobody (su -fm nobody)

so, try:

Code:
 $ sudo periodic weekly
to get the db rebuilt
hucklebuck is offline   Reply With Quote
Old 04-08-2008, 06:54 PM   #5
derekhed
All Star
 
Join Date: Mar 2002
Location: Anchorage, AK
Posts: 762
Running the periodic command worked, thanks.

Still not sure why XJanitor isn't getting the job done, but the latest thing I can google on it is from 2003...
__________________
...if only you could see what I've seen with your eyes.
- Batty, Blade Runner

They all float down here...
derekhed is offline   Reply With Quote
Old 04-08-2008, 07:56 PM   #6
Hal Itosis
Hall of Famer
 
Join Date: Apr 2002
Posts: 3,315
Quote:
Originally Posted by derekhed
derekhed$ ls -l /var/db/locate.database
-r--r--r-- 1 nobody wheel 256 Apr 3 16:00 /var/db/locate.database

derekhed$ groups
derekhed appserveradm appserverusr admin

So it looks like I am not a member of the 'wheel' group,

So? There is a third "r" there, allowing *anyone* to read it.
[Hmm... someone posted a wheel-related 'hint' this week.]

Anyway, 256 bytes is too small. That weekly task hasn't run properly yet.

Here's mine:
Code:

ls -lh /var/db/locate.database
-r--r--r--  1 nobody  wheel   7.8M Apr  5 03:19 /var/db/locate.database
It's read-only for a reason. The script that manages it must simply add
write privs when it runs (and turns them off when it's done).

Anyway -- as I guess you learned -- we mortal users were never meant
to run /usr/libexec/locate.updatedb directly. [though... it mighta worked
if you hadda used sudo.]

-HI-
Hal Itosis is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 05:51 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.