Re: [squid-users] Squid cannot start because it "can't open 'on' for writing..."

From: Marcello Romani <mromani@dont-contact.us>
Date: Mon, 11 Dec 2006 17:53:02 +0100

dhottinger@harrisonburg.k12.va.us ha scritto:
> Quoting Marcello Romani <mromani@ottotecnica.com>:
>
>> dhottinger@harrisonburg.k12.va.us ha scritto:
>>> Quoting Marcello Romani <mromani@ottotecnica.com>:
>>>
>>>> Hi,
>>>> I'm having a strange problem with squid.
>>>> When I stop and restart the program, it fails to start; cache.log says
>>>> it can't open "on" for writing, and suggests to check that the parent
>>>> directory be writable by the user "squid".
>>>>
>>>> I don't think this is a file permission issue, because even changing
>>>> 777 permission to the entire /var/cache dir doesn't solve the problem.
>>>> I also tried lsof to check for locks on that file, but didn't find
>>>> anything.
>>>>
>>>> Yesterday I solved the problem by deleting the entire cache directory
>>>> and upgrading squid (now I'm running 2.6.STABLE4).
>>>>
>>>> Googling around with strings from the message in the cache.log didn't
>>>> give much help, which makes me think I'm nearly the only one having
>>>> this issue.
>>>>
>>>> The relevant lines from cache.log are:
>>>>
>>>> --------- 8< ----------------
>>>> Squid Cache (Version 2.6.STABLE3): Terminated abnormally.
>>>> CPU Usage: 0.008 seconds = 0.008 user + 0.000 sys
>>>> Maximum Resident Size: 0 KB
>>>> Page faults with physical i/o: 0
>>>> 2006/12/06 13:43:13| Starting Squid Cache version 2.6.STABLE3 for
>>>> i686-pc-linux-gnu...
>>>> 2006/12/06 13:43:13| Process ID 15637
>>>> 2006/12/06 13:43:13| With 1024 file descriptors available
>>>> 2006/12/06 13:43:13| Using epoll for the IO loop
>>>> 2006/12/06 13:43:13| Performing DNS Tests...
>>>> 2006/12/06 13:43:13| Successful DNS name lookup tests...
>>>> 2006/12/06 13:43:13| DNS Socket created at 0.0.0.0, port 33030, FD 5
>>>> 2006/12/06 13:43:13| Adding nameserver 192.9.200.200 from
>>>> /etc/resolv.conf
>>>> 2006/12/06 13:43:13| Adding nameserver 151.99.125.1 from
>>>> /etc/resolv.conf
>>>> 2006/12/06 13:43:13| Adding nameserver 151.99.125.2 from
>>>> /etc/resolv.conf
>>>> 2006/12/06 13:43:13| Adding nameserver 151.99.125.3 from
>>>> /etc/resolv.conf
>>>> 2006/12/06 13:43:13| Adding nameserver 212.216.172.222 from
>>>> /etc/resolv.conf
>>>> 2006/12/06 13:43:13| Adding nameserver 212.216.112.112 from
>>>> /etc/resolv.conf
>>>> FATAL: Cannot open 'on' for writing.
>>>> The parent directory must be writeable by the
>>>> user 'squid', which is the cache_effective_user
>>>> set in squid.conf.
>>>> Squid Cache (Version 2.6.STABLE3): Terminated abnormally.
>>>> CPU Usage: 0.008 seconds = 0.008 user + 0.000 sys
>>>> Maximum Resident Size: 0 KB
>>>> Page faults with physical i/o: 0
>>>> ------------- >8 ---------------
>>>>
>>>>
>>>> Thanks in advance.
>>>>
>>>>
>>>> --Marcello Romani
>>>> Responsabile IT
>>>> Ottotecnica s.r.l.
>>>> http://www.ottotecnica.com
>>> Does your squid user own the cache directory. Or it sounds like you may
>>
>> Squid doesn't own the cache dir, but even trying to chown -R
>> squid:squid /var/cache and chmod -R 777 /var/cache doesn't help...
>>
>>> have an error in your .conf file. FATAL: Cannot open 'on' for
>>> writing, sounds like it is looking for a directory named 'on'. Dont
>>> suppose you
>>
>> In fact there's a file named 'on' in the cache directory.
>>
>>> made any changes to squid prior to this?
>>
>> If you mean changes to the squid source code, no I didn't.
>> Just changes to squid.conf.
>>
>>>
>>>
>>>
>>> --Dwayne Hottinger
>>> Network Administrator
>>> Harrisonburg City Public Schools
>>>
>>>
>>>
>>
>> Thanks
>>
>> --Marcello Romani
>> Responsabile IT
>> Ottotecnica s.r.l.
>> http://www.ottotecnica.com
>
> Try starting squid with the -z option after you chown the cache
> directory to squid. I would also check your squid.conf for any changes
> you may have made. Sounds like you may have an error in your squid.conf
> that has it writting to a directory named 'on'. If you have a file in
> your squid cache dir named 'on' delete it then start squid -z. But Im
> betting on an error in your squid.conf. I usually make a backup copy of

When I spotted ths problem, I also noticed that gentoo had an updated
version of squid. Therefore I removed the old squid cache directory and
upgraded the squid package.
After this operation, everything is working fine.
What I'm trying to do here is understand why that strange error
appeared, since the old installation has been running fine for months.
I don't want to re-install squid next time a service restart is needed!

> my .conf files with cp before I edit them. That way, when I mess it up,
> I can quickly cp the good copy and start squid. Please include the

The only changes I have made to squid.conf is the addition of a few
domains in a couple of ACLs. (I have posted my squid.conf in this thread).

> squid mailing list in the email, so all can benefit from your
> experience. ;-]

Sorry, I just hit the "Reply" button, and the mailing list was in the
"CC" field instead of the "To" one.

>
> ddh
>
> --Dwayne Hottinger
> Network Administrator
> Harrisonburg City Public Schools
>
>
>

-- 
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.com
Received on Mon Dec 11 2006 - 09:56:10 MST

This archive was generated by hypermail pre-2.1.9 : Mon Jan 01 2007 - 12:00:01 MST