Upgrade to 13.10 crashes because of hidden file

Bug #1254447 reported by Bram Moolenaar
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt-clone (Ubuntu)
Fix Released
High
Brian Murray
ubuntu-release-upgrader (Ubuntu)
Fix Released
High
Unassigned

Bug Description

Following the normal procedure to upgrade with the update manager doesn't work. No error message, just stops working.
Starting it from the command line: sudo update-manager -d
Produces a stack trace in the terminal. The error is: UnicodeDecodeError: 'utf8' codec can't decode byte ...
This is in function _add_file_to_tar_with_password_check
(Sorry, didn't copy the whole stack trace; however you should be able to reproduce it from the instructions below).

The cause was a hidden file in /etc/apt/sources.list.d
This is a Vim undo file, which has a binary format, thus not utf-8 encoded: .google-chrome.list.un~

1. First of all, if the updater crashes with a stack trace, a dialog should appear to report the error.
    Pointing to the log file, which I later found out to be /var/log/dist-upgrade/main.log, would be helpful.
   I waited several minutes, thinking that it was busy in the background.

2. The update must ignore hidden files. The user may edit files with Vim, which may leave hidden undo files behind.
    A better solution is to only use files that are known to be relevant, not blindly processing every random file.

3. If the update fails to read a file there should be an option to ignore the error and continue. Listing the file name and/or contents should give the user a hint about what he is skipping. This is the only way the upgrade can continue from a damaged system without the user manually hunting around for problems and guessing how to fix them.
---
ApportVersion: 2.12.5-0ubuntu2.1
Architecture: i386
CrashDB: ubuntu
DistroRelease: Ubuntu 13.10
InstallationDate: Installed on 2012-11-18 (371 days ago)
InstallationMedia: Ubuntu 12.10 "Quantal Quetzal" - Release i386 (20121017.2)
MarkForUpload: True
NonfreeKernelModules: nvidia
Package: ubuntu-release-upgrader (not installed)
ProcVersionSignature: Ubuntu 3.11.0-13.20-generic 3.11.6
Tags: saucy dist-upgrade
Uname: Linux 3.11.0-13-generic i686
UpgradeStatus: Upgraded to saucy on 2013-11-24 (0 days ago)
UserGroups: adm cdrom dip lpadmin plugdev sambashare sudo
VarLogDistupgradeAptclonesystemstate.tar.gz: Error: command ['pkexec', 'cat', '/var/log/dist-upgrade/apt-clone_system_state.tar.gz'] failed with exit code 126: Error executing command as another user: Request dismissed
VarLogDistupgradeTermlog:

Revision history for this message
N1ck 7h0m4d4k15 (nicktux) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. Please execute the following command, as it will automatically gather debugging information, in a terminal:

apport-collect 1254447

When reporting bugs in the future please use apport by using 'ubuntu-bug' and the name of the package affected. You can learn more about this functionality at https://wiki.ubuntu.com/ReportingBugs.

Changed in ubuntu-release-upgrader (Ubuntu):
status: New → Incomplete
Revision history for this message
Bram Moolenaar (bram-moolenaar) wrote :

Fortunately (for reporting the bug), after upgrading to 13.10, trying to upgrade to 14.04 has the same problem:

/home/mool 30 % sudo update-manager -d
[sudo] password for mool:
Checking for a new Ubuntu release
authenticate 'trusty.tar.gz' against 'trusty.tar.gz.gpg'
extracting 'trusty.tar.gz'
Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-qwg0du/trusty", line 10, in <module>
    sys.exit(main())
  File "/tmp/ubuntu-release-upgrader-qwg0du/DistUpgrade/DistUpgradeMain.py", line 240, in main
    save_system_state(logdir)
  File "/tmp/ubuntu-release-upgrader-qwg0du/DistUpgrade/DistUpgradeMain.py", line 133, in save_system_state
    scrub_sources=True)
  File "/tmp/ubuntu-release-upgrader-qwg0du/DistUpgrade/apt_clone.py", line 149, in save_state
    self._write_state_sources_list(tar, scrub_sources)
  File "/tmp/ubuntu-release-upgrader-qwg0du/DistUpgrade/apt_clone.py", line 241, in _write_state_sources_list
    "./etc/apt/sources.list.d/"+source)
  File "/tmp/ubuntu-release-upgrader-qwg0du/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

