aditya@aditya-pc:~$ sudo apt-get update
Reading package lists... Done
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/
W: Target Packages (partner/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target Packages (partner/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target Packages (partner/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target Translations (partner/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target Translations (partner/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target Translations (partner/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target DEP-11 (partner/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target DEP-11-icons (partner/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
1 Answers
First use the following command to fix the multiple lines error:
sudo rm /etc/apt/sources.list.d/xenial-partner.list*
or if the above command throws an error without the asterix at the end:
sudo rm /etc/apt/sources.list.d/xenial-partner.list
Then either reboot your computer or simply if you just started it wait a moment, it can be that you have unattended-updates activated and this process is locking the administrative directory. And if this still does not work, you can use the following command (beware, only use this if the situation not fixes itself after a moment of wait, as per @RoVo's comment):
sudo rm -vf /var/lib/apt/lists/*
The -v
option is for showing verbose output and the -f
option is for forcing the command, here combined into a single one -vf
. Remember to re run sudo apt update
after you deleted the actual lists from your machine.
For fixing the CD-Rom error you need to edit the first line/lines in your /etc/apt/sources.list
file and put a #
in front of those mentioning the cdrom so make:
deb cdrom://Ubuntu 16.04.1 LTS Xenial Xerus - Release amd64 (20160719) xenial
deb-src cdrom://Ubuntu 16.04.1 LTS Xenial Xerus - Release amd64 (20160719) xenial
into
# deb cdrom://Ubuntu 16.04.1 LTS Xenial Xerus - Release amd64 (20160719) xenial
# deb-src cdrom://Ubuntu 16.04.1 LTS Xenial Xerus - Release amd64 (20160719) xenial

- 33,355
- 17
- 105
- 120
-
$ sudo rm /etc/apt/sources.list.d/xenial-partner.list* rm: cannot remove '/etc/apt/sources.list.d/xenial-partner.list*': No such file or directory – Aarya Jun 14 '18 at 07:29
-
-
yes i did, how to fix these errors ........E: Failed to fetch cdrom://Ubuntu 16.04.1 LTS Xenial Xerus - Release amd64 (20160719)/dists/xenial/main/binary-amd64/Packages Please use apt-cdrom to allow APT to recognise this CD-ROM. 'apt-get update' cannot be used to add new CD-ROMs E: Some index files failed to download. – Aarya Jun 14 '18 at 09:04
-
I already answered this as well in my answer :) just do
sudo nano /etc/apt/sources.list
(oruse your favorite editor in terminal). To save the file in nano after your edit press ctrl+x and confirm withy
and hit return on choosing the file name. – Videonauth Jun 14 '18 at 09:12 -
sudo rm /var/lib/apt/lists/* -vf
. It seemed to help some people. – pLumo Jun 14 '18 at 07:31