Internal Server Error when trying to determine MAAS version from apt-cache

Bug #1489529 reported by Andres Rodriguez
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Ricardo Bánffy

Bug Description

apt cache was borked, and it couldn't extract the maas version for the webpage, causing an internal server error.

Related branches

Changed in maas:
milestone: none → 1.9.0
Changed in maas:
status: New → Confirmed
Changed in maas:
importance: Undecided → High
Gavin Panella (allenap)
Changed in maas:
status: Confirmed → Triaged
no longer affects: maas/1.8
Revision history for this message
Ricardo Bánffy (rbanffy) wrote :

In order to reproduce the problem, run `sudo rm -rf /var/lib/dpkg/` on your machine. It's not easy to recover from it, so, do it only if you need to see the problem happening.

Revision history for this message
Ricardo Bánffy (rbanffy) wrote :

Alternatively, you can just move the /var/lib/dpkg directory someplace dpkg will not find it. It's much easier to recover that way. What you'll get in the logs is a traceback like this:

==> /var/log/maas/regiond.log <==
2015-10-14 06:27:24 [HTTPChannel,2,127.0.0.1] 500 Error - /MAAS/
 Traceback (most recent call last):
   File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 206, in __call__
     response = self.get_response(request)
   File "/usr/lib/python2.7/dist-packages/maasserver/utils/views.py", line 236, in get_response
     response = get_response(request)
   File "/usr/lib/python2.7/dist-packages/maasserver/utils/views.py", line 210, in get_response
     return django_get_response(request)
   File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 194, in get_response
     response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
 --- <exception caught here> ---
   File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 137, in get_response
     response = response.render()
   File "/usr/lib/python2.7/dist-packages/django/template/response.py", line 105, in render
     self.content = self.rendered_content
   File "/usr/lib/python2.7/dist-packages/django/template/response.py", line 81, in rendered_content
     context = self.resolve_context(self.context_data)
   File "/usr/lib/python2.7/dist-packages/django/template/response.py", line 159, in resolve_context
     return RequestContext(self._request, context, current_app=self._current_app)
   File "/usr/lib/python2.7/dist-packages/django/template/context.py", line 169, in __init__
     self.update(processor(request))
   File "/usr/lib/python2.7/dist-packages/maasserver/context_processors.py", line 111, in global_options
     'version': get_maas_version_ui(),
   File "/usr/lib/python2.7/dist-packages/maasserver/utils/version.py", line 82, in wrapped
     _cache[key] = fun(*args, **kwargs)
   File "/usr/lib/python2.7/dist-packages/maasserver/utils/version.py", line 118, in get_maas_version_ui
     version, subversion = get_maas_version_subversion()
   File "/usr/lib/python2.7/dist-packages/maasserver/utils/version.py", line 82, in wrapped
     _cache[key] = fun(*args, **kwargs)
   File "/usr/lib/python2.7/dist-packages/maasserver/utils/version.py", line 98, in get_maas_version_subversion
     apt_version = get_maas_package_version()
   File "/usr/lib/python2.7/dist-packages/maasserver/utils/version.py", line 82, in wrapped
     _cache[key] = fun(*args, **kwargs)
   File "/usr/lib/python2.7/dist-packages/maasserver/utils/version.py", line 92, in get_maas_package_version
     return get_version_from_apt(REGION_PACKAGE_NAME)
   File "/usr/lib/python2.7/dist-packages/maasserver/utils/version.py", line 39, in get_version_from_apt
     cache = apt_pkg.Cache(None)
 exceptions.SystemError: E:Could not open file /var/lib/dpkg/status - open (2: No such file or directory), E:The package lists or status file could not be parsed or opened.

Changed in maas:
assignee: nobody → Ricardo Bánffy (rbanffy)
Revision history for this message
Blake Rouse (blake-rouse) wrote :

To resolve this bug we should be using dpkg instead of apt to get the MAAS version. Because if there is an issue with APT then this will occur. What you did probably just destroyed all your packaging information on your machine. The easier way of reproducing this would be to add a source to sources.list that is invalid and then doing "apt-get update". Now see if it falls over, which it should. In that case dpkg will return the correct result.

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

Other bug subscribers

Remote bug watches

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