maas django app won't start "ImportError: No module named apt_pkg"

Bug #1446878 reported by Chris J Arges
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
Medium
Mike Pontillo
maas (Ubuntu)
Fix Released
Undecided
Andres Rodriguez

Bug Description

Installed MAAS fresh into an LXC container using stable PPA:
https://launchpad.net/~maas-maintainers/+archive/ubuntu/stable

sudo apt-get install maas maas-dhcp maas-dns

Then I check http://<host>/MAAS and get a 500 error:

[Tue Apr 21 21:43:16.219698 2015] [:error] [pid 11958:tid 140276131022592] [remote 10.38.36.4:1205] ImportError: No module named apt_pkg
[Tue Apr 21 21:43:18.218545 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] mod_wsgi (pid=11959): Exception occurred processing WSGI script '/usr/share/maas/wsgi.py'.
[Tue Apr 21 21:43:18.218587 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] Traceback (most recent call last):
[Tue Apr 21 21:43:18.218612 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__
[Tue Apr 21 21:43:18.218648 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] self.load_middleware()
[Tue Apr 21 21:43:18.218663 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 47, in load_middleware
[Tue Apr 21 21:43:18.218685 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] mw_instance = mw_class()
[Tue Apr 21 21:43:18.218698 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] File "/usr/lib/python2.7/dist-packages/maasserver/middleware.py", line 111, in __init__
[Tue Apr 21 21:43:18.218718 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] reverse('login'),
[Tue Apr 21 21:43:18.218731 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 536, in reverse
[Tue Apr 21 21:43:18.218751 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
[Tue Apr 21 21:43:18.218775 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 403, in _reverse_with_prefix
[Tue Apr 21 21:43:18.218798 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] self._populate()
[Tue Apr 21 21:43:18.218811 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 267, in _populate
[Tue Apr 21 21:43:18.218831 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] for pattern in reversed(self.url_patterns):
[Tue Apr 21 21:43:18.218844 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 365, in url_patterns
[Tue Apr 21 21:43:18.218887 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
[Tue Apr 21 21:43:18.218910 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 360, in urlconf_module
[Tue Apr 21 21:43:18.218935 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] self._urlconf_module = import_module(self.urlconf_name)
[Tue Apr 21 21:43:18.218949 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py", line 40, in import_module
[Tue Apr 21 21:43:18.218970 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] __import__(name)
[Tue Apr 21 21:43:18.218983 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] File "/usr/share/maas/maas/urls.py", line 28, in <module>
[Tue Apr 21 21:43:18.219003 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] url(r'^', include('maasserver.urls')),
[Tue Apr 21 21:43:18.219016 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] File "/usr/lib/python2.7/dist-packages/django/conf/urls/__init__.py", line 26, in include
[Tue Apr 21 21:43:18.219037 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] urlconf_module = import_module(urlconf_module)
[Tue Apr 21 21:43:18.219049 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py", line 40, in import_module
[Tue Apr 21 21:43:18.219069 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] __import__(name)
[Tue Apr 21 21:43:18.219081 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] File "/usr/lib/python2.7/dist-packages/maasserver/urls.py", line 329, in <module>
[Tue Apr 21 21:43:18.219101 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] (r'^api/1\\.0/', include('maasserver.urls_api'))
[Tue Apr 21 21:43:18.219114 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] File "/usr/lib/python2.7/dist-packages/django/conf/urls/__init__.py", line 26, in include
[Tue Apr 21 21:43:18.219133 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] urlconf_module = import_module(urlconf_module)
[Tue Apr 21 21:43:18.219145 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py", line 40, in import_module
[Tue Apr 21 21:43:18.219164 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] __import__(name)
[Tue Apr 21 21:43:18.219177 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] File "/usr/lib/python2.7/dist-packages/maasserver/urls_api.py", line 101, in <module>
[Tue Apr 21 21:43:18.219197 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] from maasserver.api.version import VersionHandler
[Tue Apr 21 21:43:18.219218 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] File "/usr/lib/python2.7/dist-packages/maasserver/api/version.py", line 23, in <module>
[Tue Apr 21 21:43:18.219241 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] from maasserver.utils.version import get_maas_version_subversion
[Tue Apr 21 21:43:18.219254 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] File "/usr/lib/python2.7/dist-packages/maasserver/utils/version.py", line 21, in <module>
[Tue Apr 21 21:43:18.219274 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] import apt_pkg
[Tue Apr 21 21:43:18.219296 2015] [:error] [pid 11959:tid 140276131022592] [remote 10.38.36.4:1205] ImportError: No module named apt_pkg

I can then install python-apt and fix this issue.

Related branches

Revision history for this message
Mike Pontillo (mpontillo) wrote :

I thought we recently fixed this. Either the version under test doesn't have the fix yet, or we missed the fix for some subset of MAAS packages. I will check tomorrow.

Changed in maas (Ubuntu):
assignee: nobody → Mike Pontillo (mpontillo)
Revision history for this message
Mike Pontillo (mpontillo) wrote :

This should have been fixed with the following commit to the packaging branch:

https://code.launchpad.net/~mpontillo/maas/packaging-python-apt-fix/+merge/255265

Changed in maas (Ubuntu):
status: New → Fix Committed
Changed in maas (Ubuntu):
status: Fix Committed → In Progress
assignee: Mike Pontillo (mpontillo) → Andres Rodriguez (andreserl)
Changed in maas:
assignee: nobody → Mike Pontillo (mpontillo)
status: New → Fix Committed
importance: Undecided → Medium
Revision history for this message
Adam Conrad (adconrad) wrote : Please test proposed package

Hello Chris, or anyone else affected,

Accepted maas into vivid-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/maas/1.7.3+bzr3363-0ubuntu2 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!

tags: added: verification-needed
Revision history for this message
Andres Rodriguez (andreserl) wrote :

This has been verified and proven to work.

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

This bug was fixed in the package maas - 1.7.3+bzr3363-0ubuntu2

---------------
maas (1.7.3+bzr3363-0ubuntu2) vivid; urgency=medium

  * Use python-django16 instead of python-django ( 1.7). MAAS does not
    support django 1.7 due to having a new migration system. (LP: #1447573)
  * Adding systemd units and packaging support. (LP: #1423613)
  * debian/control: Add missing dependency on python-apt. (LP: #1446878)
 -- Andres Rodriguez <email address hidden> Wed, 22 Apr 2015 12:10:50 -0400

Changed in maas (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Adam Conrad (adconrad) wrote : Update Released

The verification of the Stable Release Update for maas 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.

Revision history for this message
Nick (nyt1066) wrote :

Are there any plans to update this package in https://launchpad.net/~maas-maintainers/+archive/ubuntu/stable for 14.04?

Changed in maas:
status: Fix Committed → Fix Released
no longer affects: maas/1.7
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Related questions

Remote bug watches

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