Fatal exception failure of unattended-upgrade

Bug #1527106 reported by ChM
268
This bug affects 4 people
Affects Status Importance Assigned to Milestone
unattended-upgrades (Ubuntu)
Fix Released
Undecided
Unassigned
Wily
Fix Released
High
Unassigned

Bug Description

Every morning, since I upgraded to Ubuntu 15.10, I get a mail (root) reporting a fatal exception in unatteded-upgrade containing the following.

/etc/cron.daily/apt:
Exception: unsupported operand type(s) for %: 'bytes' and 'tuple'
Traceback (most recent call last):
  File "/usr/bin/unattended-upgrade", line 1435, in <module>
    main(options)
  File "/usr/bin/unattended-upgrade", line 1382, in main
    pkgs, pkg_install_success, pkgs_kept_back, mem_log, log_content)
  File "/usr/bin/unattended-upgrade", line 815, in send_summary_mail
    host(), res)
TypeError: unsupported operand type(s) for %: 'bytes' and 'tuple'

As a consequence no automatic updates are performed anymore, including security updates. For this reason I flag this as a security vulnerability although it is only indirect.

Manual updates is still working.

information type: Private Security → Public Security
Changed in unattended-upgrades (Ubuntu):
status: New → Confirmed
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks for your bugreport

Could you please attach the output of the commands:
$ locale
$ sudo -i locale
$ apt list -a unattended-upgrades
?

Thanks,
 Michael

Changed in unattended-upgrades (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
ChM (christophe-meessen) wrote : Re: [Bug 1527106] Re: Fatal exception failure of unattended-upgrade

Le 18/12/2015 09:40, Michael Vogt a écrit :
> Thanks for your bugreport
>
> Could you please attach the output of the commands:
> $ locale
> $ sudo -i locale
> $ apt list -a unattended-upgrades
> ?
>
> Thanks,
> Michael
>
> ** Changed in: unattended-upgrades (Ubuntu)
> Status: Confirmed => Incomplete
meessen@marc:~$ locale
LANG=fr_FR.UTF-8
LANGUAGE=fr:en
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC=fr_FR.UTF-8
LC_TIME=fr_FR.UTF-8
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY=fr_FR.UTF-8
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER=fr_FR.UTF-8
LC_NAME=fr_FR.UTF-8
LC_ADDRESS=fr_FR.UTF-8
LC_TELEPHONE=fr_FR.UTF-8
LC_MEASUREMENT=fr_FR.UTF-8
LC_IDENTIFICATION=fr_FR.UTF-8
LC_ALL=

meessen@marc:~$ sudo -i locale
Mot de passe [sudo] pour meessen :
LANG=fr_FR.UTF-8
LANGUAGE=fr:en
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC=fr_FR.UTF-8
LC_TIME=fr_FR.UTF-8
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY=fr_FR.UTF-8
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER=fr_FR.UTF-8
LC_NAME=fr_FR.UTF-8
LC_ADDRESS=fr_FR.UTF-8
LC_TELEPHONE=fr_FR.UTF-8
LC_MEASUREMENT=fr_FR.UTF-8
LC_IDENTIFICATION=fr_FR.UTF-8
LC_ALL=

meessen@marc:~$ apt list -a unattended-upgrades
En train de lister... Fait
unattended-upgrades/wily,now 0.86.2ubuntu1 all [installé]

Sorry for the french.

--
Bien cordialement,

Ch.Meessen

Revision history for this message
ChM (christophe-meessen) wrote :

The problem is still not solved.

I could fix the problem with the following change to the code.

In file /usr/bin/unattended-upgrade at line 814 I changed

        subject = _("unattended-upgrades result for '%s': '%s'") % (
            host(), res)

into

        tmp = _("unattended-upgrades result for '%s': '%s'")
        subject = tmp % (host(), res)

The error message then disappear.

Note that the same problem

Revision history for this message
ChM (christophe-meessen) wrote :

The problem only shows up when the following line has been uncommented in the file /etc/apt/apt.conf.d/50unattended-upgrades

Unattended-Upgrade::Mail "root";

Revision history for this message
ChM (christophe-meessen) wrote :

Unfortunately, the suggested fix doesn't work.

Revision history for this message
ChM (christophe-meessen) wrote :

The reported error is fixed by changing the line 814 In file /usr/bin/unattended-upgrade

        subject = _("unattended-upgrades result for '%s': '%s'") % (
            host(), res)

into

        subject = _("unattended-upgrades result for '{}': '{}'").format(
            host(), res)

Unfortunately the % formating is used in many places and changing this line doesn't definitely fix the problem with unattended-updates.

Worse. Every time unattended-upgrades tries to upgrade packages I end up with a broken package. I need to use synaptic to fix the broken package. Not sure if it is properly fixed.

Could someone please fix this issue ? This means people don't get their packages automatically upgraded. Doing it manually fails because of the broken package.

Revision history for this message
Michael Vogt (mvo) wrote :
Changed in unattended-upgrades (Ubuntu Wily):
status: New → In Progress
Changed in unattended-upgrades (Ubuntu):
status: Incomplete → Fix Released
Changed in unattended-upgrades (Ubuntu Wily):
importance: Undecided → High
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks for the bugreport and sorry for the slow reply. I was able to reproduce the issues and uploaded a fix to wily-proposed. The debdiff is attached.

Revision history for this message
Michael Vogt (mvo) wrote :

It affects systems that use utf-8 chars in the output. So system default English is fine, most other systems are not.

Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello ChM, or anyone else affected,

Accepted unattended-upgrades into wily-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/unattended-upgrades/0.86.2ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in unattended-upgrades (Ubuntu Wily):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
ChM (christophe-meessen) wrote :

Hello,

the problem is solved for me by using the proposed version of unattended-upgrades.
Thank you Brian for the detailed explanation for installing proposed packages.

From my point of you, the package is ready for release.

Thank you Michael.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unattended-upgrades - 0.86.2ubuntu1.1

---------------
unattended-upgrades (0.86.2ubuntu1.1) wily-proposed; urgency=medium

  * Revert the use of "lgettext", this fixes sending mails
    via unattended-upgrades (LP: #1527106)

 -- Michael Vogt <email address hidden> Thu, 21 Jan 2016 17:34:49 +0100

Changed in unattended-upgrades (Ubuntu Wily):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for unattended-upgrades has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public Security information  
Everyone can see this security related information.

Duplicates of this bug

Other bug subscribers

Patches

Remote bug watches

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