2

I installed the RPi os lite using the imager and it boots up and all but I can't install packages:

$ sudo apt install sl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  sl
0 upgraded, 1 newly installed, 0 to remove and 75 not upgraded.
Need to get 0 B/11.6 kB of archives.
After this operation, 48.1 kB of additional disk space will be used.
dpkg: unrecoverable fatal error, aborting:
 too-long line or missing newline in '/var/lib/dpkg/diversions'
E: Sub-process /usr/bin/dpkg returned an error code (2)

Neither can I upgrade (same error is thrown with sudo apt upgrade)

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  userconf-pi
The following packages will be upgraded:
  base-files bash cifs-utils curl dirmngr distro-info-data dphys-swapfile dpkg dpkg-dev firmware-atheros firmware-brcm80211 firmware-libertas firmware-misc-nonfree
  firmware-realtek gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm gpgv gzip libc-bin libc-dev-bin libc-devtools libc-l10n libc6 libc6-dbg
  libc6-dev libcamera-apps-lite libcamera0 libcurl3-gnutls libcurl4 libdpkg-perl libexpat1 libfreetype-dev libfreetype6 libfreetype6-dev libfribidi0 libgnutls30 libldap-2.4-2
  liblzma5 libntfs-3g883 libpam-chksshpwd libpam-modules libpam-modules-bin libpam-runtime libpam0g libraspberrypi-bin libraspberrypi-dev libraspberrypi-doc libraspberrypi0
  libssl1.1 libwbclient0 libxml2 locales logrotate nano ntfs-3g openssh-client openssh-server openssh-sftp-server openssl pi-bluetooth raspi-config rpi-eeprom rsyslog ssh tzdata
  wireless-regdb xz-utils
74 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/89.4 MB of archives.
After this operation, 8,944 kB disk space will be freed.
Do you want to continue? [Y/n] 
Reading changelogs... Done
Extracting templates from packages: 100%
Preconfiguring packages ...
dpkg: unrecoverable fatal error, aborting:
 too-long line or missing newline in '/var/lib/dpkg/diversions'
E: Sub-process /usr/bin/dpkg returned an error code (2)

Both of these errors are about this /var/lib/dpkg/diversions. When researching this I found people for whom sudo dpkg --configure -a fixed it put for me that returns this

$ sudo dpkg --configure -a
dpkg: unrecoverable fatal error, aborting:
 too-long line or missing newline in '/var/lib/dpkg/diversions'
New contributor
MA28 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
3
  • Did you update BEFORE trying?
    – Milliways
    Aug 3 at 23:49
  • 1
    DO NOT ever use apt-get - just use apt!
    – Milliways
    Aug 3 at 23:50
  • Please include the contents of /var/lib/dpkg/diversions in your question. Why not edit and correct the file?
    – joan
    Aug 4 at 8:38

0

Your Answer

MA28 is a new contributor. Be nice, and check out our Code of Conduct.

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

Browse other questions tagged or ask your own question.