I can't install applications from the Software Center.
When I try to install an application from the Software Centre, I get an error saying:
Traceback (most recent call last):
File "/usr/lib/
return self._simulate_
File "/usr/lib/
return depends, status, self._cache.
File "/usr/lib/
pm.
SystemError: E:I wasn't able to locate file for the libqt4-network package. This might mean you need to manually fix this package.
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- David Jones
- Solved:
- Last query:
- Last reply:
Revision history for this message
|
#1 |
Open a new window ( ctl n ) then paste into address bar
/usr/lib/
this should ask if you want to open with gedit open it be sure your files are like this edit the ones you need to to make them look like these
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Provides AptWorker which processes transactions."""
# Copyright (C) 2008-2009 Sebastian Heinlein <email address hidden>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
__author__ = "Sebastian Heinlein <email address hidden>"
import fcntl
import logging
import os
import struct
import sys
import time
import traceback
import apt
import apt.cache
import apt.debfile
import apt_pkg
from gettext import gettext as _
import gobject
from softwarepropert
from enums import *
from errors import *
from progress import DaemonOpenProgress, \
log = logging.
class LockFailedError
"""The locking of file failed."""
def __init__(self, flock, process=None):
"""Return a new LockFailedError instance.
Keyword arguments:
flock -- the path of the file lock
process -- the process which holds the lock or None
"""
self.flock = flock
class AptWorker(
"""Worker which processes transactions from the queue."""
__gsignals__ = {"transaction-
def __init__(self):
self.trans = None
self._cache = None
def run(self, transaction):
"""Process the given transaction in the background.
Keyword argument:
transaction -- core.Transcation instance to run
"""
if self.trans:
raise Exception("There is already a running transacion")
self.trans = transaction
def _emit_transacti
"""Emit the transaction-done signal.
Keyword argument:
tid -- the id of the finished transaction
"""
def _process_
"""Run the worker"""
try:
# Prepare the package cache
if self.trans.role == ROLE_FIX_
elif not is_dpkg_
# Process transaction which can handle a broken dep cache
if self.trans.role == ROLE_FIX_
elif self.trans.role == ROLE_UPDATE_CACHE:
elif self.trans.role == ROLE_ADD_
elif self.trans.role == ROLE_REMOVE_
# Process the transactions which require a consistent cache
elif self._cache.
elif self.trans.role == ROLE_INSTALL_
elif self.trans.role == ROLE_INSTALL_FILE:
elif self.trans.role == ROLE_REMOVE_
elif self.trans.role == ROLE_UPGRADE_
elif self.trans.role == ROLE_UPGRADE_
elif self.trans.role == ROLE_COMMIT_
except TransactionCanc
except TransactionFailed, excep:
except (KeyboardInterrupt, SystemExit):
except Exception, excep:
else:
finally:
tid = self.trans.tid[:]
return False
def commit_
"""Perform a complex package operation.
Keyword arguments:
install - list of package names to install
reinstall - list of package names to reinstall
remove - list of package names to remove
purge - list of package names to purge including configuration files
upgrade - list of package names to upgrade
"""
#FIXME python-apt 0.8 introduced a with statement
ac = self._cache.
resolver = apt.cache.
def _resolve_
"""Resolve the dependencies using the given ProblemResolver."""
try:
except SystemError:
broken = [pkg.name for pkg in self._cache if pkg.is_inst_broken]
raise TransactionFail
def install_
"""Install packages.
Keyword argument:
"""
ac = self._cache.
resolver = apt.cache.
def _check_
"""Check if any of the cache changes get installed from an
if self.trans.
return
for pkg in self._cache:
if (pkg.markedInstall or
for origin in pkg.candidate.
if not trusted:
if unauthenticated:
raise TransactionFail
def _mark_packages_
"""Mark packages for installation."""
for pkg_name in package_names:
if self._cache.
pkg = self._cache[
else:
if reinstall:
if not pkg.isInstalled:
else:
if pkg.isInstalled:
def add_vendor_
"""Add the signing key from the given file to the trusted vendors.
Keyword argument:
path -- absolute path to the key file
"""
try:
#FIXME: use gobject.spawn_async or reactor.spawn
#FIXME: use --dry-run before?
auth = AptAuth()
except Exception, error:
raise TransactionFail
def remove_
"""Remove repository key.
Keyword argument:
fingerprint -- fingerprint of the key to remove
"""
try:
#FIXME: use gobject.spawn_async or reactor.spawn
#FIXME: use --dry-run before?
auth = AptAuth()
except Exception, error:
raise TransactionFail
def install_file(self, path):
"""Install local package file.
Keyword argument:
path -- absolute path to the package file
"""
# Check if the dpkg can be installed at all
deb = apt.debfile.
if not deb.check():
raise TransactionFail
# Check for required changes and apply them before
(install, remove, unauth) = deb.required_
if len(install) > 0 or len(remove) > 0:
# Install the dpkg file
if deb.install(
raise TransactionFail
def remove_
"""Remove packages.
Keyword argument:
"""
ac = self._cache.
resolver = apt.cache.
#FIXME: should we use a persistant cache? make a check?
#for p in pkgs:
# if self._cache.
# self.ErrorCode(
# self.Finished(
# return
def _mark_packages_
"""Mark packages for installation."""
for pkg_name in package_names:
if not self._cache.
pkg = self._cache[
if not pkg.isInstalled:
if pkg._pkg.Essential == True:
def _check_
"""Mark obsoleted dependencies of to be removed packages for removal."""
if not self.trans.
return
ac = self._cache.
for pkg in self._cache:
if pkg.markedDelete:
for dep_name in installed_deps:
if dep_name in self._cache:
pkg = self._cache[
if pkg.isInstalled and pkg.isAutoRemov
def _installed_
#FIXME: Should be part of python-apt, since it makes use of non-public
# API. Perhaps by adding a recursive argument to
# apt.package.
if not all_deps:
if not pkg_name in self._cache:
return all_deps
cur = self._cache[
if not cur:
return all_deps
for t in ("PreDepends", "Depends", "Recommends"):
try:
for dep in cur.DependsList[t]:
except KeyError:
return all_deps
def upgrade_
"""Upgrade packages.
Keyword argument:
"""
ac = self._cache.
resolver = apt.cache.
def _mark_packages_
"""Mark packages for upgrade."""
for pkg_name in package_names:
if not self._cache.
pkg = self._cache[
if not pkg.isInstalled:
auto = not self._cache.
def update_cache(self):
"""Update the cache."""
progress = DaemonFetchProg
try:
except apt.cache.
for uri, status in progress.
if status == apt.progress.
if failed_downloads:
except apt.cache.
raise TransactionCanc
except SystemError, excep:
raise TransactionFail
def upgrade_
"""Upgrade the system.
Keyword argument:
safe_mode -- if additional software should be installed or removed to
"""
# Check for available updates
updates = filter(lambda p: p.isUpgradable,
#FIXME: What to do if already uptotdate? Add error code?
# Check for blocked updates
outstanding = []
changes = self._cache.
for pkg in updates:
if not pkg in changes or not pkg.markedUpgrade:
#FIXME: Add error state if system could not be fully updated
def fix_incomplete_
"""Run dpkg --configure -a to recover from a failed installation."""
progress = DaemonDpkgRecov
if progress.
raise TransactionFail
def fix_broken_
"""Try to fix broken dependencies."""
try:
except SystemError:
broken = [pkg.name for pkg in self._cache if pkg.is_inst_broken]
raise TransactionFail
def _open_cache(self, begin=0, end=5, quiet=False):
"""Open the APT cache.
Keyword arguments:
start -- the begin of the progress range
end -- the end of the the progress range
quiet -- if True do no report any progress
"""
try:
if not isinstance(
else:
except Exception, excep:
raise TransactionFail
def _lock_cache(self):
"""Lock the APT cache."""
try:
except LockFailedError, error:
if error.process:
msg = "Waiting for %s to exit" % error.process
while self.trans.paused and not self.trans.
if self.trans.
def _watch_lock(self):
"""Unpause the transaction if the lock can be obtained."""
try:
except LockFailedError:
return True
return False
def _unlock_
"""Unlock the APT cache."""
if self._lock_fd != -1:
def _commit_
"""Commit previously marked changes to the cache.
Keyword arguments:
fetch_range -- tuple containing the start and end point of the
"""
changes = self._cache.
if not changes:
return
# Do not allow to remove essential packages
for pkg in changes:
if pkg.marked_delete and (pkg.essential == True or \
if self.trans.
raise TransactionCanc
try:
except apt.cache.
raise TransactionFail
except apt.cache.
raise TransactionCanc
except SystemError, excep:
# Run dpkg --configure -a to recover from a failed transaction
output = inst_progress.
raise TransactionFail
class DummyWorker(
"""Allows to test the daemon without making any changes to the system."""
def run(self, transaction):
"""Process the given transaction in the background.
Keyword argument:
transaction -- core.Transcation instance to run
"""
if self.trans:
raise Exception("There is already a running transacion")
self.trans = transaction
def _process_
"""Run the worker"""
if trans.cancelled:
elif trans.progress == 100:
else:
if trans.role == ROLE_INSTALL_
if trans.progress == 1:
elif trans.role == ROLE_REMOVE_
if trans.progress == 1:
return True
self.status = STATUS_FINISHED
tid = self.trans.tid[:]
self.trans = None
return False
def lock_pkg_system():
"""Lock the package system and provide information if this cannot be done.
This is a reemplemenataion of apt_pkg.
handle an incomplete dpkg run separately.
"""
def get_lock_
"""Return the file descriptor of the lock file or raise
"""
fd_lock = apt_pkg.
if fd_lock < 0:
process = None
try:
# Get the pid of the locking application
flk = struct.
pid = struct.
# Get the command of the pid
except:
raise LockFailedError
else:
return fd_lock
# Try the lock in /var/cache/
# this is because apt-get install will hold it all the time
# while the dpkg lock is briefly given up before dpkg is
# forked off. this can cause a race (LP: #437709)
lock_archive = os.path.
lock_fd_archive = get_lock_
os.
# Then the status lock
status_file = apt_pkg.
lock_sys = os.path.
return get_lock_
def is_dpkg_
"""Return False if there are traces of incomplete dpkg status updates."""
status_file = apt_pkg.
status_updates = os.path.
for dentry in os.listdir(
if dentry.isdigit():
return False
return True
# vim:ts=4:sw=4:et
once your files match these save the changes and close.
you may have to reboot but i doubt it.
David
in TN
Revision history for this message
|
#3 |
Thanks David Jones, that solved my question.