Skip to content

Instantly share code, notes, and snippets.

@byrney
Last active February 27, 2016 16:11
Show Gist options
  • Save byrney/3daa3b74a688a507e46d to your computer and use it in GitHub Desktop.
Save byrney/3daa3b74a688a507e46d to your computer and use it in GitHub Desktop.
Omnitruck chef installer fails with 404 when LANG variable is not set

vagrant tells the guest to run

https://omnitruck.chef.io/install.sh | bash ....

The install.sh tries to use wget (that's the preferred option)

    # do_wget URL FILENAME
    do_wget() {
      echo "trying wget..."
      wget -O "$2" "$1" 2>$tmp_dir/stderr
      rc=$?
      # check for 404
      grep "ERROR 404" $tmp_dir/stderr 2>&1 >/dev/null
      if test $? -eq 0; then
        echo "ERROR 404"
        http_404_error
      fi
      # check for bad return status or empty output
      if test $rc -ne 0 || test ! -s "$2"; then
        capture_tmp_stderr "wget"
        return 1
      fi
      return 0
    }

When the LANG variable is not set (which is the case for this debian box when the command is sent over ssh) wget seems to work but puts an error into the /tmp/install.xxx/stderr file which the omnitruck script spots and tells vagrant that chef_install failed.

This seems to be due to a ANSI -> UTF8 converstion done by wget. The download succeeds but the 404 in the log causes install.sh to fail and thus vagrant provisioning halts.

Seems like the install.sh script should use wget properly (wget returns 8 on a 404). The workaround was to tell vagrant to forward LANG from the local env

  config.ssh.forward_env = ["LANG"]
converted 'https://opscode-omnibus-packages-current.s3.amazonaws.com/debian/8/x86_64/chef_12.7.2%2B20160216120041-1_amd64.deb' (ANSI_X3.4-1968) -> 'https://opscode-omnibus-packages-current.s3.amazonaws.com/debian/8/x86_64/chef_12.7.2+20160216120041-1_amd64.deb' (UTF-8)
--2016-02-27 14:51:02-- https://opscode-omnibus-packages-current.s3.amazonaws.com/debian/8/x86_64/chef_12.7.2+20160216120041-1_amd64.deb
Resolving opscode-omnibus-packages-current.s3.amazonaws.com (opscode-omnibus-packages-current.s3.amazonaws.com)... 54.231.176.41
Connecting to opscode-omnibus-packages-current.s3.amazonaws.com (opscode-omnibus-packages-current.s3.amazonaws.com)|54.231.176.41|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2016-02-27 14:51:03 ERROR 404: Not Found.
--2016-02-27 14:51:03-- https://opscode-omnibus-packages-current.s3.amazonaws.com/debian/8/x86_64/chef_12.7.2%2B20160216120041-1_amd64.deb
Reusing existing connection to opscode-omnibus-packages-current.s3.amazonaws.com:443.
HTTP request sent, awaiting response... 200 OK
Length: 53796968 (51M) [application/x-www-form-urlencoded]
Saving to: '/tmp/install.sh.1606/chef_12.7.2%2B20160216120041-1_amd64.deb'
0K .......... .......... .......... .......... .......... 0% 173K 5m4s
50K .......... .......... .......... .......... .......... 0% 173K 5m3s
400K .......... .......... .......... .......... .......... 0% 1.34M 2m1s
450K .......... .......... .......... .......... .......... 0% 137M 1m49s
500K .......... .......... .......... .......... .......... 1% 467K 1m49s
550K .......... .......... .......... .......... .......... 1% 138M 1m40s
900K .......... .......... .......... .......... .......... 1% 133M 71s
950K .......... .......... .......... .......... .......... 1% 1.37M 69s
1000K .......... .......... .......... .......... .......... 1% 99.5M 66s
2750K .......... .......... .......... .......... .......... 5% 124M 31s
2800K .......... .......... .......... .......... .......... 5% 126M 31s
2850K .......... .......... .......... .......... .......... 5% 179M 30s
2900K .......... .......... .......... .......... .......... 5% 184M 30s
2950K .......... .......... .......... .......... .......... 5% 474K 31s
3000K .......... .......... .......... .......... .......... 5% 139M 30s
52400K .......... .......... .......... .......... .......... 99% 152M 0s
52450K .......... .......... .......... .......... .......... 99% 176M 0s
52500K .......... .......... .......... ...... 100% 212M=4.8s
2016-02-27 14:51:08 (10.7 MB/s) - '/tmp/install.sh.1606/chef_12.7.2%2B20160216120041-1_amd64.deb' saved [53796968/53796968]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment