Squid not starting properly

Hello :wink:

I’m trying to use squid ( v 3.4.4-3.4.2) but it does not work properly so far, as soon i enable squid in the brower the sites are not loaded anymore, they are as usual if i disable squid in the brower (firefox).

i first had this error in the journal : hostname was not seen properly
i added the line in squid.conf :


# set visible_hostname (specify hostname)
visible_hostname my_hostname

Is this enough or shall i add to /etc/hosts too ?

Now it seems the squid service can’t be started properly :

 # systemctl start /usr/lib/systemd/system/squid.service
Failed to start usr-lib-systemd-system-squid.service.mount: Unit usr-lib-systemd-system-squid.service.mount failed to load: No such file or directory.




How can i improve this ?

Thanks :wink:

Well, the message says that /usr/lib/systemd/system/squid.service does not exist. Should it exist? You think it should, else you wouldn’t have used it your command. But are you sure this is the correct name?

Hi,
the name is ok, i’m not sure how to use this though.

Naturally it doesn’t work, you need to use **systemctl start squid

**You don’t prefix the entire path to the .service file, systemd already knows where to look for them.

hi,

ok , it stills fails though , it seems refresh pattern is wrong.



 # systemctl start squid
Job for squid.service failed. See "systemctl status squid.service" and "journalctl -xn" for details.

openSUSE132:~ # systemctl status squid.service
squid.service - Squid caching proxy
   Loaded: loaded (/usr/lib/systemd/system/squid.service; enabled)
   Active: failed (Result: exit-code) since Tue 2015-03-31 14:13:46 CEST; 18s ago
  Process: 2921 ExecStartPre=/bin/sh -c test -d "`sed -n 's/^cache_dir \+:alnum:]]\+ \+\(:graph:]\/]\+\) .*/\1/p' /etc/squid/squid.conf | sed '1 q'`/00" || /usr/sbin/squid -z -F -N -S -f /etc/squid/squid.conf (code=exited, status=1/FAILURE)

Mar 31 14:13:46 openSUSE132 squid[2925]: Bungled /etc/squid/squid.conf line 75: refresh_pattern .
Mar 31 14:13:46 openSUSE132 sh[2921]: FATAL: Bungled /etc/squid/squid.conf line 75: refresh_pattern .
Mar 31 14:13:46 openSUSE132 sh[2921]: Squid Cache (Version 3.4.4): Terminated abnormally.
Mar 31 14:13:46 openSUSE132 sh[2921]: CPU Usage: 0.010 seconds = 0.008 user + 0.002 sys
Mar 31 14:13:46 openSUSE132 sh[2921]: Maximum Resident Size: 37808 KB
Mar 31 14:13:46 openSUSE132 sh[2921]: Page faults with physical i/o: 0

openSUSE132:~ # journalctl -xn
-- Logs begin at Tue 2015-03-31 12:52:08 CEST, end at Tue 2015-03-31 14:14:36 CEST. --
Mar 31 14:14:36 openSUSE132 demond[1502]: [P:1502 T:-599996608] src/discovery.c : 158  getHidDevices        -- failed in opening HIDDEV file: /dev/hid/usb/hiddev13. No such file or directory
Mar 31 14:14:36 openSUSE132 demond[1502]: [P:1502 T:-599996608] src/discovery.c : 158  getHidDevices        -- failed in opening HIDDEV file: /dev/hid/usb/hiddev14. No such file or directory
Mar 31 14:14:36 openSUSE132 demond[1502]: [P:1502 T:-599996608] src/discovery.c : 158  getHidDevices        -- failed in opening HIDDEV file: /dev/hid/usb/hiddev15. No such file or directory
Mar 31 14:14:36 openSUSE132 demond[1502]: [P:1502 T:-599996608] src/discovery.c : 197  getHidDevices        -- ::::::::::::::: METHOD END :::::::::::::::
Mar 31 14:14:36 openSUSE132 demond[1502]: [P:1502 T:-599996608] src/discovery.c : 223  getUsbScanners       -- total HID devices found: 0
Mar 31 14:14:36 openSUSE132 demond[1502]: [P:1502 T:-599996608] src/discovery.c : 226  getUsbScanners       -- ::::::::::::::: METHOD END :::::::::::::::
Mar 31 14:14:36 openSUSE132 demond[1502]: [P:1502 T:-599996608] src/discovery.c : 92   getScanners          -- getUsbScanners successful
Mar 31 14:14:36 openSUSE132 demond[1502]: [P:1502 T:-599996608] src/discovery.c : 125  getScanners          -- ::::::::::::::: METHOD END :::::::::::::::
Mar 31 14:14:36 openSUSE132 demond[1502]: [P:1502 T:-599996608] src/demon.cpp   : 240  main                 -- usb scanners found is 0
Mar 31 14:14:36 openSUSE132 demond[1502]: [P:1502 T:-599996608] src/demon.cpp   : 309  main                 -- End of checking for USB scanners.

openSUSE132:~ # cat /etc/squid/squid.conf | grep refresh_pattern
# Add any of your own refresh_pattern entries above these.
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern .


Your configuration file is somehow… broken.

The refresh pattern, by default, should be:


refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern .               0       20%     4320

Hello :wink:

how come ? :expressionless:
the only thing i changed is adding the line i mentioned in my 1st message above.

how can i renew the config file entirely and properly ? rename the old file and restart squid or remove and reinstall ?

Thanks :wink:

Remove the configuration file and issue zypper in -f squid

here’s what i did :

rm /etc/squid/squid.conf

zypper in -f squid


as soon as i enable squid in firefox and update the site i can’t see it anymore, if i disable proxy site is seen as usual .

By default Squid doesn’t allow anyone to connect to it, not even localhost (or at least that’s what I remember, I’ve used my own Squid configuration for almost 10 years now so I haven’t looked at the default one in a while)

You need to edit the configuration file, add a acl line and then http_access allow theacl, or edit one of the “localnet” ranges that are in the configuration file by default.

For example:


acl strawberry src 127.0.0.1
acl strawberry src 192.168.0.0/24
http_access allow strawberry

Replace the 192 with your home networks IP range. Then restart the Squid service with systemctl restart squid

Make note of the http_port also, it should default to 3128 which is the de facto proxy port - you need to specify that in Firefox as well.

hi,
i don’t get it for i used squid before and did not touch the conf file, just installed it and enabled it in yast system services and in firefox settings.

now i have this


acl localnet src 192.168.0.0/24 # RFC1918 possible internal network
acl localnet src fc00::/7       # RFC 4193 local private network range
acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines
acl localnet src 127.0.0.1


...


# Example rule allowing access from your local networks.                                                                                                                                                                                    
# Adapt localnet in the ACL section to list your (internal) IP networks                                                                                                                                                                     
# from where browsing should be allowed                                                                                                                                                                                                     
http_access allow localnet



after restarting squid it still is ko in firefox

is my setting wrong in firefox ?
http://pix.toile-libre.org/upload/thumb/1427879192.png](http://pix.toile-libre.org/?img=1427879192.png)

shall i show you the entire squid conf ? (default but above changed)

thanks :wink:

Look at /var/log/squid/access.log for errors as to why Firefox is being denied.

You can just tail it as root to see it realtime as you use the browser: tail -f /var/log/squid/access.log

i have no /var/log/squid on my machine .