Bug 145455 - Any cache_dir other than /var/spool/squi breaks squid
Any cache_dir other than /var/spool/squi breaks squid
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: squid (Show other bugs)
3
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jay Fenlason
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-01-18 12:27 EST by Nick
Modified: 2014-08-31 19:27 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-01-19 03:54:40 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Nick 2005-01-18 12:27:03 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5)
Gecko/20041107 Internet Explorer/6.0

Description of problem:
squid can't use another cache_dir.

squid -z will not work with cache_dir other than /var/spool/squid
/etc/rc.d/init.d/squid start will not work either (assuming cache
already exists).

Works fine with default cache_dir.

Can't initialise cache; can't use cache after machine migrated from FC2. 

Version-Release number of selected component (if applicable):
squid-2.5.STABLE6-3

How reproducible:
Always

Steps to Reproduce:
1.
cd /etc/squid
2.
Add the lines:

cache_dir ufs /var/spool/squid 100 16 256
cache_dir ufs /var/spool/squid2 100 16 256

to squid.conf
3.
    # mkdir /var/spool/squid2 
# chown squid:squid /var/spool/squid2 
# chmod 750 /var/spool/squid2 
# strace -f squid -z > /tmp/squid-z.strace 2>&1
# ls -la /var/spool/squid2 
total 16
drwxr-x---   2 squid squid 4096 Jan 18 17:13 .
drwxr-xr-x  28 root  root  4096 Jan 18 17:13 ..
# ls -la /var/spool/squid | head -5
total 144
drwxr-x---   18 squid squid 4096 Jan 18 17:14 .
drwxr-xr-x   28 root  root  4096 Jan 18 17:13 ..
drwxr-xr-x  258 squid squid 4096 Jan 18 17:14 00
drwxr-xr-x  258 squid squid 4096 Jan 18 17:14 01


Actual Results:  cache created in /var/spool/squid but not in
/var/spool/squid2

Expected Results:  cache created in both /var/spool/squid and
/var/spool/squid2

Additional info:

Any cache_dir (in squid.conf) other than /var/spool/squid does not work.

e.g. using:

cache_dir ufs /var/spool/squid 100 16 256
cache_dir ufs /var/spool/squid2 100 16 256

then:

mkdir /var/spool/squid2
chown squid:squid /var/spool/squid2
chmod 750 /var/spool/squid2
strace -f squid -z > /tmp/squid-z.strace 2>&1

from the strace file:

[pid  7688] stat64("/var/spool/squid2", Process 7690 attached
 <unfinished ...>
[pid  7686] <... clone resumed> child_stack=0,
flags=CLONE_CHILD_CLEARTID|CLONE_
CHILD_SETTID|SIGCHLD, child_tidptr=0xb7fda708) = 7690
[pid  7687] <... stat64 resumed> {st_mode=S_IFDIR|0750, st_size=4096,
...}) = 0
[pid  7688] <... stat64 resumed> 0xbffc19f0) = -1 EACCES (Permission
denied)
[pid  7686] waitpid(-1, Process 7686 suspended
 <unfinished ...>
[pid  7687] gettimeofday( <unfinished ...>
[pid  7688] mkdir("/var/spool/squid2", 0755 <unfinished ...>
[pid  7687] <... gettimeofday resumed> {1106066886, 101618}, NULL) = 0
[pid  7688] <... mkdir resumed> )       = -1 EEXIST (File exists)
[pid  7687] stat64("/var/spool/squid/00",  <unfinished ...>
[pid  7688] time( <unfinished ...>
[pid  7687] <... stat64 resumed> 0xbffc19f0) = -1 ENOENT (No such file
or direct
ory)
[pid  7688] <... time resumed> [1106066886]) = 1106066886
[pid  7688] stat64("/etc/localtime",  <unfinished ...>
[pid  7687] mkdir("/var/spool/squid/00", 0755 <unfinished ...>
[pid  7688] <... stat64 resumed> {st_mode=S_IFREG|0644, st_size=1323,
...}) = 0
[pid  7687] <... mkdir resumed> )       = 0
[pid  7688] stat64("/etc/localtime",  <unfinished ...>
[pid  7687] gettimeofday( <unfinished ...>
[pid  7688] <... stat64 resumed> {st_mode=S_IFREG|0644, st_size=1323,
...}) = 0
[pid  7687] <... gettimeofday resumed> {1106066886, 103994}, NULL) = 0
[pid  7688] stat64("/etc/localtime",  <unfinished ...>
[pid  7687] stat64("/var/spool/squid/00/00",  <unfinished ...>
[pid  7688] <... stat64 resumed> {st_mode=S_IFREG|0644, st_size=1323,
...}) = 0
[pid  7687] <... stat64 resumed> 0xbffc19f0) = -1 ENOENT (No such file
or direct
ory)
[pid  7688] rt_sigaction(SIGPIPE, {0x78b150, [], SA_RESTORER,
0x6efa48},  <unfin
ished ...>
[pid  7687] mkdir("/var/spool/squid/00/00", 0755 <unfinished ...>
[pid  7688] <... rt_sigaction resumed> {SIG_DFL}, 8) = 0


... the cache gets initialised in /var/spool/squid OK, but not in
/var/spool/squid2

I had a (working) cache on a machine with FC2, newinstalled to FC3,
squid did not work but I blew away the cache.

Same error with only one cache_dir entry.

Works fine with no cache_dir entry or only one entry of the default
/var/spool/squid
Comment 1 Nick 2005-01-19 03:53:56 EST
Oops, there's nothing wrong with squid, it's just selinux needs
configuring for the changed directories. I got it working like this:

After starting squid

# audit2allow -i /var/log/messages -l

If there is any output,

# cd /etc/selinux/targeted/src/policy
# audit2allow -i /var/log/messages -l >>
/etc/selinux/targeted/src/policy/domains/misc/local.te
# make reload

Repeat until squid starts cleanly.

Note You need to log in before you can comment on or make changes to this bug.