apt-get encountered section with no Package:header

Asked by mariomiy

On Ubuntu 11.04 (Natty Narwhal) I was in the process of installing amsn, and it ended in error.
Now
No matter what I try (check, update, clean, upgrade, remove) with apt-get, the following error messages occur:

E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/fk.archive.ubuntu.com_ubuntu_dists_natty_main_binary-i386_Packages
E: The package lists or status file could not be parsed or opened.

This generally means that the installed packages possess unresolved dependencies.

How could I do a general reset on the package lists, or reinstall synaptic?
Neither synaptic nor the Ubuntu Application Center work at all.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu apt Edit question
Assignee:
No assignee Edit question
Solved by:
actionparsnip
Solved:
Last query:
Last reply:
Revision history for this message
mariomiy (miyojim-gmail) said :
#1

I checked the file in question (...main_binary-i386_Packages) and found that my
3G internet provider overwrote its contents with an html file it sent me for having
downloaded more bytes than 1 gigabyte.
So, I need a way to restore its original contents.
Do I have to reinstall the entire operating system, or is there a backup file somewhere?

How do I avoid this situation in the future?

Revision history for this message
Best actionparsnip (andrew-woodhead666) said :
#2

Try:

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 mkdir /var/lib/apt/lists; sudo mkdir /var/lib/apt/lists/partial
sudo apt-get clean; sudo apt-get autoclean
sudo apt-get update
sudo dpkg --clear-avail; sudo dpkg --configure -a
sudo apt-get install -f
sudo apt-get update
sudo apt-get dist-upgrade

Revision history for this message
mariomiy (miyojim-gmail) said :
#3

Thank you.

Revision history for this message
mariomiy (miyojim-gmail) said :
#4

Problem solved. I shall retain the procedure for future use.
I believe the invasive message from the Vivo company may again corrupt the
apt-get files at random.
Mario Miyojim

2011/5/7 actionparsnip <email address hidden>

> Your question #156364 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/156364
>
> Status: Open => Answered
>
> actionparsnip proposed the following answer:
> Try:
>
> 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 mkdir /var/lib/apt/lists; sudo mkdir /var/lib/apt/lists/partial
> sudo apt-get clean; sudo apt-get autoclean
> sudo apt-get update
> sudo dpkg --clear-avail; sudo dpkg --configure -a
> sudo apt-get install -f
> sudo apt-get update
> sudo apt-get dist-upgrade
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/ubuntu/+question/156364/+confirm?answer_id=1
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/ubuntu/+question/156364
>
> You received this question notification because you asked the question.
>

Revision history for this message
mariomiy (miyojim-gmail) said :
#5

Thanks actionparsnip, that solved my question.