[Bug 136720] Re: does not send mail despite Unattended-Upgrade::Mail set
** Changed in: unattended-upgrades (Ubuntu) Status: Fix Committed = Fix Released -- does not send mail despite Unattended-Upgrade::Mail set https://bugs.launchpad.net/bugs/136720 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 136720] Re: does not send mail despite Unattended-Upgrade::Mail set
Thanks for your bugreport. This should be fixed with a better example in the configuration file and in the README file in hardy now. ** Changed in: unattended-upgrades (Ubuntu) Assignee: (unassigned) = Michael Vogt (mvo) Status: New = Fix Committed -- does not send mail despite Unattended-Upgrade::Mail set https://bugs.launchpad.net/bugs/136720 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 136720] Re: does not send mail despite Unattended-Upgrade::Mail set
when the configuration is done correctly as explained in the first comment (https://bugs.launchpad.net/ubuntu/+source/unattended- upgrades/+bug/136720/comments/1), everything works fine, mails are sent. -- does not send mail despite Unattended-Upgrade::Mail set https://bugs.launchpad.net/bugs/136720 You received this bug notification because you are a member of Ubuntu Bugs, which is the bug contact for Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 136720] Re: does not send mail despite Unattended-Upgrade::Mail set
Hi Nathan 1) Which version of Ubuntu and the unattended-upgrades package are you using? I believe the mail option was added in Feisty (Ubuntu 7.04) and is not available in early versions. 2) You say that the version of the /usr/bin/unattended-upgrade script you are using does only import apt_pkg and apt_inst, but all of the versions I've seen from 0.2 to 0.25 include a seperate import apt line a few lines later, usually in the following section: import warnings warnings.filterwarnings(ignore, apt API not stable yet, FutureWarning) import apt import logging Could you also check this by running: grep 'import.*apt' /usr/bin/unattended-upgrade 3) There is also an undeclared dependency on the mailx package - see bug #137994: https://bugs.launchpad.net/ubuntu/+source/unattended-upgrades/+bug/137994 So make sure that the mail binary from the mailx program is installed by running: ls -la /usr/bin/mail Or you can try my patch to use Python's own smtplib to send the emails. -- does not send mail despite Unattended-Upgrade::Mail set https://bugs.launchpad.net/bugs/136720 You received this bug notification because you are a member of Ubuntu Bugs, which is the bug contact for Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 136720] Re: does not send mail despite Unattended-Upgrade::Mail set
Ah. Installing mailx did it, thanks guys. -- does not send mail despite Unattended-Upgrade::Mail set https://bugs.launchpad.net/bugs/136720 You received this bug notification because you are a member of Ubuntu Bugs, which is the bug contact for Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 136720] Re: does not send mail despite Unattended-Upgrade::Mail set
Was there a conclusion to this issue? The script (/usr/bin/unattended- upgrade) currently only imports apt_pkg apt_inst, so apt_pkg.Config.Find() still yields no result despite the Unattended- Upgrade::Mail option being configured correctly. -- does not send mail despite Unattended-Upgrade::Mail set https://bugs.launchpad.net/bugs/136720 You received this bug notification because you are a member of Ubuntu Bugs, which is the bug contact for Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 136720] Re: does not send mail despite Unattended-Upgrade::Mail set
Looking at the python code in unattended-upgrade it could be a little difficult to include an info line in the log file because apt_pkg.Config.Find returns the same for an incorrect config as for no config at all. It would have to do an incorrect Perhaps a better method is to add a clear example of the syntax in the comments of the example config file. See bug #136452: https://bugs.launchpad.net/ubuntu/+source/unattended-upgrades/+bug/136452 -- does not send mail despite Unattended-Upgrade::Mail set https://bugs.launchpad.net/bugs/136720 You received this bug notification because you are a member of Ubuntu Bugs, which is the bug contact for Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 136720] Re: does not send mail despite Unattended-Upgrade::Mail set
Also the script uses the mail binary from the mailx package to send the email, but there is no dependency listed so it is not installed automatically. So could you please check that you have the mailx package installed? -- does not send mail despite Unattended-Upgrade::Mail set https://bugs.launchpad.net/bugs/136720 You received this bug notification because you are a member of Ubuntu Bugs, which is the bug contact for Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 136720] Re: does not send mail despite Unattended-Upgrade::Mail set
Answer to the first comment (https://bugs.launchpad.net/ubuntu/+source /unattended-upgrades/+bug/136720/comments/1) I had defined the mail variable in apt.conf.d/50unattended-upgrades as Unattended-Upgrade::Mail { [EMAIL PROTECTED]; }; Now I tried the change you suggested: Unattended-Upgrade::Mail [EMAIL PROTECTED]; Still, the python code import apt_pkg email = apt_pkg.Config.Find(Unattended-Upgrade::Mail, ) print email produces an empty result for me. -- does not send mail despite Unattended-Upgrade::Mail set https://bugs.launchpad.net/bugs/136720 You received this bug notification because you are a member of Ubuntu Bugs, which is the bug contact for Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 136720] Re: does not send mail despite Unattended-Upgrade::Mail set
to the second comment: mailx _is_ installed and works -- does not send mail despite Unattended-Upgrade::Mail set https://bugs.launchpad.net/bugs/136720 You received this bug notification because you are a member of Ubuntu Bugs, which is the bug contact for Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 136720] Re: does not send mail despite Unattended-Upgrade::Mail set
Have you also imported the python apt module with import apt? Eg: import apt, apt_pkg email = apt_pkg.Config.Find(Unattended-Upgrade::Mail, ) print email You should notice the loading of the apt module as it prints a warning message about the API not being stable yet. If that doesn't work then you could try a full dump of the config: apt-config dump | grep -i mail -- does not send mail despite Unattended-Upgrade::Mail set https://bugs.launchpad.net/bugs/136720 You received this bug notification because you are a member of Ubuntu Bugs, which is the bug contact for Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 136720] Re: does not send mail despite Unattended-Upgrade::Mail set
no, I had not imported the python apt module (I wonder why apt_pkg did not complain?). Now I have, and now email = apt_pkg.Config.Find(Unattended-Upgrade::Mail, ) indeed yields the configured mail address. Very good! So my configuration really was wrong (with Unattended-Upgrade::Mail configured as a list). Some complaint of unattended-upgrades in the log file would have been in order... Thanks. -- does not send mail despite Unattended-Upgrade::Mail set https://bugs.launchpad.net/bugs/136720 You received this bug notification because you are a member of Ubuntu Bugs, which is the bug contact for Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 136720] Re: does not send mail despite Unattended-Upgrade::Mail set
I'm not an expert on the unattended-upgrades package or the Python apt module, so some of this could be wrong. How have you defined the mail variable in the /etc/apt/apt.conf.d/ files? It is like this? Unattended-Upgrade::Mail { [EMAIL PROTECTED]; }; If so then I think this problem is that syntax defines a list, which is supposed to be read by the apt_pkg.Config.FindValueList function, eg: apt_pkg.Config.FindValueList(Unattended-Upgrade::Allowed-Origins) The unattended-upgrades python code expects the Unattended-Upgrade::Mail variable to be a single value and not a list, so I think it should look like this: Unattended-Upgrade::Mail [EMAIL PROTECTED]; Using the second form produces the correct values, but I've not yet tested that it will send any email. Would you be able to try again using that style and let me know if it works or not? -- does not send mail despite Unattended-Upgrade::Mail set https://bugs.launchpad.net/bugs/136720 You received this bug notification because you are a member of Ubuntu Bugs, which is the bug contact for Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs