I was able to update packages using

$ sudo apt-get update

but when I tried to install telnet using

$ sudo apt-get install telnet,

I get the following errors

dpkg: unrecoverable fatal error , aborting:
too-long line or missing new line in /var/lib/dpkg/diversions'
E: Sub-process /usr/bin/dpkg returned an error code (2)

I'm unable to install any other software as well Neither could I find any online resources which solved the problem. I'm currently using debian os, raspberry pi model b+. Please help me out


Copy the old diversions instead of the current:

sudo cp /var/lib/dpkg/diversions /var/lib/dpkg/diversions.bak
sudo mv /var/lib/dpkg/diversions-old /var/lib/dpkg/diversions

I got the same problem and managed to fix it (? hopefully) by emptying the /var/lib/dpkg/diversions file:

sudo mv /var/lib/dpkg/diversions ./diversions.backup
sudo touch /var/lib/dpkg/diversions

on a pi 3 with Raspbian Jessie.

  • @Fabian pi 3 with Raspbian Jessie – YAG Mar 17 '18 at 14:58

The problem is likely dpkg

sudo dpkg --configure -a   
sudo apt-get clean
sudo dpkg-divert --list 
sudo apt-get check
sudo apt-get install -f

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy