3

I receive an error message when I try to upgrade from 16.04 to 16.10 and opened the traceback:

unattended_upgrade crashed with apt.cache.LockFailedException in_fetch_archives():
Failed to lock /var/cache/apt/archives/lock

I found it was linked to a python file called unattended_upgrade. This was referencing a file called cache.py and the traceback said it wasn't working in line 338, which I found to be this:

# get lock
lockfile = apt_pkg.config.find_dir("Dir::Cache::Archives") + "lock"
lock = apt_pkg.get_lock(lockfile)
if lock < 0:
    raise LockFailedException("Failed to lock %s" % lockfile)

try:
    # this may as well throw a SystemError exception
    if not pm.get_archives(fetcher, self._list, self._records):
        return False
    # now run the fetcher, throw exception if something fails to be
    # fetched
    return self._run_fetcher(fetcher)
finally:
    os.close(lock)

This code is in python 3 and I don't know what it does or how to fix it, but it won't let me upgrade. Thanks in advance

1

1 Answer 1

2

Try

sudo rm -f /var/cache/apt/archives/lock
sudo apt-get -f -y remove
sudo apt-get -f -y update

I'm not sure that I correctly remembered these commands, so just try it.

1
  • 2
    After removing the lock, sudo apt autoremove, sudo apt update and sudo apt upgrade worked for me.
    – mivk
    Sep 22, 2017 at 10:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .