Squid requires restart after Network Manager made connection to network

Bug #97513 reported by martyscholes
66
This bug affects 9 people
Affects Status Importance Assigned to Milestone
squid (Debian)
Fix Released
Unknown
squid (Ubuntu)
Fix Released
Wishlist
Unassigned
squid3 (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: squid

Squid uses its own resolver, getting a list of name servers on startup from /etc/resolv.conf. On a roaming laptop, this information is missing until a network connection is made, which happens after squid is launched and has loaded an empty /etc/resolv.conf.

This is a bug because on a roaming laptop, squid does not "just work."

The net effect is that squid will not work on a roaming laptop until:
* squid is restarted after a network connection has been established, or
* the user is sophisticated enough to put the dns_nameservers tag into /etc/squid/squid.conf with some universal nameservers, e.g. 4.2.2.1.

A proposed solution would be to make squid dependent upon a network connection being up, so that squid starts after a network becomes available and stops when the network goes away. One possible downside to this approach is that squid, when asked to shut down, might think some network connections are open, and the default action is to wait 30 seconds before actually shutting down, set through the shutdown_lifetime tag. The default squid.conf might need to be modified so that squid shuts down immediately when a network connection is shut down.

After all, there is no need for squid if there is no network connection, is there?

Marty

Tags: patch
Revision history for this message
Chuck Short (zulcss) wrote :

So basically start squid when you bring up your network right?

Thanks
chuck

Changed in squid:
importance: Undecided → Wishlist
status: New → Incomplete
Revision history for this message
Connor Imes (ckimes) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. You reported this bug a while ago and there hasn't been any activity in it recently. We were wondering is this still an issue for you? Can you try with latest Ubuntu release? Thanks in advance.

Revision history for this message
Carlos Eduardo Moreira dos Santos (cemsbr) wrote :

I've done a fresh 8.10 desktop install and I have to restart squid every time I boot the PC. Otherwise:

2008/11/06 12:49:34| Warning: Could not find any nameservers. Trying to use localhost
2008/11/06 12:49:34| Please check your /etc/resolv.conf file

Is it possible to change the service starting orders? If squid starts after NetworkManager, the problem could be solved.

Connor Imes (ckimes)
Changed in squid:
status: Incomplete → Confirmed
Revision history for this message
Tobias Krais (tux-spam) wrote :

Hi guys,

here my scenario: I have a local transparent squid and dansguardian for content filtering issues working. I was not able to reproduce this bug in Intrepid.

I started my Laptop and it worked. I established a VPN connection with the Gnome Network manager and Squid reloaded automatically. So I was able to use the new nameserver.

But now I upgraded to Jaunty. Since then, I have to reload squid manually as soon as my network connection is established. When I establish my VPN connection, my /etc/resolv.conf is modified and squid does handle no more connections, even if I reload squid!

This is horrible for me. Is this a misconfiugration from my side? In Intrepid, everything worked out.

Or is this not even a whishlist, but a bug?

Greetings, Tobias

Revision history for this message
Tobias Krais (tux-spam) wrote :

Hi again,

my post before is solved and is not related with the issue.

Sorry for disturbing.

Greetings,

Tobias

Revision history for this message
Kevin Turner (keturn) wrote :

Yeah, this isn't just for roaming laptops, as Carlos noted this is a problem even for desktop installations that use network-manager to get DHCP from a wired interface.

I looked through the network-manager revision history, and found this:

network-manager (0.7.1~rc1-0ubuntu2) jaunty; urgency=low

  * start NetworkManager daemon later (50) and remove old init links
    accordingly (requested by Keybuk aka <email address hidden>)

which means that someone decided it was a good idea to start NetworkManager *after* a lot of network-dependent services start, but I haven't yet found documentation of the reasoning behind that decision.

Revision history for this message
Luis Felipe Strano Moraes (luis-strano) wrote :

Hey, adding the script I just attached to /etc/NetworkManager/dispatcher.d/ seems to fix the issue, this way network-manager reloads squid when he connects to a new network. The fix is adapted from the one found here: https://bugzilla.redhat.com/show_bug.cgi?id=453304

Revision history for this message
ktp (kari-petersen) wrote :

You could also use a script in /etc/network/if-up.d/ to manage multiple configurations.

Revision history for this message
Tobias Krais (tux-spam) wrote :

In most cases NetworkManager is used for configuring network interfaces. I attached a file that should be placed /etc/NetworkManager/dispatcher.d/ and this solves the issue.

Please remind that just reloading squid is no more sufficient (it was till gusty gibbon, but later a restart is required).

The Fedora project put the attached file in squid package an I suggest to do this, too.

Please fix it.

One thing is not solved with the patch: after waking up from standby mode squid is not restarted. Currently I don't know where to put the restart file.

summary: - squid starts before resolv.conf is populated
+ Squid requires restart after Network Manager made connection to network
Tobias Krais (tux-spam)
Changed in squid3 (Ubuntu):
status: New → Confirmed
tags: added: patch
Revision history for this message
Luis Felipe Strano Moraes (luis-strano) wrote :

Tobias, the patch I had attached last year in July is the same as the one you just posted, check my comment above.

Revision history for this message
Tobias Krais (tux-spam) wrote :

Hi Luis,

not really. Your patch relaods squid. But just reloading squid is not sufficient. We have to restart squid.

Why does nobody include the file if there is a patch since one year available!?!

Greetings,

Tobias

Revision history for this message
Tobias Krais (tux-spam) wrote :

Hi together,

I did some further investigation of the problem and I detected the file /etc/resolvconf/update-libc.d/squid. This file is intended to solve the issue, but it does not. Why? You will find the command "restart squid" in it. But that command will fail. Changing it to "start squid" will solve the issue and not only for network manager. Anyway: shouldn't the script be located in /etc/resolvconf.d/update-libc.d/ instead of /etc/resolvconf/update-libc.d/?

Squid3 is thus not affected, because there is another resolvconf.d script that solves the issue.

I'll attach the new file.

Greetings, Tobias

Changed in squid3 (Ubuntu):
status: Confirmed → Fix Released
Changed in squid (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
Tobias Krais (tux-spam) wrote :

See also Bug, which is occurs in Squid3, but is fixed Squid2.7 https://bugs.launchpad.net/ubuntu/+source/squid3/+bug/661066

This means: squid3 cannot connect on boot. squid cannot connect on conncetion changes. Thus non of the packages really works...

Revision history for this message
Tobias Krais (tux-spam) wrote :

Reported in Debian, hopefully they will fix it and ubuntu will import the solution...

Changed in squid (Debian):
importance: Undecided → Unknown
status: New → Unknown
Changed in squid (Debian):
status: Unknown → New
Revision history for this message
Dave Gilbert (ubuntu-treblig) wrote :
Download full text (3.3 KiB)

I wonder if this is what I'm now seeing on Oneiric; I run a squid on my desktop so that it and my vms and my laptop share apt-get update's/upgrades. SInce somewhere in Oneiric dev cycle I'm having to restart squid before it starts responding.

Squid's access log has:

1318764515.529 1 192.168.66.25 TCP_REFRESH_FAIL_HIT/200 7612 GET http://ddebs.ubuntu.com/dists/oneiric/Release - DIRECT/ddebs.ubuntu.com text/plain
....
1318764516.476 0 192.168.66.25 TCP_MISS/504 1632 GET http://ddebs.ubuntu.com/dists/oneiric/main/i18n/Index - DIRECT/ddebs.ubuntu.com text/html

 and similar

cache.log has:

2011/10/16 12:42:53| Starting Squid Cache version 2.7.STABLE9 for x86_64-pc-linux-gnu...
2011/10/16 12:42:53| Process ID 1369
2011/10/16 12:42:53| With 1024 file descriptors available
2011/10/16 12:42:53| Using epoll for the IO loop
2011/10/16 12:42:53| DNS Socket created at 0.0.0.0, port 48544, FD 6
2011/10/16 12:42:53| Warning: Could not find any nameservers. Trying to use localhost
2011/10/16 12:42:53| Please check your /etc/resolv.conf file
2011/10/16 12:42:53| or use the 'dns_nameservers' option in squid.conf.
2011/10/16 12:42:53| User-Agent logging is disabled.
2011/10/16 12:42:53| Referer logging is disabled.
2011/10/16 12:42:53| logfileOpen: opening log /var/log/squid/access.log
2011/10/16 12:42:53| Unlinkd pipe opened on FD 11
2011/10/16 12:42:53| Swap maxSize 2097152 + 8192 KB, estimated 161949 objects
2011/10/16 12:42:53| Target number of buckets: 8097
2011/10/16 12:42:53| Using 8192 Store buckets
2011/10/16 12:42:53| Max Mem size: 8192 KB
2011/10/16 12:42:53| Max Swap size: 2097152 KB

2011/10/16 12:42:53| Local cache digest enabled; rebuild/rewrite every 3600/3600 sec
2011/10/16 12:42:53| logfileOpen: opening log /var/log/squid/store.log
2011/10/16 12:42:53| Rebuilding storage in /var/spool/squid (CLEAN)
2011/10/16 12:42:53| Using Least Load store dir selection
2011/10/16 12:42:53| Set Current Directory to /var/spool/squid
2011/10/16 12:42:53| Loaded Icons.
2011/10/16 12:42:53| Accepting proxy HTTP connections at 0.0.0.0, port 3128, FD 13.
2011/10/16 12:42:53| Accepting ICP messages at 0.0.0.0, port 3130, FD 14.
2011/10/16 12:42:53| HTCP Disabled.
2011/10/16 12:42:53| WCCP Disabled.
2011/10/16 12:42:53| Ready to serve requests.
2011/10/16 12:42:53| Done reading /var/spool/squid swaplog (2883 entries)
2011/10/16 12:42:53| Finished rebuilding storage from disk.
2011/10/16 12:42:53| 2883 Entries scanned
2011/10/16 12:42:53| 0 Invalid entries.
2011/10/16 12:42:53| 0 With invalid flags.
2011/10/16 12:42:53| 2883 Objects loaded.
2011/10/16 12:42:53| 0 Objects expired.
2011/10/16 12:42:53| 0 Objects cancelled.
2011/10/16 12:42:53| 0 Duplicate URLs purged.
2011/10/16 12:42:53| 0 Swapfile clashes avoided.
2011/10/16 12:42:53| Took 0.5 seconds (5340.7 objects/sec).
2011/10/16 12:42:53| Beginning Validation Procedure
2011/10/16 12:42:53| Completed Validation Procedure
2011/10/16 12:42:53| Validated 2883 Entries
2011/10/16 12:42:53| store_swap_size = 1886660k
2011/10/16 12:42:54| storeLateRelease: released 0 objects

Note the:

2011/10/16 12:42:53| Warning: Could not find any nam...

Read more...

Revision history for this message
Dave Gilbert (ubuntu-treblig) wrote :

On Precise this bug has stopped affecting me in the last week or so; so whoever fixed it - thank you!

Revision history for this message
Digulla-hepe (digulla-hepe) wrote :

I can't confirm this. I'm on Ubuntu 11.10 oneiric with squid 2.7.STABLE9-4ubuntu4 and the bug is still there.

I tried to start squid after networking by changing the "start on" line in /etc/init/squid.conf to

start on (started networking)

but that doesn't help. The cache.log still says:

2012/04/16 08:52:37| Warning: Could not find any nameservers. Trying to use localhost
2012/04/16 08:52:37| Please check your /etc/resolv.conf file
2012/04/16 08:52:37| or use the 'dns_nameservers' option in squid.conf.

Revision history for this message
Ksewe (kaspasewe) wrote :

I am on precice 12.04 LTS and the problem is still there...

below is part of the log from cache.log

2012/10/15 23:39:38| Starting Squid Cache version 3.1.19 for i686-pc-linux-gnu...
2012/10/15 23:39:38| Process ID 1170
2012/10/15 23:39:38| With 65535 file descriptors available
2012/10/15 23:39:38| Initializing IP Cache...
2012/10/15 23:39:38| DNS Socket created at [::], FD 5
2012/10/15 23:39:38| DNS Socket created at 0.0.0.0, FD 6
2012/10/15 23:39:38| Warning: Could not find any nameservers. Trying to use localhost
2012/10/15 23:39:38| Please check your /etc/resolv.conf file
2012/10/15 23:39:38| or use the 'dns_nameservers' option in squid.conf

Revision history for this message
Ksewe (kaspasewe) wrote :

It seems that squid3 works as long as the connection is made through network manager but needs restart if its connected using dongle(modem) firmware. Is there a way to make the firmare work without having to restart squid3?

Kapil (kapil-428)
Changed in squid (Ubuntu):
status: Fix Committed → Fix Released
Changed in squid (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.