I'm trying to setup automatic security updates on Ubuntu Server 12.04 LTS with an email response:

sudo apt-get install unattended-upgrades
sudo dpkg-reconfigure unattended-upgrades
# Answered Yes

The upgrades work, but I get the following email:

Subject: unattended-upgrades result for 'ubuntu' with an empty body and the attachment of unattended-upgrades result for 'ubuntu'.dat

Opening the .dat file in a text editor shows everything, but I'd like to just have this as the body

Here is contents of /etc/apt/apt.conf.d/50unattended-upgrades

// Automatically upgrade packages from these (origin:archive) pairs
Unattended-Upgrade::Allowed-Origins {
//      "${distro_id}:${distro_codename}-updates";
//      "${distro_id}:${distro_codename}-proposed";
//      "${distro_id}:${distro_codename}-backports";

// Send email to this address for problems or packages upgrades
// If empty or unset then no email is sent, make sure that you
// have a working mail setup on your system. A package that provides
// 'mailx' must be installed.
Unattended-Upgrade::Mail "cron@mydomainname.com";

Everything else is commented out

  • I can't find anything in the unattended-upgrades source code that would generate MIME or MIME attachments. What mail client are you using? – sarnold Jun 26 '13 at 23:24
  • Happened with both Outlook 2010 and Gmail web client. Here is the raw message: pastebin.ubuntu.com/5803192 – chrisan Jun 27 '13 at 0:09

Aha, thanks for the raw message, that makes all the difference.

The heirloom-mailx mailer is trying to be helpful; it isn't the unattended-upgrades script itself that is creating the attachments. If you want to keep heirloom-mailx, you can try creating a new configuration file to set the encoding variable to different values, and use the MAILRC environment variable to select the different configuration. Probably some configuration can be found that will just send along the data without any mangling.

Another option would be to use the bsd-mailx version of mailx(1) instead, it is less helpful and will just send raw data.

  • ahh thank you! I went for the bsd-mailx route and it worked perfectly. Thanks again (I'd upvote by apparently my stackoverflow rep doesnt carry over and I don't have enough rep here to upvote yet) – chrisan Jun 27 '13 at 0:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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