Problems with Squid3 on Ubuntu Feisty Fawn
Sunday, September 2nd, 2007I have a machine which is running an up-to-date Ubuntu Feisty Fawn installation on which I wanted to run Squid. Installing it was a snap - just run sudo apt-get install squid3, and you’re set … or are you? Trying to use the proxy I get an unexpected "Connection refused" message. Investigating a bit further, I see that there’s nothing listening on port 3128 (the default Squid port), nor is Squid runninng. Strange! /var/log/messages reveals a string of messages of the following form:
squid[18518]: Squid Parent: child process 18536 started
squid[18518]: Squid Parent: child process 18536 exited due to signal 6
After a few tries, Squid just dies. /var/log/squid/cache.log contains only
Creating Swap Directories
/var/spool/squid3 exists
Making directories in /var/spool/squid3/00
Making directories in /var/spool/squid3/01
Making directories in /var/spool/squid3/02
Making directories in /var/spool/squid3/03
Making directories in /var/spool/squid3/04
Making directories in /var/spool/squid3/05
Making directories in /var/spool/squid3/06
Making directories in /var/spool/squid3/07
Making directories in /var/spool/squid3/08
Making directories in /var/spool/squid3/09
Making directories in /var/spool/squid3/0A
Making directories in /var/spool/squid3/0B
Making directories in /var/spool/squid3/0C
Making directories in /var/spool/squid3/0D
Making directories in /var/spool/squid3/0E
Making directories in /var/spool/squid3/0F
Squid had no problems starting and doing some initial housekeeping before stumbling. Running squid3 -d 10 produced a ton of debug output, but also this telling error message:
FATAL: Cannot open '/var/log/squid3/access.log' for writing.
The parent directory must be writeable by the
user 'proxy', which is the cache_effective_user
set in squid.conf.
Ah ha! The default Ubuntu-packaged Squid (3.0.PRE5-5 with MD5sum d11df3af2e309f5b989a520e3cd50d55) is configured to run as the user ‘proxy’, but the associated log-directories are not writable by the user ‘proxy’. That’s easy enough to solve.
cd /var/log/squid3
sudo chown proxy cache.log .
sudo /etc/init.d/squid3 start
This time Squid was able to start successfully. Another few seconds were needed to configure the proper ACLs, but after that and a Squid restart later, we’re good to go!