Okay. Some of the thought above were wrong.
Here is what's happening.
Python3-based cloud-init on 15.04 reads binary data into UTF-8 string.
It thoughts that this bitstream is utf-8 but it doesn't.
If it meets sequence of bytes that can't be converted into single utf-8 character (some non-sense sequence) it puts 'unknown chracter' (\xef\xbf\xbd or �) instead.
Then, we want to right userdata string to a file we encode it into bitstream but get all this 'unknown character's encoded with \xef\xbf\xbd which makes output longer and add unexpected bits.
That breaks the whole thing.
Okay. Some of the thought above were wrong.
Here is what's happening.
Python3-based cloud-init on 15.04 reads binary data into UTF-8 string.
It thoughts that this bitstream is utf-8 but it doesn't.
If it meets sequence of bytes that can't be converted into single utf-8 character (some non-sense sequence) it puts 'unknown chracter' (\xef\xbf\xbd or �) instead.
Then, we want to right userdata string to a file we encode it into bitstream but get all this 'unknown character's encoded with \xef\xbf\xbd which makes output longer and add unexpected bits.
That breaks the whole thing.