LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-14-2008, 03:40 AM   #1
sohailkmu
Member
 
Registered: Oct 2008
Posts: 82
Blog Entries: 1

Rep: Reputation: 15
problem with cache_dir in squid


I changed the cache_dir in squid.conf and restart squid, but it failed to start. However as i set the cache_dir to the default it starts.

I have made two partitions to store cache i.e /cache1 and /Cache2 of about 20gb space,

now as i do the following changes

cache_dir ufs /Cache1/squid 18000 16 256
cache_dir ufs /Cache2/squid 18000 16 256

then squid doesnot start.
and as i comment the above statement(i.e. setting the cache to default /var/spool/squid 100 16 256) it starts working. plz help me to change the cache_dir.... what error i am doing.
kindly guide

Last edited by sohailkmu; 10-14-2008 at 03:43 AM.
 
Old 10-14-2008, 07:58 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,520

Rep: Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502
After changing the cache_dir location you should run
Code:
squid -z
for the 1st time, to create the cache directories. Note that those dirs (/Cache1/squid, /Cache2/squid) should exist and owned by the user that runs squid.

Regards
 
Old 10-15-2008, 01:24 AM   #3
sohailkmu
Member
 
Registered: Oct 2008
Posts: 82
Blog Entries: 1

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bathory View Post
After changing the cache_dir location you should run
Code:
squid -z
for the 1st time, to create the cache directories. Note that those dirs (/Cache1/squid, /Cache2/squid) should exist and owned by the user that runs squid.

Regards
Thanks a lot for your quick response

I have tried but still it is not working.
 
Old 10-15-2008, 02:45 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,520

Rep: Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502
What error do you get? Check the logfiles to see if you find out why squid does not start.
What is the output of:
Code:
ls -l /Cache1/squid 
ls -l /Cache2/squid
 
Old 10-15-2008, 10:35 AM   #5
landysaccount
Member
 
Registered: Sep 2008
Location: Dominican Republic
Distribution: Debian
Posts: 188

Rep: Reputation: 18
Make sure that the new directory's owner is the same as the owner running squid, usually proxy. I had a similar problem like that.

chown proxy <dirname>

Hope that helps.
 
Old 10-16-2008, 02:24 AM   #6
sohailkmu
Member
 
Registered: Oct 2008
Posts: 82
Blog Entries: 1

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bathory View Post
What error do you get? Check the logfiles to see if you find out why squid does not start.
What is the output of:
Code:
ls -l /Cache1/squid 
ls -l /Cache2/squid

This is the output of cache.log when I changed the cache_dir.

2008/10/16 12:18:35| Starting Squid Cache version 2.5.STABLE6 for i386-redhat-linux-gnu...
2008/10/16 12:18:35| Process ID 3936
2008/10/16 12:18:35| With 1024 file descriptors available
2008/10/16 12:18:35| DNS Socket created at 0.0.0.0, port 32771, FD 4
2008/10/16 12:18:35| Adding nameserver 202.147.176.40 from /etc/resolv.conf
2008/10/16 12:18:35| Adding nameserver 202.147.176.41 from /etc/resolv.conf
2008/10/16 12:18:35| User-Agent logging is disabled.
2008/10/16 12:18:35| Referer logging is disabled.
2008/10/16 12:18:35| Unlinkd pipe opened on FD 9
2008/10/16 12:18:35| Swap maxSize 36864000 KB, estimated 2835692 objects
2008/10/16 12:18:35| Target number of buckets: 141784
2008/10/16 12:18:35| Using 262144 Store buckets
2008/10/16 12:18:35| Max Mem size: 524288 KB
2008/10/16 12:18:35| Max Swap size: 36864000 KB
2008/10/16 12:18:35| /Cache1/squid: (13) Permission denied
FATAL: Failed to verify one of the swap directories, Check cache.log
for details. Run 'squid -z' to create swap directories
if needed, or if running Squid for the first time.
Squid Cache (Version 2.5.STABLE6): Terminated abnormally.
CPU Usage: 0.012 seconds = 0.005 user + 0.007 sys
Maximum Resident Size: 0 KB
Page faults with physical i/o: 0


The output of ls -l is given below:


ls -l /Cache1/squid
total 128
drwxr-xr-x 258 squid squid 4096 Oct 9 10:53 00
drwxr-xr-x 258 squid squid 4096 Oct 9 10:53 01
drwxr-xr-x 258 squid squid 4096 Oct 9 10:53 02
drwxr-xr-x 258 squid squid 4096 Oct 9 10:53 03
drwxr-xr-x 258 squid squid 4096 Oct 9 10:53 04
drwxr-xr-x 258 squid squid 4096 Oct 9 10:53 05
drwxr-xr-x 258 squid squid 4096 Oct 9 10:53 06
drwxr-xr-x 258 squid squid 4096 Oct 9 10:53 07
drwxr-xr-x 258 squid squid 4096 Oct 9 10:53 08
drwxr-xr-x 258 squid squid 4096 Oct 9 10:53 09
drwxr-xr-x 258 squid squid 4096 Oct 9 10:53 0A
drwxr-xr-x 258 squid squid 4096 Oct 9 10:53 0B
drwxr-xr-x 258 squid squid 4096 Oct 9 10:53 0C
drwxr-xr-x 258 squid squid 4096 Oct 9 10:53 0D
drwxr-xr-x 258 squid squid 4096 Oct 9 10:53 0E
drwxr-xr-x 258 squid squid 4096 Oct 9 10:53 0F

