0

I was trying to upgrade from Ubuntu 16.04 to Ubuntu 18.04 and ran into the following error:

Failed to lock /var/cache/apt/archives/lock

I searched google/askubuntu/ubuntu subreddits for any previous troubleshooting steps, and everything has failed so far (as a start, on Ask Ubuntu, this thread leads to a lot of different solutions that unfortunately didn't work.

Has anyone run into this problem going from 16.04 to 18.04,and have been able to resolve it?

My output after running the system upgrader is as such:

Fetching

Could not download the upgrades 

The upgrade has aborted. Please check your Internet connection or 
installation media and try again. All files downloaded so far have 
been kept. 

Failed to lock /var/cache/apt/archives/lock 


Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-6o5gq951/bionic", line 8, in <module>
  File "/tmp/ubuntu-release-upgrader-6o5gq951/DistUpgrade/DistUpgradeMain.py", line 238, in main
  File "/tmp/ubuntu-release-upgrader-6o5gq951/DistUpgrade/DistUpgradeController.py", line 1949, in run
  File "/tmp/ubuntu-release-upgrader-6o5gq951/DistUpgrade/DistUpgradeController.py", line 1905, in fullUpgrade
  File "/tmp/ubuntu-release-upgrader-6o5gq951/DistUpgrade/DistUpgradeController.py", line 1201, in doDistUpgradeFetching
  File "/tmp/ubuntu-release-upgrader-6o5gq951/DistUpgrade/DistUpgradeController.py", line 1450, in abort
  File "/tmp/ubuntu-release-upgrader-6o5gq951/DistUpgrade/sourceslist.py", line 366, in restore_backup
  File "/usr/lib/python3.5/shutil.py", line 236, in copy
    copymode(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.5/shutil.py", line 138, in copymode
    chmod_func(dst, stat.S_IMODE(st.st_mode))
PermissionError: [Errno 1] Operation not permitted: '/etc/apt/sources.list'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 109, in apport_excepthook
    pr.add_proc_info(extraenv=['PYTHONPATH', 'PYTHONHOME'])
  File "/usr/lib/python3/dist-packages/apport/report.py", line 544, in add_proc_info
    self['ExecutableTimestamp'] = str(int(os.stat(self['ExecutablePath']).st_mtime))
PermissionError: [Errno 13] Permission denied: '/tmp/ubuntu-release-upgrader-6o5gq951/bionic'

Original exception was:
Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-6o5gq951/bionic", line 8, in <module>
  File "/tmp/ubuntu-release-upgrader-6o5gq951/DistUpgrade/DistUpgradeMain.py", line 238, in main
  File "/tmp/ubuntu-release-upgrader-6o5gq951/DistUpgrade/DistUpgradeController.py", line 1949, in run
  File "/tmp/ubuntu-release-upgrader-6o5gq951/DistUpgrade/DistUpgradeController.py", line 1905, in fullUpgrade
  File "/tmp/ubuntu-release-upgrader-6o5gq951/DistUpgrade/DistUpgradeController.py", line 1201, in doDistUpgradeFetching
  File "/tmp/ubuntu-release-upgrader-6o5gq951/DistUpgrade/DistUpgradeController.py", line 1450, in abort
  File "/tmp/ubuntu-release-upgrader-6o5gq951/DistUpgrade/sourceslist.py", line 366, in restore_backup
  File "/usr/lib/python3.5/shutil.py", line 236, in copy
    copymode(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.5/shutil.py", line 138, in copymode
    chmod_func(dst, stat.S_IMODE(st.st_mode))
PermissionError: [Errno 1] Operation not permitted: '/etc/apt/sources.list'
iuqiddis
  • 31
  • 2

1 Answers1

0

Your error exactly matches this bug report. The bug was marked critical in 2016 (at the 16.04 to 16.10 upgrade), but has apparently never been resolved.

Report your finding to revive the bug report from its dormancy. It appears to affect multiple people (as witnessed as well by several questions here on AskUbuntu).

The upside is that the bug report suggests some workarounds.

My suspicion is that the bug could be caused by an out-of-distro installation of Python packages. Did you install any Python version from source or from PPA's? If so, undo that, then retry the upgrade.

zwets
  • 12,354
  • I installed python via the repository, not the PPAs. I am actually a bit hesitant to remove and re-install python (its the only troubleshooting suggestion that I came across that I haven't done), but I will look over the bug report and maybe go ahead and try it. Thanks for the help and link. – iuqiddis Aug 07 '18 at 21:17