Comment 2 for bug 1635560

Revision history for this message
Adam Collard (adam-collard) wrote :

I saw the same thing when deploying Ubuntu 16.04 LTS using MAAS 2.

MAAS deployment workflow makes it hard to grab the etc/sysctl.d/10-ipv6-privacy.conf file. However, from a commissioning environment I grabbed: http://paste.ubuntu.com/23511486/

Note the fancy ' on line 9 (AKA position 277)

Is somehow the default encoding getting changed? Out of the box Python 3 should use UTF-8 for file I/O.

$ python3
Python 3.5.2 (default, Sep 10 2016, 08:21:44)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> x = open("/etc/sysctl.d/10-ipv6-privacy.conf", "r").read()
>>> x
"# IPv6 Privacy Extensions (RFC 4941)\n# ---\n# IPv6 typically uses a device's MAC address when choosing an IPv6 address\n# to use in autoconfiguration. Privacy extensions allow using a randomly\n# generated IPv6 address, which increases privacy.\n#\n# Acceptable values:\n# 0 - don’t use privacy extensions.\n# 1 - generate privacy addresses\n# 2 - prefer privacy addresses and use them over the normal addresses.\nnet.ipv6.conf.all.use_tempaddr = 2\nnet.ipv6.conf.default.use_tempaddr = 2\n"
>>> x = open("/etc/sysctl.d/10-ipv6-privacy.conf", "r", encoding="ascii").read()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 277: ordinal not in range(128)