In the light of the above output please guide me.

Thanks
 
Old 10-16-2008, 02:47 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,520

Rep: Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502
The cache.log you've posted is from when you're trying to start squid normally. I suggest you to delete the swap dirs and start over:
Code:
rm -rf /Cache1
mkdir -p /Cache1/squid
chown -R squid:squid /Cache1
squid -z
After that try to start squid normally.
From the logfile I see that you run Redhat. Check if it's not a SELinux problem

Last edited by bathory; 10-16-2008 at 02:51 AM.
 
Old 10-16-2008, 04:56 AM   #8
sohailkmu
Member
 
Registered: Oct 2008
Posts: 82
Blog Entries: 1

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bathory View Post
The cache.log you've posted is from when you're trying to start squid normally. I suggest you to delete the swap dirs and start over:
Code:
rm -rf /Cache1
mkdir -p /Cache1/squid
chown -R squid:squid /Cache1
squid -z
After that try to start squid normally.
From the logfile I see that you run Redhat. Check if it's not a SELinux problem
Thanks a lot for your quick response

Actually /Cache1 and /Cache2 are the partitions created at the time of installation of redhat linux and the squid directory was created later on in both the partitions.

when I run squid -z it gives OK report. but then it fails to stop or start.

The permissions were set both to root user and squid but in vain.

Any further guidance will be highly appreciated.
 
Old 10-16-2008, 05:30 AM   #9
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,520

Rep: Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502
Are you sure it's not a SELinux problem?
If I was you, I would delete those dirs and recreate them with the above procedure. Just make sure there is nothing else under /Cache1 /Cache2 and that squid is not running.

Last edited by bathory; 10-16-2008 at 06:43 AM.
 
Old 10-17-2008, 12:39 AM   #10
sohailkmu
Member
 
Registered: Oct 2008
Posts: 82
Blog Entries: 1

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bathory View Post
Are you sure it's not a SELinux problem?
If I was you, I would delete those dirs and recreate them with the above procedure. Just make sure there is nothing else under /Cache1 /Cache2 and that squid is not running.
I am trying the commands but it is giving the following error messages

rm -rf /Cache1
rm: cannot remove directory `/Cache1': Device or resource busy

please help me.
 
Old 10-17-2008, 12:49 AM   #11
shahz
Member
 
Registered: Sep 2006
Location: Quetta, Pakistan
Distribution: RHEL 4
Posts: 363

Rep: Reputation: 29
don't make any dircectory within the cache1 partition and if you running the default squid which shiped with the OS I don't think changing directory for cache will work with that defaul squid package try to get a new squid download from

www.squid-cache.org

then install the package and give your cache path from the squid.conf,

I hope it will work.

thanks
shahz
 
Old 10-17-2008, 01:45 AM   #12
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,520

Rep: Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502
Quote:
rm: cannot remove directory `/Cache1': Device or resource busy
How do you mount this partition? squid user must have r/w permissions on it. Please post /etc/fstab.
 
Old 10-17-2008, 11:47 PM   #13
sohailkmu
Member
 
Registered: Oct 2008
Posts: 82
Blog Entries: 1

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bathory View Post
How do you mount this partition? squid user must have r/w permissions on it. Please post /etc/fstab.

Output of vi /etc/fstab

# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/ / ext3 defaults 1 1
LABEL=/Cache1 /Cache1 ext3 defaults 1 2
LABEL=/Cache2 /Cache2 ext3 defaults 1 2
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
LABEL=/home /home ext3 defaults 1 2
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
LABEL=/tmp /tmp ext3 defaults 1 2
LABEL=/usr /usr ext3 defaults 1 2
LABEL=/var /var ext3 defaults 1 2
LABEL=SWAP-sda11 swap swap defaults 0 0
/dev/hda /media/cdrecorder auto pamconsole,fscontext=system_ubject_r:removable_t,exec,noauto,managed 0 0
/dev/fd0 /media/floppy auto pamconsole,fscontext=system_ubject_r:removable_t,exec,noauto,managed 0 0
~
~
 
Old 10-18-2008, 01:15 AM   #14
shahz
Member
 
Registered: Sep 2006
Location: Quetta, Pakistan
Distribution: RHEL 4
Posts: 363

Rep: Reputation: 29
when you are within the partition/directory you can't remove direcotry. umount the partition and then remove the direcotry.


thanks
shahz
 
Old 10-18-2008, 10:55 AM   #15
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,520

Rep: Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502Reputation: 1502
Ok, don't delete /Cache1, delete /Cache1/squid, recreate it and try again:
Code:
rm -rf /Cache1/squid
mkdir /Cache1/squid
chown squid.squid /Cache1/squid
squid -z
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
FATAL: Bungled squid.conf line 10: cache_dir diskd /cache1/cache 5000 16 256 shoaibrehman Linux - Newbie 1 07-20-2008 11:02 AM
Changing default cache_dir on squid3 not working pliqui Linux - Software 3 12-12-2007 04:37 PM
Squid Problem ajkannan83 Linux - Software 2 10-21-2005 10:48 AM
squid problem supon Linux - Networking 0 10-05-2004 11:24 AM
Squid Problem !!!!! baye Linux - General 4 09-09-2004 02:09 PM


All times are GMT -5. The time now is 12:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration