# squid problems [SOLVED]

## Dreadfull2007

curently having problems with squid (yes, i saw someone had the same problem but that topic didn't help)

the problem is that squid/named stop after 10-20 seconds without stating any errors and without writing anything to their log files ..

/var/log/messages says something .. but doesn't help me much

here is 'strace squid -DYC' output:

```

execve("./squid", ["./squid", "-DYC"], [/* 53 vars */]) = 0

brk(0)                                  = 0x8213f94

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f61000

access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)

open("/etc/ld.so.cache", O_RDONLY)      = 3

fstat64(3, {st_mode=S_IFREG|0644, st_size=27037, ...}) = 0

mmap2(NULL, 27037, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f5a000

close(3)                                = 0

open("/lib/libcrypt.so.1", O_RDONLY)    = 3

read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0 \230\266"..., 512) = 512

fstat64(3, {st_mode=S_IFREG|0755, st_size=23812, ...}) = 0

mmap2(0x47b69000, 184636, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x47b69000

mmap2(0x47b6e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4) = 0x47b6e000

mmap2(0x47b70000, 155964, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x47b70000

close(3)                                = 0

open("/lib/libm.so.6", O_RDONLY)        = 3

read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\260#\263"..., 512) = 512

fstat64(3, {st_mode=S_IFREG|0755, st_size=153020, ...}) = 0

mmap2(0x47b2f000, 143488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x47b2f000

mmap2(0x47b51000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x21) = 0x47b51000

close(3)                                = 0

open("/lib/libnsl.so.1", O_RDONLY)      = 3

read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\300E\273"..., 512) = 512

fstat64(3, {st_mode=S_IFREG|0755, st_size=74532, ...}) = 0

mmap2(0x47bb1000, 83752, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x47bb1000

mmap2(0x47bc2000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x10) = 0x47bc2000

mmap2(0x47bc4000, 5928, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x47bc4000

close(3)                                = 0

open("/lib/libc.so.6", O_RDONLY)        = 3

read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0J\271\241"..., 512) = 512

fstat64(3, {st_mode=S_IFREG|0755, st_size=1220600, ...}) = 0

mmap2(0x47a06000, 1181116, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x47a06000

mmap2(0x47b21000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x11b) = 0x47b21000

mmap2(0x47b24000, 9660, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x47b24000

close(3)                                = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f59000

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f58000

set_thread_area({entry_number:-1 -> 6, base_addr:0xb7f586b0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0

mprotect(0x47b21000, 4096, PROT_READ)   = 0

mprotect(0xb7f7d000, 4096, PROT_READ)   = 0

munmap(0xb7f5a000, 27037)               = 0

brk(0)                                  = 0x8213f94

time(NULL)                              = 1177947282

gettimeofday({1177947282, 687901}, NULL) = 0

brk(0x8234f94)                          = 0x8234f94

brk(0x8235000)                          = 0x8235000

open("/usr/local/squid/etc/squid.conf", O_RDONLY) = 3

fstat64(3, {st_mode=S_IFREG|0644, st_size=151420, ...}) = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f60000

read(3, "\n#\tWELCOME TO SQUID 2.6.STABLE12"..., 4096) = 4096

read(3, "o SSL private key file (PEM form"..., 4096) = 4096

read(3, "y passphrases\n#\twhen using encry"..., 4096) = 4096

read(3, "  sourcehash\n#\t\t     name=xxx\n#\t"..., 4096) = 4096

read(3, "y open to this peer.\n#\n#\t\t     u"..., 4096) = 4096

read(3, "tend in front\n#\t\t     of Microso"..., 4096) = 4096

read(3, "han this timeout, you\n#\twill see"..., 4096) = 4096

read(3, ".\n#\n#\tNOTE: if using the LFUDA r"..., 4096) = 4096

read(3, "s the amount of disk space (MB) "..., 4096) = 4096

read(3, "ory).  In order to try \n#\tand ma"..., 4096) = 4096

read(3, "log\n#\tLogs the activities of the"..., 4096) = 4096

read(3, " on if you wish to log fully qua"..., 4096) = 4096

read(3, "mes\ton|off\n#\tNormally the RES_DE"..., 4096) = 4096

read(3, "\n#\tprocess, so be careful if you"..., 4096) = 4096

read(3, "Then, set this line to something"..., 4096) = 4096

read(3, "word).\n#\tauth_param digest realm"..., 4096) = 4096

read(3, "param negotiate keep_alive on\n#a"..., 4096) = 4096

read(3, "ult syntax:\n#\n#\t  OK/ERR keyword"..., 4096) = 4096

read(3, "nty of servers \n#\t\tsend it anywa"..., 4096) = 4096

read(3, "nables multiple requests for the"..., 4096) = 4096

read(3, "rvice by having\n#\tmany ident req"..., 4096) = 4096

read(3, "\t  #\n#\t  # WARNING: proxy_auth c"..., 4096) = 4096

read(3, " the original source of a reques"..., 4096) = 4096

read(3, "ess from your local networks. Ad"..., 4096) = 4096

read(3, "255.255.0\n#\tacl good_service_net"..., 4096) = 4096

read(3, "er\n\n#  TAG: mail_from\n#\tFrom: em"..., 4096) = 4096

read(3, "ACCELERATOR OPTIONS\n# ----------"..., 4096) = 4096

read(3, "#\n#\tYou may use ERR_ pages that "..., 4096) = 4096

read(3, "ble\".\n#\tTo allow performing an a"..., 4096) = 4096

read(3, "ake the client forward the reque"..., 4096) = 4096

read(3, "are normally kept in\n#\t/usr/loca"..., 4096) = 4096

read(3, "WCCPv2 routers\n#\n#\tonly one of t"..., 4096) = 4096

read(3, " of the destination\n#\thash propo"..., 4096) = 4096

read(3, "kbps\n#\t(plus overheads), with no"..., 4096) = 4096

read(3, "\n# Note: This option is only ava"..., 4096) = 4096

read(3, "G: digest_rebuild_period\t(second"..., 4096) = 4096

read(3, "d prints a WARNING with debug le"..., 4096) = 3964

read(3, "", 4096)                       = 0

close(3)                                = 0

munmap(0xb7f60000, 4096)                = 0

stat64("/usr/local/squid/var/cache", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

uname({sys="Linux", node="csworld.ro", ...}) = 0

getpid()                                = 19389

open("/etc/resolv.conf", O_RDONLY)      = 3

fstat64(3, {st_mode=S_IFREG|0644, st_size=98, ...}) = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f60000

read(3, "nameserver 85.204.153.2\nnameserv"..., 4096) = 98

read(3, "", 4096)                       = 0

close(3)                                = 0

munmap(0xb7f60000, 4096)                = 0

uname({sys="Linux", node="csworld.ro", ...}) = 0

socket(PF_FILE, SOCK_STREAM, 0)         = 3

fcntl64(3, F_GETFL)                     = 0x2 (flags O_RDWR)

fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK)  = 0

connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = 0

poll([{fd=3, events=POLLOUT|POLLERR|POLLHUP, revents=POLLOUT}], 1, 5000) = 1

send(3, "\2\0\0\0\r\0\0\0\6\0\0\0hosts\0\323\277", 20, MSG_NOSIGNAL) = 20

poll([{fd=3, events=POLLIN|POLLERR|POLLHUP, revents=POLLIN|POLLERR|POLLHUP}], 1, 5000) = 1

recvmsg(3, 0xbfd38fe4, 0)               = -1 ECONNRESET (Connection reset by peer)

close(3)                                = 0

socket(PF_FILE, SOCK_STREAM, 0)         = 3

fcntl64(3, F_GETFL)                     = 0x2 (flags O_RDWR)

fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK)  = 0

connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = 0

poll([{fd=3, events=POLLOUT|POLLERR|POLLHUP, revents=POLLOUT}], 1, 5000) = 1

writev(3, [{"\2\0\0\0\4\0\0\0\v\0\0\0", 12}, {"csworld.ro\0", 11}], 2) = 23

poll([{fd=3, events=POLLIN|POLLERR|POLLHUP, revents=POLLIN|POLLHUP}], 1, 5000) = 1

read(3, "\2\0\0\0\1\0\0\0\20\0\0\0\3\0\0\0\2\0\0\0\4\0\0\0\1\0\0"..., 32) = 32

readv(3, [{"srv1.csworld.ro\0", 16}, {"\5\0\0\0\v\0\0\0\17\0\0\0", 12}, {"Y%][", 4}], 3) = 32

read(3, "srv1\0csworld.ro\0cw1.csworld.ro\0", 31) = 31

close(3)                                = 0

stat64("/usr/local/squid/etc/mime.conf", {st_mode=S_IFREG|0644, st_size=11651, ...}) = 0

stat64("/usr/local/squid/libexec/unlinkd", {st_mode=S_IFREG|0755, st_size=9384, ...}) = 0

stat64("/usr/local/squid/share/icons", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

stat64("/usr/local/squid/share/errors/English", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

geteuid32()                             = 0

socket(PF_FILE, SOCK_STREAM, 0)         = 3

fcntl64(3, F_GETFL)                     = 0x2 (flags O_RDWR)

fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK)  = 0

connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = 0

poll([{fd=3, events=POLLOUT|POLLERR|POLLHUP, revents=POLLOUT}], 1, 5000) = 1

send(3, "\2\0\0\0\v\0\0\0\7\0\0\0passwd\0\0", 20, MSG_NOSIGNAL) = 20

poll([{fd=3, events=POLLIN|POLLERR|POLLHUP, revents=POLLIN|POLLERR|POLLHUP}], 1, 5000) = 1

recvmsg(3, 0xbfd39088, 0)               = -1 ECONNRESET (Connection reset by peer)

close(3)                                = 0

socket(PF_FILE, SOCK_STREAM, 0)         = 3

fcntl64(3, F_GETFL)                     = 0x2 (flags O_RDWR)

fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK)  = 0

connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = 0

poll([{fd=3, events=POLLOUT|POLLERR|POLLHUP, revents=POLLOUT}], 1, 5000) = 1

writev(3, [{"\2\0\0\0\0\0\0\0\7\0\0\0", 12}, {"nobody\0", 7}], 2) = 19

poll([{fd=3, events=POLLIN|POLLERR|POLLHUP, revents=POLLIN|POLLHUP}], 1, 5000) = 1

read(3, "\2\0\0\0\1\0\0\0\7\0\0\0\2\0\0\0\376\377\0\0\376\377\0"..., 36) = 36

read(3, "nobody\0x\0nobody\0/\0/bin/false\0", 29) = 29

close(3)                                = 0

umask(027)                              = 022

umask(027)                              = 027

open("/usr/local/squid/var/logs/squid.pid", O_RDONLY) = -1 ENOENT (No such file or directory)

prctl(0x4, 0x1, 0, 0, 0)                = 0

getrlimit(RLIMIT_CORE, {rlim_cur=0, rlim_max=RLIM_INFINITY}) = 0

setrlimit(RLIMIT_CORE, {rlim_cur=RLIM_INFINITY, rlim_max=RLIM_INFINITY}) = 0

socket(PF_FILE, SOCK_DGRAM, 0)          = 3

fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0

connect(3, {sa_family=AF_FILE, path="/dev/log"}, 110) = -1 EPROTOTYPE (Protocol wrong type for socket)

close(3)                                = 0

socket(PF_FILE, SOCK_STREAM, 0)         = 3

fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0

connect(3, {sa_family=AF_FILE, path="/dev/log"}, 110) = 0

clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7f586f8) = 18007

exit_group(0)                           = ?

Process 19389 detached

```

also this is what i found in /var/log/messages:

```

Apr 30 18:40:52 csworld squid[29533]: Squid Parent: child process 3174 started

Apr 30 18:40:52 csworld squid[29533]: Squid Parent: child process 3174 exited due to signal 6

Apr 30 18:40:52 csworld squid[29533]: Exiting due to repeated, frequent failures

```

i manually installed squid from squid-cache.org and that one worked ..

so .. any ideas ? i used cache_effective_user nobody and ran chown -R nobody /var/log/squid and /var/run/squid.pid and /var/cache/squid .. am i missing anything ?! the original squid had the same problem till i fixed the file permissions (yes, the same chown commands i posted above)Last edited by Dreadfull2007 on Wed May 02, 2007 7:13 am; edited 1 time in total

----------

## di1bert

It seems squid is looking for it's PID file in the wrong place...

 *Quote:*   

> 
> 
> open("/usr/local/squid/var/logs/squid.pid", O_RDONLY) = -1 ENOENT (No such file or directory) 
> 
> 

 

Perhaps try running 

```

squid -DNsYd 5

```

and check the output from there. It looks to me like it may just be a simple problem

with your configuration file. 

Start with that and let me know how you get one....

-m

----------

## Dreadfull2007

```

WARNING: Cannot write log file: /var/log/squid/cache.log

/var/log/squid/cache.log: Permission denied

         messages will be sent to 'stderr'.

2007/05/01 17:26:27| WARNING: Closing open FD    2

2007/05/01 17:26:27| Starting Squid Cache version 2.6.STABLE12 for i686-pc-linux-gnu...

2007/05/01 17:26:27| Process ID 25062

2007/05/01 17:26:27| With 1024 file descriptors available

2007/05/01 17:26:27| Using epoll for the IO loop

2007/05/01 17:26:27| DNS Socket created at 0.0.0.0, port 32808, FD 5

2007/05/01 17:26:27| Adding nameserver 85.204.153.2 from /etc/resolv.conf

2007/05/01 17:26:27| Adding nameserver 85.204.152.2 from /etc/resolv.conf

2007/05/01 17:26:27| Adding nameserver 193.19.192.15 from /etc/resolv.conf

2007/05/01 17:26:27| Adding nameserver 193.19.192.16 from /etc/resolv.conf

2007/05/01 17:26:27| User-Agent logging is disabled.

2007/05/01 17:26:27| Referer logging is disabled.

FATAL: Cannot open '/var/log/squid/access.log' for writing.

        The parent directory must be writeable by the

        user 'nobody', which is the cache_effective_user

        set in squid.conf.

Squid Cache (Version 2.6.STABLE12): Terminated abnormally.

CPU Usage: 0.012 seconds = 0.012 user + 0.000 sys

Maximum Resident Size: 0 KB

Page faults with physical i/o: 0

Aborted (core dumped)

```

in /var/log:

```

drwxr-sr-x  2 nobody      4096 2007-04-30 18:50 squid/

```

i don't get it .. permissions are ok ..

----------

## di1bert

That is a little weird.

Have you checked the permissions inside the /var/log/squid directory ?

I've had that issue every now and again. Can't recall what I did to fix it though.

Have you created your cache directory with: 

```
squid -z
```

-m

----------

## Dreadfull2007

yes i did create

ls la /var/log/squid:

```

drwxr-sr-x  2 nobody  4096 2007-04-30 18:50 ./

drwxrws--- 12 portage 4096 2007-05-01 03:10 ../

-rwxrwxrwx  1 nobody     0 2007-04-30 18:50 access.log*

```

----------

## di1bert

Did you create your cache.log as well ?

 *Quote:*   

> 
> 
> WARNING: Cannot write log file: /var/log/squid/cache.log 
> 
> 

 

-m

----------

## Dreadfull2007

```

/var/log/squid/cache.log: Permission denied

         messages will be sent to 'stderr'.

2007/05/01 20:48:04| WARNING: Closing open FD    2

2007/05/01 20:48:04| Starting Squid Cache version 2.6.STABLE12 for i686-pc-linux-gnu...

2007/05/01 20:48:04| Process ID 14525

2007/05/01 20:48:04| With 1024 file descriptors available

2007/05/01 20:48:04| Using epoll for the IO loop

2007/05/01 20:48:04| DNS Socket created at 0.0.0.0, port 32813, FD 5

2007/05/01 20:48:04| Adding nameserver 85.204.153.2 from /etc/resolv.conf

2007/05/01 20:48:04| Adding nameserver 85.204.152.2 from /etc/resolv.conf

2007/05/01 20:48:04| Adding nameserver 193.19.192.15 from /etc/resolv.conf

2007/05/01 20:48:04| Adding nameserver 193.19.192.16 from /etc/resolv.conf

2007/05/01 20:48:04| User-Agent logging is disabled.

2007/05/01 20:48:04| Referer logging is disabled.

FATAL: Cannot open '/var/log/squid/access.log' for writing.

        The parent directory must be writeable by the

        user 'nobody', which is the cache_effective_user

        set in squid.conf.

Squid Cache (Version 2.6.STABLE12): Terminated abnormally.

CPU Usage: 0.012 seconds = 0.008 user + 0.004 sys

Maximum Resident Size: 0 KB

Page faults with physical i/o: 0

Aborted

```

```

-rwxrwxrwx  1 nobody        0 2007-04-30 18:50 access.log*

-rwxrwxrwx  1 nobody        0 2007-05-01 20:47 cache.log*

-rw-------  1 nobody  2469888 2007-05-01 20:47 core

-rwxrwxrwx  1 nobody        0 2007-05-01 20:47 store.log*

```

i just don't get it, tryied with user 'squid' too but .. same ..

----------

## di1bert

Seeing as it's still a permissions problem and we're certain of the permissions 

of /var/log/squid and it's files I would check that the "nobody" user has

permissions on each directory leading up to /var/log/squid.

Failing that try increasing the debugging output and see if that helps.

I have to admit I'm a little stumped on this one as well...

-m

----------

## Dreadfull2007

well /var/log is owned by portage user.

----------

## Hu

Try running chown root:root /var/log ; chmod 755 /var/log.

----------

## Dreadfull2007

thanks, that did the work  :Smile:  many many thanks

----------