tags: added: apport-collected dist-upgrade saucy
description: updated
Revision history for this message
Bram Moolenaar (bram-moolenaar) wrote : ProcEnviron.txt

apport information

Revision history for this message
Bram Moolenaar (bram-moolenaar) wrote : VarLogDistupgradeLspcitxt.txt

apport information

Revision history for this message
Bram Moolenaar (bram-moolenaar) wrote : VarLogDistupgradeMainlog.txt

apport information

Changed in ubuntu-release-upgrader (Ubuntu):
status: Incomplete → New
Revision history for this message
Brian Murray (brian-murray) wrote : Re: Upgrade to 13.30 crashes because of hidden file

With regards to point number 1:

1. First of all, if the updater crashes with a stack trace, a dialog should appear to report the error.
    Pointing to the log file, which I later found out to be /var/log/dist-upgrade/main.log, would be helpful.
   I waited several minutes, thinking that it was busy in the background.

I would expect the upgrader to present you with a crash dialog and a bug reporting wizard to be launched. Do you have a crash file in /var/crash? It would be named after the binary so something like _usr_bin_update-manager.

Revision history for this message
Brian Murray (brian-murray) wrote :

How did you determine that it was the undo file causing the issue? I tried to recreate this with apt-clone (which is used by the release upgrader to save information about the system state) after having made a vim undo file in my /etc/apt/sources.list.d/ folder. Running apt-clone clone I was able to create a clone file and did not receive a crash with the undo file. Do any of your other sources files have unicode in them? Thanks in advance!

Changed in ubuntu-release-upgrader (Ubuntu):
status: New → Incomplete
Revision history for this message
Bram Moolenaar (bram-moolenaar) wrote :

% sudo ls -la /etc/apt/sources.list.d
total 28
drwxr-xr-x 2 root root 4096 Nov 24 20:04 .
drwxr-xr-x 6 root root 4096 Nov 25 21:09 ..
-rw-r--r-- 1 root root 176 Nov 24 20:04 google-chrome.list
-rw-r--r-- 1 root root 207 Nov 24 20:03 google-chrome.list~
-rw-r--r-- 1 root root 176 Nov 24 13:59 google-chrome.list.distUpgrade
-rw-r--r-- 1 root root 209 Nov 24 19:22 google-chrome.list.save
-rw-r--r-- 1 root root 1714 Nov 24 20:04 .google-chrome.list.un~
-rw-r--r-- 1 root root 0 Nov 24 19:22 xorg-edgers-ppa-saucy.list
-rw-r--r-- 1 root root 0 Nov 24 19:22 xorg-edgers-ppa-saucy.list.save

In this situation I get the mentioned stack trace.

% sudo rm /etc/apt/sources.list.d/.google-chrome.list.un~

Now the stack trace does not happen.
QED.

The undo file was created by reverting the change caused by upgrading, the Google source line was commented out, using Vim with 'undofile' enabled.

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for ubuntu-release-upgrader (Ubuntu) because there has been no activity for 60 days.]

Changed in ubuntu-release-upgrader (Ubuntu):
status: Incomplete → Expired
Changed in ubuntu-release-upgrader (Ubuntu):
status: Expired → Confirmed
importance: Undecided → High
Changed in apt-clone (Ubuntu):
status: New → In Progress
assignee: nobody → Brian Murray (brian-murray)
importance: Undecided → High
summary: - Upgrade to 13.30 crashes because of hidden file
+ Upgrade to 13.10 crashes because of hidden file
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apt-clone - 0.3.1~ubuntu8

---------------
apt-clone (0.3.1~ubuntu8) trusty; urgency=medium

  * Fix path for setting permissions of restored /etc/apt/sources.list
 -- Brian Murray <email address hidden> Mon, 10 Feb 2014 10:36:19 -0800

Changed in apt-clone (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote :

The new version of apt-clone is now included with the release upgrader tarball for trusty.

Changed in ubuntu-release-upgrader (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.