1

When I try to remove the virtual box installed on ubuntu as follow,

sachin-verma@sachin-verma:~$ sudo apt-get remove virtualbox-5.1

Then it shows following errors:

Reading package lists... Error!
N: Ignoring file '50unattended-upgrades.ucf-dist' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension
N: Ignoring file 'getdeb.list.bck' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial_main_binary-amd64_Packages
E: The package lists or status file could not be parsed or opened.

Please help me out ?

PS.- This is also happening, when I am trying to uninstall other packages.

fkraiem
  • 12,555
  • 4
  • 35
  • 40

2 Answers2

1

Move problematic file out the way with

sudo mv /etc/apt/apt.conf.d/50unattended-upgrades.ucf-dist ~/
sudo mv /etc/apt/sources.list.d/getdeb.list.bck ~/

clear APT lists with

sudo rm /var/lib/apt/lists/* /var/lib/apt/lists/partial/*

and retry to get new package lists with

sudo apt-get update

Then finally remove unneeded package(s) with

sudo apt-get remove virtualbox-5.1
N0rbert
  • 99,918
1

Use the commands in the Terminal

Command to remove merge list:

$ sudo rm /var/lib/apt/lists/* -vf

Here, -v stands for verbose which will explain what is being done and-f stands for force which will ignore nonexistent files and arguments and would never prompt

Now Update,

$ sudo apt-get update

Remove Virtualbox,

$ sudo apt-get remove virtualbox* --purge
Kulfy
  • 17,696