Comment 2 for bug 1986429

Revision history for this message
Rob Owens (hick518) wrote :

I managed to figure this out. I'm gonna say the bug here is poor logging.

In the output I posted, in the "Original exception was" section, the original error is:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xec in position 8200: invalid continuation byte

Go back up a couple lines and you'll see this:

File "/tmp/ubuntu-release-upgrader-l3yamuwr/DistUpgrade/DistUpgradeQuirks.py", line 395, in _test_and_fail_on_pam_tally

This is the upgrader script that was running when the error was thrown. Edit that file (as root) and go to line 395 and see that you're in a "for" loop:

        for f in os.listdir('/etc/pam.d'):
            if f in ('common-account', 'common-auth', 'common-password',
                     'common-session', 'common-session-noninteractive'):
                # managed by pam-auth-updates, and any references to
                # pam_tally* will be handled by libpam-modules on upgrade
                # without breaking
                continue
            with open(os.path.join('/etc/pam.d', f)) as f:
                content = f.read()
                if re.search('^[^#]*pam_tally', content, re.MULTILINE): <--- line 395
            <snipped>

The script is looping through files in /etc/pam.d. You can go look there for the trouble, or you can edit the script to find which file is being processed when the error is thrown. Like this:

        for f in os.listdir('/etc/pam.d'):
            print ("Rob says: " + f)
            <snipped>

Now run the upgrader again from this temporary directory, which includes the edits made above. Like this:

sudo /tmp/ubuntu-release-upgrader-l3yamuwr/DistUpgrade/jammy

We run the "jammy" script because that's what we're trying to upgrade to. If in doubt, do 'ls -l' on that directory and look for an executable script that is named after an ubuntu release.

After you run the above command, you'll still get an error but if you search the output for "Rob says", you'll see the list of files that are being processed in the "for" loop. The last one in the list before the error is the likely culprit. In my case it was:

.common-auth.swp

This is a vi swap file. Several months ago I apparently edited common-auth and didn't save it before the computer was shut down. I deleted that file and then ran:

sudo do-release-upgrade

and the upgrade is now running.

So the problem was that the upgrader tried to process a file but it could not (because it was not an ascii file). The upgrader should have, at the very least, output the name of the problematic file.