Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm using Puppet to install ufdbGuard which requires Squid 2.7 (which is correctly installed and working properly).

Here is the relevant class:

class pns_client::squid {

package { 'squid':
  ensure => present,
  before => File['/etc/squid/squid.conf'],
}


if $::ufdbguard_installed == "true" {
    $squidconf = 'puppet:///modules/pns_client/squid.conf_ufdbguard'
} else {
    $squidconf = 'puppet:///modules/pns_client/squid.conf'
}

notify{$squidconf:}

file { '/etc/squid/squid.conf':
  ensure => file,
  mode   => 644,
  source => $squidconf,
}

service { 'squid':
  ensure     => running,
  enable     => true,
  hasrestart => true,
  hasstatus  => true,
  subscribe  => File['/etc/squid/squid.conf'],
}
}

When running, I get this error:

err: /Stage[main]/Pns_client::Squid/Service[squid]: Could not evaluate: Could not find init script for 'squid'

This happens on all freshly-installed Debian 6 and Unbuntu 10.04/11.04 machines.

Any ideas?

share|improve this question

5 Answers 5

up vote 1 down vote accepted

Is this your first Ubuntu server installation? If so you should know that many packages have transitioned from traditional init.d scripts to upstart. Squid would be such a package. This means there is no real /etc/init.d/squid. Instead this is a symlink, but you should be able to see it if you do an ls -la /etc/init.d. The real start script is an upstart task in /etc/init/squid.conf.

You need to change your manifest's service definition to this:

service { 'squid':
  ensure     => 'running',
  provider   => 'upstart',
  hasrestart => 'true',
  hasstatus  => 'true',
  subscribe  => File['/etc/squid/squid.conf'],
}

Note that the upstart puppet provider can not enable a service, so this directive should not be included.

share|improve this answer
    
I can't see the symlink in that directory and I get Invalid service provider 'upstart' from puppet. However, squid is up and running... –  chris Mar 7 '12 at 1:21
    
Upstart has been a valid Puppet provider since 2.7.0, I think. You should upgrade your Puppet setup (use apt.puppetlabs.com). The init.d symlink is just for convenience and not necessary for starting anything via upstart. It is weird though, that your system seems to be missing that symlink. It seems you somehow broke your installation. –  daff Mar 7 '12 at 1:52
    
I redid the machine from scratch and the same problem applies. Let me try to upgrade Puppet to see if it makes a difference... –  chris Mar 7 '12 at 9:18
    
Upgraded to Puppet 2.7.11 and still same result. Damn it... –  chris Mar 7 '12 at 10:53
    
Then you might have bigger problems than puppet or squid. I don't know what to tell you, I have been using upstart as a puppet service provider for months now, works fine. Did you also upgrade your puppetmaster? –  daff Mar 7 '12 at 12:01

Squid seems to be called squid3 in apt-get and this error message does happen when the package name is wrong.

share|improve this answer
    
I'm using Squid 2.7.STABLE9 though. –  chris Mar 6 '12 at 12:56
    
@chris: then why don't you look in /etc/init.d and find out what the init script and thus the puppet service name is called? –  daff Mar 6 '12 at 13:03
    
I can't find anything related to squid there... –  chris Mar 6 '12 at 14:38
    
How do you stop and start squid? And for that matter, how did you install it? –  Ladadadada Mar 6 '12 at 14:45
    
service squid start/stop. I used apt-get install squid. –  chris Mar 6 '12 at 15:04

This simply means there's no /etc/init.d/squid, or it is not executable. Find out what the correct name is, and set either name or path to the correct value.

share|improve this answer
    
How can I find the correct name? –  chris Mar 6 '12 at 14:38
1  
@chris dpkg -L squid-package-name | grep /etc/init.d. –  Daniel C. Sobral Mar 6 '12 at 16:53
    
returns nothing. As a double check, on a working machine it returns /etc/init.d/squid –  chris Mar 7 '12 at 1:18
    
@chris Debian 6 has two squid packages: squid and squid3. As you can see here and here, both contain something on init.d. So, if you don't have it, the package is not the official package, or has been corrupted. Do an apt-get update, then purge and install the package again. –  Daniel C. Sobral Mar 7 '12 at 13:44
    
Right for Debian, but still nothing in Ubuntu. I switched to upstart which solved it. Thanks for your help! –  chris Mar 7 '12 at 15:23

I had a similar problem, where the solution looked like this (link to bug report included):

  file { $upstartfile:
    ensure => present,
    source => "puppet:///elasticsearch/etc-init-elasticsearch.conf",
  }

  # for http://projects.puppetlabs.com/issues/14297
  file { '/etc/init.d/elasticsearch':
    ensure => link,
    target => "/lib/init/upstart-job",
  }

  service { 'elasticsearch':
    ensure        => running, 
    hasrestart    => true,
    hasstatus     => true,
    provider      => 'upstart',
    subscribe     => [ File[$upstartfile], File['/etc/init.d/elasticsearch'] ],
  }

I.e. a symlink in /etc/init.d named elasticsearch to /lib/init/upstart-job.

share|improve this answer
    
This helped me alot, thanks! –  jmg Mar 8 '13 at 10:27

I think that this problem is due to the fact that Puppet do not executes the manifest sequentially. So Puppet can try to starts the Squid service before to install the Squid package and of course this causes an error.

You have then to manage the dependencies of the different tasks. Try to make this change :

service { 'squid':
  ensure     => running,
  enable     => true,
  hasrestart => true,
  hasstatus  => true,
  subscribe  => File['/etc/squid/squid.conf'],
  require => Package['squid'],
}

Good luck !

share|improve this answer
    
Squid is installed and already running. –  chris Mar 6 '12 at 14:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.