0
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
damadam
  • 2,833
Aarya
  • 1
  • have you tried to reboot your computer? – damadam Jun 14 '18 at 07:17
  • yes, but it couldn't work...have been getting msg.E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable) – Aarya Jun 14 '18 at 07:25
  • This can appear just because you're unlucky; the system beat you to the lock as it tried to check for new software; so in a few minutes if you tried again you'd likely be fine... – guiverc Jun 14 '18 at 07:25
  • @ https://ubuntuforums.org/showthread.php?t=1986288, people suggest to run this: sudo rm /var/lib/apt/lists/* -vf. It seemed to help some people. – pLumo Jun 14 '18 at 07:31
  • it worked but left some msg.....W: The repository 'cdrom://Ubuntu 16.04.1 LTS Xenial Xerus - Release amd64 (20160719) xenial Release' does not have a Release file. N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use. N: See apt-secure(8) manpage for repository creation and user configuration details. 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. 'E: Some index files failed to download. – Aarya Jun 14 '18 at 07:51

1 Answers1

1

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
Videonauth
  • 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
  • Ok can you please try it without the star at the end. – Videonauth Jun 14 '18 at 07:42
  • 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 with yand hit return on choosing the file name. – Videonauth Jun 14 '18 at 09:12
  • I am beginner could you explain in an easy way. – Aarya Jun 30 '18 at 17:15