Fix the Failure to Fetch Error Looking Like E: Could not open file /var/lib/apt/lists/mirror.rackspace.com after running apt-get upgrade. This peculiar error can thrown after fix of ShellShock bug and a bug related to Xen Virtualization. In case of Infrastructure Managed Rackspace Account or device which is only maintained by you or for development, you need to fix the issue yourself. Moreover, this is basically a help guide for anyone.
Why Fix E: Could not open file /var/lib/apt/lists/mirror.rackspace.com Shows Up?
Peculiarly it happened only to one 01 GB PVHVM device for us. With the same method of update, upgrade; this error never popped up on SSH screen for us. It is possibly related to two things :
- python is not properly installed or not upgraded but nova-agent and backspace-cloud-monitoring tool depends on it.
- signature verification related error
- Ownership of
/var/lib/apthas been changed
- ServiceNet data connection related issue ( previous update or upgrade related )
It is unlikely that you have done some sin. Fix is easy. We deliberately gave the article’s title E: Could not open file /var/lib/apt/lists/mirror.rackspace.com, so that you can fix faster. Actually the patch will work for all.
Fix E: Could not open file /var/lib/apt/lists/mirror.rackspace.com
Nothing to fear. We have provided 3 ways. Whatever solves, you must read the full guide. There are must to do steps are written at the end.
If Python materials are not installed, you’ll get instruction on the SSH output. Essentially you have to run this command :Advertisement
apt-get -f install
and manually accept the update. You should skip this step if there is no such instruction is showing up on SSH screen. Run this one first :
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 176A5C84ED67C9ED
Now, try to run apt-get upgrade :
You should be able to upgrade smoothly, again run
apt-get update -y and
apt-get upgrade, finally type
reboot to restart. After the device reboots up, again do SSH and run the commands to make sure that the things are fine.
If the above method fails (it is unlikely), change directory to
cd /var/lib/apt and run
ls -al command :
cd /var/lib/apt && ls -al
Output should be like this :
drwxr-xr-x 6 root root 4096 Oct 29 16:26 .
drwxr-xr-x 39 root root 4096 Oct 17 08:28 ..
-rw-r--r-- 1 root root 4589 Oct 29 16:26 extended_states
drwxr-xr-x 2 root root 4096 Jul 2 18:08 keyrings
drwxr-xr-x 3 root root 12288 Oct 29 16:20 lists
drwxr-xr-x 3 root root 4096 Jul 2 18:08 mirrors
drwxr-xr-x 2 root root 4096 Apr 10 2014 periodic
With proper syntax highlighting,
periodic should get color because of permission. We have to rebuild the cache :
sudo mv lists lists.old
mkdir -p lists/partial
apt-get update -y && apt-get upgrade
Other way is to plain copy the directories manually from FTP of a device with exact config ( RAM, Flavor, Version of Ubuntu etc.) All login should be as
Still, if error are throwing, you have to do these steps. We gave you this key
176A5C84ED67C9ED. You can try with this key
16126D3A3E5C1192 or ask Rackspace. This is almost the last way :
mv lists lists.old
mkdir -p lists/partial
The ‘i simulate initial login, option runs the shell specified by the password database entry of the target user as a login shell. This means that login-specific resource files such as .profile or .login will be read by the shell.
We have not written the above paragraph, it is from sudo’s manual page! Now, another problem will start. You will get :
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
It is throwing due to Kernel related issue. You need to upgrade to new kernel :
apt-get update && apt-get upgrade && apt-get dist-upgrade
For 1 GB, you’ll not get any option to choose from. Your Kernel will get upgraded. Normally you should get :
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
After the second run. For 2 GB upwards, you can get options, you should choose vendor specific or local (it actually depends on which flavor) and go ahead. Even after these, you can not solve; you should take a file level backup and spin a new device. It is likely to face problem in future with faulty update stuffs.