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,815