openSuSE 11.0 x86_64 - SQUID - Could not create cache_dir !

OK, quick intro…

I work with Linux basically every day at work, I have a vast array of experience, but do not under any circumstance claim to know everything, or even much in comparison to guru’s out there…

I’ve just rebuild my system, (openSuse11.0 x86_64 / WinXP Dual boot). The XP is only for games :slight_smile:


I think I found a bug with squid, my apologies, I couldn’t find where I should post potential bugs ?

–==( The Problem )==–

I was fiddling with the idea of getting the proxy working for my virtual machine a moment ago, and ran into a problem on the 1st attempt to start it.


# rcsquid start
Starting WWW-proxy squid  (/var/cache/squid) - Could not create cache_dir !
                                                                      failed

–==( The Procedure For A Solution )==–

So naturally, I called for google :slight_smile:
I located a very useful archived article on opensuse forums, which I can’t find anymore :(.
I then ran a test (which the user in the article mentioned):


# rpm -V squid3

## which compares your installation with the original install RPM...
## if executed after a change (e.g. the squid.conf was changed since install)
## you would get (as an example) the following

# rpm -V squid3
S.5....T  c /etc/squid/squid.conf

## indicating which files have changed compared to the original RPM

mine returned nothing (no changes since install).

Ok, so I read the init script (/etc/init.d/squid) and found the following (line 57):

$SQUID_BIN -z -F > /dev/null 2>&1

This creates your cache directory if it doesn’t exists (/var/cache/squid/XX where XX are numbers related to the squid cache structure).
And complains with “Could not create cache_dir !” if it cannot find the “/var/cache/squid” directory which I might add was created and had the squid/root as user/group configuration respectively as per the default installation.

I ran my cache creation parameters for squid… and it returned this output…


# squid -z -F
FATAL: Could not determine fully qualified hostname.  Please set 'visible_hostname'

Squid Cache (Version 3.0.STABLE5): Terminated abnormally.
CPU Usage: 0.028 seconds = 0.004 user + 0.024 sys
Maximum Resident Size: 0 KB
Page faults with physical i/o: 27

Ok, this says BUG (missing default config, OR something not mentioned during install that maybe should be pre-configured or dynamically assigned to the hostname of the system).

so i searched the entry in the conf (/etc/squid/squid.conf) and entered my hostname into it.

–==( Results )==–

I then re-ran the command:


# squid -z -F
2008/08/13 21:55:26| Creating Swap Directories
2008/08/13 21:55:26| /var/cache/squid exists
2008/08/13 21:55:26| Making directories in /var/cache/squid/00
2008/08/13 21:55:26| Making directories in /var/cache/squid/01
2008/08/13 21:55:26| Making directories in /var/cache/squid/02
2008/08/13 21:55:26| Making directories in /var/cache/squid/03
2008/08/13 21:55:26| Making directories in /var/cache/squid/04
2008/08/13 21:55:26| Making directories in /var/cache/squid/05
2008/08/13 21:55:26| Making directories in /var/cache/squid/06
2008/08/13 21:55:26| Making directories in /var/cache/squid/07
2008/08/13 21:55:26| Making directories in /var/cache/squid/08
2008/08/13 21:55:26| Making directories in /var/cache/squid/09
2008/08/13 21:55:26| Making directories in /var/cache/squid/0A
2008/08/13 21:55:26| Making directories in /var/cache/squid/0B
2008/08/13 21:55:26| Making directories in /var/cache/squid/0C
2008/08/13 21:55:26| Making directories in /var/cache/squid/0D
2008/08/13 21:55:26| Making directories in /var/cache/squid/0E
2008/08/13 21:55:26| Making directories in /var/cache/squid/0F

Problem solved… and squid started…

–==( Conclusion )==–

Now as I said before, I am no guru, I merely have no big risk of destroying my system as it is thouroughly backed up, so I can fiddle to my hearts content :slight_smile:

So, I may have done something prior without the knowledge of what it was, which could in turn have effected squid and its start.

Although as I explained, I think I may actually have stumbled across a special circumstance “bug”.

P.S. Please place this post in the correct place if this is not the right place for bug reporting…

Thanks,
FlAreD

Well done.

I think the bug is that the error message suggests one thing but the cause is different. One is supposed to edit squid.conf before using squid. But one would never have guessed that from the error message.

Perhaps the yast2 module for squid ensures that a hostname is available, I’m not sure.