If you are experimenting on your LINUX PC chances are highly likely that you will mess up your repository. Then on it will be a pain to do an update, either through command line or from synaptic package manager
I am restless with my LINUX box all the time, I am either installing something in it or changing configurations. Quite recently I installed KDM/XFCE to evaluate it for my friend and I somehow seem to have messed up my environment. Every time I attempted to execute "sudo apt-get update" I'd see the following message. I tried to go around the issue with Synaptic. But Synaptic will throw this error when I open it. So I was sort of struck and I need to get out soon. Here's what I had to do to fix it
Error
.......
.......
Fetched 2 B in 8s (0 B/s)
W: Failed to fetch gzip:/var/lib/apt/lists/partial/us.archive.ubuntu.com_ubuntu_dists_precise-updates_main_i18n_Translation-en Encountered a section with no Package: header
W: Failed to fetch gzip:/var/lib/apt/lists/partial/us.archive.ubuntu.com_ubuntu_dists_precise-updates_universe_i18n_Translation-en
E: Some index files failed to download. They have been ignored, or old ones used instead.
Note: Make sure you close Synaptic/package manager before you attempt to do any of this
After a lot of hunt, I creates a simple shell script "fix_update.sh" with the following contents
sudo fuser -vvv /var/lib/dpkg/lock
sudo rm /var/lib/apt/lists/lock
sudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup
sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status
sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available
sudo rm -rf /var/lib/dpkg/updates/*
sudo rm -rf /var/lib/apt/lists
sudo rm /var/cache/apt/*.bin
sudo mkdir /var/lib/apt/lists
sudo mkdir /var/lib/apt/lists/partial
LANG=C;sudo apt-get clean
LANG=C;sudo apt-get autoclean
LANG=C;sudo apt-get --purge autoremove
LANG=C;sudo apt-get update -o APT::Cache-Limit=25165824
sudo dpkg --clear-avail
sudo dpkg --configure -a
LANG=C;sudo apt-get -f install
LANG=C;sudo apt-get --fix-missing install
LANG=C;sudo apt-get update -o APT::Cache-Limit=25165824 && sudo apt-get dist-upgrade
Save the file
Grant execute privilege - chmod +x ./fix_update.sh
Execute the script - ./fix_update.sh
VOILA, you are good to go now
Save the file in your home custom scripts directory, it will always be handy
I am restless with my LINUX box all the time, I am either installing something in it or changing configurations. Quite recently I installed KDM/XFCE to evaluate it for my friend and I somehow seem to have messed up my environment. Every time I attempted to execute "sudo apt-get update" I'd see the following message. I tried to go around the issue with Synaptic. But Synaptic will throw this error when I open it. So I was sort of struck and I need to get out soon. Here's what I had to do to fix it
Error
.......
.......
Fetched 2 B in 8s (0 B/s)
W: Failed to fetch gzip:/var/lib/apt/lists/partial/us.archive.ubuntu.com_ubuntu_dists_precise-updates_main_i18n_Translation-en Encountered a section with no Package: header
W: Failed to fetch gzip:/var/lib/apt/lists/partial/us.archive.ubuntu.com_ubuntu_dists_precise-updates_universe_i18n_Translation-en
E: Some index files failed to download. They have been ignored, or old ones used instead.
Note: Make sure you close Synaptic/package manager before you attempt to do any of this
After a lot of hunt, I creates a simple shell script "fix_update.sh" with the following contents
sudo fuser -vvv /var/lib/dpkg/lock
sudo rm /var/lib/apt/lists/lock
sudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup
sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status
sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available
sudo rm -rf /var/lib/dpkg/updates/*
sudo rm -rf /var/lib/apt/lists
sudo rm /var/cache/apt/*.bin
sudo mkdir /var/lib/apt/lists
sudo mkdir /var/lib/apt/lists/partial
LANG=C;sudo apt-get clean
LANG=C;sudo apt-get autoclean
LANG=C;sudo apt-get --purge autoremove
LANG=C;sudo apt-get update -o APT::Cache-Limit=25165824
sudo dpkg --clear-avail
sudo dpkg --configure -a
LANG=C;sudo apt-get -f install
LANG=C;sudo apt-get --fix-missing install
LANG=C;sudo apt-get update -o APT::Cache-Limit=25165824 && sudo apt-get dist-upgrade
Save the file
Grant execute privilege - chmod +x ./fix_update.sh
Execute the script - ./fix_update.sh
VOILA, you are good to go now
Save the file in your home custom scripts directory, it will always be handy
Nice work! This fixed the issue for me; however, it did require that I up the cache limit to 50331648.
ReplyDeleteThank You!