1

I am unable to upgrade Ubuntu from 16.04 to 16.10.

Error message:

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

There are numerous answers on how to fix it. I tried all. But no success. Can anybody help?

Existing posts on the same topic:

Error Message:

Calculating the changes    
Calculating the changes
Do you want to start the upgrade?     
10 installed packages are no longer supported by Canonical. You can 
still get support from the community. 
16 packages are going to be removed. 293 new packages are going to be 
installed. 1842 packages are going to be upgraded. 
Installing the upgrade can take several hours. Once the download has 
finished, the process cannot be canceled. 
 Continue [yN]  Details [d]y
Fetching Fetched 0 B in 0s (0 B/s)                                   
Upgrading
Could not download the upgrades 
The upgrade has aborted. Please check your Internet connection or 
installation media and try again. 

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

Traceback (most recent call last):   File
"/tmp/ubuntu-release-upgrader-kfjtjdko/yakkety", line 8, in <module>  
File
"/tmp/ubuntu-release-upgrader-kfjtjdko/DistUpgrade/DistUpgradeMain.py",
line 242, in main   File
"/tmp/ubuntu-release-upgrader-kfjtjdko/DistUpgrade/DistUpgradeController.py",
line 1880, in run   File
"/tmp/ubuntu-release-upgrader-kfjtjdko/DistUpgrade/DistUpgradeController.py",
line 1845, in fullUpgrade   File
"/tmp/ubuntu-release-upgrader-kfjtjdko/DistUpgrade/DistUpgradeController.py",
line 1263, in doDistUpgrade   File
"/tmp/ubuntu-release-upgrader-kfjtjdko/DistUpgrade/DistUpgradeController.py",
line 1385, in abort   File
"/tmp/ubuntu-release-upgrader-kfjtjdko/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-kfjtjdko/yakkety'

Original exception was: Traceback (most recent call last):   File
"/tmp/ubuntu-release-upgrader-kfjtjdko/yakkety", line 8, in <module>  
File
"/tmp/ubuntu-release-upgrader-kfjtjdko/DistUpgrade/DistUpgradeMain.py",
line 242, in main   File
"/tmp/ubuntu-release-upgrader-kfjtjdko/DistUpgrade/DistUpgradeController.py",
line 1880, in run   File
"/tmp/ubuntu-release-upgrader-kfjtjdko/DistUpgrade/DistUpgradeController.py",
line 1845, in fullUpgrade   File
"/tmp/ubuntu-release-upgrader-kfjtjdko/DistUpgrade/DistUpgradeController.py",
line 1263, in doDistUpgrade   File
"/tmp/ubuntu-release-upgrader-kfjtjdko/DistUpgrade/DistUpgradeController.py",
line 1385, in abort   File
"/tmp/ubuntu-release-upgrader-kfjtjdko/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'
Zanna
  • 70,465
Karthik
  • 25

2 Answers2

1

I had the same issue where I got Failed to lock /var/cache/apt/archives/lock every single time I tried the upgrade.

I did everything as described here, except to start update-manager with sudo.

So:

  1. sudo apt-get update

  2. sudo apt-get upgrade

  3. sudo apt-get dist-upgrade

  4. sudo update-manager -d

... and finally, on the 27th try, it worked out.

toraritte
  • 119
0

Which of these two did you do:

sudo apt-get dist-upgrade
apt-get dist-upgrade?

I'd almost dare say that your user doesn't have the correct permissions. I receive similar but much shorter output if I run without sudo.

Open the terminal and type

groups

What is the output that you get?


Links

The links that you posted might actually have the answer without being a direct answer.

The third link contained another link with directions on how to remove a lock on a file Answer with removing lock

One of the other links specified that having any open program that also touches that file is what causes it to be locked to begin with. Have you made sure that there isn't an update process launching by default when you turn on your PC? I'd make sure that you don't have an update process starting and then reboot and try again. Rebooting will kill the program and if it doesn't auto-start, the lock should be gone and therefore the problem should not persist.

D75
  • 142
  • Thanks.I have tried only via "SW updater GUI" and not via command line. response to command 'groups' is ''karthik adm dialout cdrom sudo dip plugdev lpadmin sambashare chrome-remote-desktop". I have tried the the link you quoted but no matter how many times i delete the 'lock' file;i get same update failure message. Also i have ensured no other update is in progress – Karthik Nov 20 '16 at 07:11