I have just tried to upgrade to 13.10 from 13.04 and I have received the following error in console

Checking for a new Ubuntu release
authenticate 'saucy.tar.gz' against 'saucy.tar.gz.gpg' 
extracting 'saucy.tar.gz'
Traceback (most recent call last):
  File "/tmp/user/0/ubuntu-release-upgrader-xnzjbd/saucy", line 10, in <module>
  File "/tmp/user/0/ubuntu-release-upgrader-xnzjbd/DistUpgrade/DistUpgradeMain.py", line 240, in main
  File "/tmp/user/0/ubuntu-release-upgrader-xnzjbd/DistUpgrade/DistUpgradeMain.py", line 133, in save_system_state
  File "/tmp/user/0/ubuntu-release-upgrader-xnzjbd/DistUpgrade/apt_clone.py", line 149, in save_state
    self._write_state_sources_list(tar, scrub_sources)
  File "/tmp/user/0/ubuntu-release-upgrader-xnzjbd/DistUpgrade/apt_clone.py", line 241, in _write_state_sources_list
  File "/tmp/user/0/ubuntu-release-upgrader-xnzjbd/DistUpgrade/apt_clone.py", line 246, in _add_file_to_tar_with_password_check
    for line in f.readlines():
  File "/usr/lib/python2.7/codecs.py", line 296, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x9f in position 3: invalid start byte

This is in what I get in update-manager gui

do-release-upgrade crashed on UnicodeDecodeError in decode(): 'utf8' codec can't decode byte 0x9f in position 3 : invalid state
up vote 12 down vote accepted

Check out sources.list.d for any dotfiles (files starting with a period) containing binary garbage (which the python unicode decoder blows chunks on). I had this same problem and when I removed the dotfiles out of /etc/apt/sources.list.d/ it worked again.

  • 2
    Had the same problem. It was a Vim undo file that was causing Python to puke. – Dave Long Oct 22 '13 at 0:46
  • genius solution – iruvar Oct 24 '13 at 17:24
  • I have exactly the same problem but don't have any dot files. But disabled all the extra sources and it worked. – fccoelho Nov 6 '13 at 19:56

I had a slightly different cause and solution, but the answer by user204109 helped out on this one.

Basically, I had some non-conforming utf-8 characters in files under /etc/apt/sources.list.d/ inserted by earlier dist upgrade scripts. This is, because my native language has some non ASCII characters, and apparently the localization was not quite correct earlier.

Simplest way to find the culprits is to run:

cd /etc/apt/sources.list.d
file *.list

Then open in editor each of the files that is not listed as "ASCII text" and remove any characters that seem like garbage.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.