# Squid hangs on boot



## esheesle (Sep 26, 2014)

Just set[]up Squid on Freebsd FreeBSD 8.4. Everything is working through the proxy as expected but when the rc script is started (either during boot or manually) it starts Squid and then hangs. I can control-c it and everything continues to function fine. It should be running in daemon mode as when I check the command arguments I don't see a -n. Any ideas on where to look to resolve it?


----------



## kpa (Sep 26, 2014)

Do this and look for the place in the log where it hangs:

`script /tmp/squid-start.log sh -x /usr/sbin/service squid start`


----------



## esheesle (Sep 26, 2014)

*S*tops here:

```
+ sourced_files=:/etc/rc.conf::/etc/rc.conf.local:
+ [ -r /etc/rc.conf.local ]
+ _rc_conf_loaded=true
+ [ -f /etc/rc.conf.d/XXX ]
+ [ -n '' ]
+ getopts ehlrRv COMMAND_LINE_ARGUMENT
+ shift 0
+ [ -n '' ]
+ [ -n '' -o -n '' ]
+ [ -n '' ]
+ [ -n '' ]
+ [ -n '' ]
+ [ 2 -gt 1 ]
+ script=squid
+ shift
+ cd /
+ [ -x /etc/rc.d/squid ]
+ [ -x /usr/local/etc/rc.d/squid ]
+ [ -n '' ]
+ exec env -i HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin /usr/local/etc/rc.d/squid start
Starting squid.
```


----------



## junovitch@ (Sep 27, 2014)

Are you using a cache directory?  I've seen the /var/squid/cache/squid directory get reset to root:wheel ownership and that stopped Squid from starting.


----------



## esheesle (Sep 27, 2014)

Just validated that the cache directory was owned by the squid user.  Any other ideas.  My squid conf is:


```
auth_param basic program /usr/local/libexec/squid/basic_ncsa_auth /usr/local/etc/squid/passwords
#auth_param basic realm proxy
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off
acl authenticated proxy_auth REQUIRED
acl localhost src 127.0.0.1/32 
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl SSL_ports port 443
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
acl CONNECT method CONNECT
http_access allow authenticated
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
http_port 3128
cache_mem 768 MB
maximum_object_size_in_memory 1024 KB
memory_replacement_policy heap GDSF
cache_replacement_policy heap LFUDA
pid_filename /var/run/squid/squid3.pid
buffered_logs on
coredump_dir /var/spool/squid3
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern (Release|Packages(.gz)*)$      0       20%     2880
refresh_pattern .               0       20%     4320
negative_dns_ttl 5 minutes
via off
forward_timeout 30 seconds
connect_timeout 30 seconds
read_timeout 30 seconds
request_timeout 30 seconds
persistent_request_timeout 1 minutes
client_lifetime 20 hours
dns_timeout 5 minutes
ipcache_size 10240
forwarded_for delete
client_db off
acl home_network src 192.168.178.0/24
icap_enable on
icap_preview_enable on
icap_preview_size 4096
icap_persistent_connections on
icap_send_client_ip on
icap_send_client_username on
icap_client_username_header X-Client-Username
icap_service qlproxy1 reqmod_precache bypass=0 icap://127.0.0.1:1344/reqmod
icap_service qlproxy2 respmod_precache bypass=0 icap://127.0.0.1:1344/respmod
adaptation_access qlproxy1 allow all
adaptation_access qlproxy2 allow all
```


----------



## junovitch@ (Sep 27, 2014)

Nothing stands out but my setup is very basic.  Worse case try `truss service squid start` and see if there is any clues before it stops why it's not starting.


----------



## esheesle (Sep 27, 2014)

So that's just it, the service starts, it just never gives me a prompt back (or allows boot to continue) until i press ctrl-c.  once hitting ctrl-c everything continues along and squid is running fine.


----------

