anacron jobs run with wrong environment variables

Bug #1209146 reported by Andrey Bondarenko on 2013-08-07
This bug affects 2 people
Affects Status Importance Assigned to Milestone
anacron (Ubuntu)

Bug Description

In Ubuntu 13.04 (anacron-2.3-19ubuntu2) is started from /etc/cron.d/anacron like this

start -q anacron

This means anacron itself and its child processes would inherit environment from init/upstart not from crond. As result all environment variables defined in /etc/environment won't be set (upstart does not use In my case, this leads to debtags job failed with network unreachable error, because my host is behind a proxy and http_proxy variable is defined in /etc/environment.

The bug does not affect Debian with Init System V, because invoke-rc.d would start rc script directly.

I suppose anacron should be either started directly from /etc/cron.d/anacron or modified so it use pam to properly initialize session for a job.

latimerio (fomember) wrote :

I administer >100 hosts with 12.04LTS and 14.04LTS and the problem with anacron not respecting proxy settings is very annoying.
I have set the proxy in /etc/apt/apt.d/95proxies in /etc/environment and with gsettings as recommended in but still anacron reports errors from e.g. update-notifier-common that it cannot update the flashplugin

Traceback (most recent call last):
  File "/usr/lib/update-notifier/package-data-downloader", line 234, in process_download_requests
    dest_file = urllib.urlretrieve(files[i])[0]
  File "/usr/lib/python2.7/", line 93, in urlretrieve
    return _urlopener.retrieve(url, filename, reporthook, data)
  File "/usr/lib/python2.7/", line 239, in retrieve
    fp =, data)
  File "/usr/lib/python2.7/", line 207, in open
    return getattr(self, name)(url)
  File "/usr/lib/python2.7/", line 344, in open_http
  File "/usr/lib/python2.7/", line 954, in endheaders
  File "/usr/lib/python2.7/", line 814, in _send_output
  File "/usr/lib/python2.7/", line 776, in send
  File "/usr/lib/python2.7/", line 757, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/", line 571, in create_connection
    raise err
IOError: [Errno socket error] [Errno 101] Network is unreachable
flashplugin-installer: downloading

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in anacron (Ubuntu):
status: New → Confirmed
Josep Pujadas-Jubany (jpujades) wrote :

/usr/lib/update-notifier/package-data-downloader from update-notifier uses python urllib

It seems to be problems when using proxies. In addition, urllib doesn't supports https protocol.

Using a http proxy, adobe-flashplugin updates will work but not allways:

urllib.urlretrieve("", "adobe-flashplugin.tar.gz")

Using a https proxy, pepflashpluguin updates will never work:

urllib.urlretrieve("", "google-chrome.deb")

So, scripts must be something like:

export http_proxy=
export https_proxy=
apt-get install -y flashplugin-installer
apt-get install -y pepflashplugin-installer
echo "" >> /etc/chromium-browser/default
echo ". /usr/lib/pepflashplugin-installer/" >> /etc/chromium-browser/default
echo "" >> /etc/chromium-browser/default
unset http_proxy
unset https_proxy
apt-get --reinstall install -y flashplugin-installer
apt-get --reinstall install -y pepflashplugin-installer

Of course, if yo do this, your corporative firewall/proxy must allow direct connections to (http) and (https).

In my opinion, update-notifier (and other applications using urllib) should avoid python urllib

There are many bugs related (in fact, they are duplicated):

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

Other bug subscribers