Ask Your Question

Invalid byte sequence in US-ASCII when automating puppet

asked 2013-09-23 12:06:06 -0500

Ben McClure gravatar image

updated 2013-09-23 13:48:29 -0500

When I have the puppet agent running automatically, most of my nodes get the error "invalid byte sequence in US-ASCII" during several parts of the run. If I log into the server as root and run 'puppet agent -t', however, it works fine and I don't receive any character encoding issues.

This is with Ruby 1.9.3 (ruby-ng PPA) on Ubuntu 12.04 with puppet 3.3 (from the official apt repo).

Would it be something I need to change in the environment of the puppet user?

Output of 'locale' when run as root:

edit retag flag offensive close merge delete


Can you post the output of the command "locale" when you run it as root?

GregLarkin gravatar imageGregLarkin ( 2013-09-23 13:44:47 -0500 )edit

Also, try running with the extra options "--debug --trace" to see if you can tell what is generating the error message. Do any of your manifest files contain UTF-8 characters?

GregLarkin gravatar imageGregLarkin ( 2013-09-23 13:47:52 -0500 )edit

The issue is that when I run puppet agent manually, it works fine--it only seems to fail when it's run automatically by starting the puppet daemon. Can I get ...(more)

Ben McClure gravatar imageBen McClure ( 2013-09-23 13:50:10 -0500 )edit

The example42/puppi module is one--I get errors with the files 'puppi' and '' even though neither source seems to contain non-ASCII characters. I also get the error in ...(more)

Ben McClure gravatar imageBen McClure ( 2013-09-23 13:53:31 -0500 )edit

Oops, I missed that point. I'm more familiar with CentOS, but if Ubuntu allows you to modify the startup options of daemon processes, then you can add those options ...(more)

GregLarkin gravatar imageGregLarkin ( 2013-09-23 13:55:39 -0500 )edit

3 answers

Sort by ยป oldest newest most voted

answered 2014-03-21 09:56:43 -0500

you can force the puppetmaster to use UTF-8 editing the file /usr/share/puppet/rack/puppetmasterd/ adding Encoding.defaultexternal = Encoding::UTF8

edit flag offensive delete link more



Thanks, but there is an typo. The correct line would be: Encoding.default_external = Encoding::UTF_8

baurmatt gravatar imagebaurmatt ( 2014-07-08 09:28:29 -0500 )edit

answered 2013-11-19 03:58:06 -0500

You can check with iconv cli tool whether the file mentioned is utf-8. I noticed some trouble e.g. with german umlauts on ruby 1.9 and higher.

edit flag offensive delete link more

answered 2016-05-25 04:43:39 -0500

# set locale for ppuppet agents
file_line { 'etc-default-puppet':
  ensure => present,
  path   => $::operatingsystem ? { 'Amazon' => '/etc/sysconfig/puppet', default => '/etc/default/puppet' },
  line   => 'export LANG=en_US.UTF-8',
  match  => '^export LANG=',
  notify => Service['puppet'],
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-09-23 12:06:06 -0500

Seen: 12,614 times

Last updated: May 25 '16