"/usr/bin/env: bash: No such file or directory" during puppet exec command

9,989

For the ambari-server-setup exec you define a path containing /usr/bin and /usr/sbin.

Most likely you have your bash binary installed as /bin/bash, hence you will also need to include /bin in that path.

Share:
9,989

Related videos on Youtube

cremersstijn
Author by

cremersstijn

Updated on September 18, 2022

Comments

  • cremersstijn
    cremersstijn over 1 year

    I am setting my first steps into puppet. I am trying to setup ambari.

    This is my puppet config:

    exec { "ambari-repo":
      command => "curl http://public-repo-1.hortonworks.com/ambari/suse11/1.x/updates/1.4.4.23/ambari.repo > /etc/yum.repos.d/ambari.repo",
      path    => ["/usr/bin", "/usr/sbin"]
    }
    
    package {"ambari-server":
        ensure => installed,
        require => Exec["ambari-repo"]
    }
    
    file { "hadoop-dir":
        path => "/hadoop",
        ensure => "directory"
    }
    
    exec { "ambari-server-setup":
        command => "ambari-server setup -s",
        path    => ["/usr/bin", "/usr/sbin"],
        cwd => "/hadoop",
        user => "root",
        require => [Package["ambari-server"], File["hadoop-dir"]]
    }
    

    But when my puppet script run, it fails:

    Notice: Compiled catalog for localhost.be in environment production in 0.30 seconds
    Notice: /Stage[main]/Main/File[hadoop-dir]/ensure: created
    Notice: /Stage[main]/Main/Exec[ambari-repo]/returns: executed successfully
    Notice: /Stage[main]/Main/Package[ambari-server]/ensure: created
    Notice: Finished catalog run in 49.39 seconds
    
    
    Stderr from the command:
    
    Error: /usr/bin/env: bash: No such file or directory
    
    Error: /Stage[main]/Main/Exec[ambari-server-setup]/returns: change from notrun to 0 failed: /usr/bin/env: bash: No such file or directory
    

    Note that i uses puppet with vagrant.

    Any idea what i am doing wrong?

    Thanks

    • cremersstijn
      cremersstijn about 10 years
      yes indeed, it exists
  • Charles Duffy
    Charles Duffy about 10 years
    FYI, type bash is better practice than which bash (which launches an external command, not guaranteed to behave identically to the shell's own lookup behavior).
  • Zoredache
    Zoredache about 10 years
    See the FHS for why bash in /bin. pathname.com/fhs/pub/… - /bin contains commands ... which are required when no other filesystems are mounted
  • Cry Havok
    Cry Havok about 10 years
    Except of course you want the external command, since you don't necessarily know what shell is being used.