Error while installing or upgrading with apt

5,911

To upgrade debian 9 to 10 you should have only the following lines in your /etc/apt/sources.list:

deb http://deb.debian.org/debian buster main
deb http://deb.debian.org/debian-security/ buster/updates main
deb http://deb.debian.org/debian buster-updates main

Disable the third party repository under /etc/apt/sources.list.d/ directory.

In your case you have a ubuntu-xenial repository enabled ( which provide the linux-image-generic-lts-xenial package) it will break your system.

Then run :

sudo apt update
sudo apt install linux-image-amd64
sudo apt upgrade
sudo apt dist-upgrade

As said @Stephen Kitt , the linux-firmware_1.127.24_all.deb belong to Ubuntu Trusty which cause the error code (1), it should be removed : apt purge linux-firmware.

To solve the following error (post-removal script):

Errors were encountered while processing:
/var/cache/apt/archives/linux-firmware_1.127.24_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Edit the /var/lib/dpkg/info/linux-firmware.postrm file and replace its content with:

#!/bin/bash
/bin/true

To solve the following error (post-installation script):

subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
snapd
E: Sub-process /usr/bin/dpkg returned an error code (1)

edit the /var/lib/dpkg/info/snapd.postinst as follows:

#!/bin/bash
/bin/true

Update:

Backup the /var/lib/dpkg/status and /var/lib/dpkg/status-old then replace status file by status-old:

sudo cp /var/lib/dpkg/status /var/lib/dpkg/status.bak1
sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status-old.bak1
sudo mv /var/lib/dpkg/status-old /var/lib/dpkg/status

Then run :

sudo dpkg --configure -a
sudo apt clean
sudo apt autoclean
sudo apt update 
sudo apt upgrade
Share:
5,911

Related videos on Youtube

HotGlue
Author by

HotGlue

Updated on September 18, 2022

Comments

  • HotGlue
    HotGlue over 1 year

    I was trying to upgrade debian 9 to 10 but when I tried to run sudo apt-get update, sudo apt-get upgrade and sudo apt-get full-upgrade, they all got this error message:

        optiplex@optiplex:~$ sudo apt-get upgrade
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    You might want to run 'apt --fix-broken install' to correct these.
    The following packages have unmet dependencies:
     linux-image-generic-lts-xenial : Depends: linux-firmware but it is not installed
    E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
    

    I tried running

    apt --fix-broken install
    

    but then i just got this error message:

     optiplex@optiplex:~$ sudo apt --fix-broken install
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Correcting dependencies... Done
    The following package was automatically installed and is no longer required:
      linux-image-4.9.0-8-amd64
    Use 'sudo apt autoremove' to remove it.
    The following additional packages will be installed:
      linux-firmware
    The following NEW packages will be installed:
      linux-firmware
    0 upgraded, 1 newly installed, 0 to remove and 10 not upgraded.
    3 not fully installed or removed.
    Need to get 0 B/33.9 MB of archives.
    After this operation, 127 MB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    WARNING: The following packages cannot be authenticated!
      linux-firmware
    Install these packages without verification? [y/N] y
    (Reading database ... 514688 files and directories currently installed.)
    Preparing to unpack .../linux-firmware_1.127.24_all.deb ...
    Unpacking linux-firmware (1.127.24) ...
    dpkg: error processing archive /var/cache/apt/archives/linux-firmware_1.127.24_all.deb (--unpack):
     trying to overwrite '/lib/firmware/cis/PE-200.cis', which is also in package firmware-linux-free 3.4
    dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
    Errors were encountered while processing:
     /var/cache/apt/archives/linux-firmware_1.127.24_all.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    Could anybody help me with this?


    EDIT:

    I was going through the instructions given by GAD3R but I have a slightly different error message this time whenever I trie to do anything with apt:

        dpkg: error processing package snapd (--configure):
     subprocess installed post-installation script returned error exit status 1
    Errors were encountered while processing:
     snapd
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    EDIT 2:

    I got as far as doing apt-get upgrade but I keep getting errors:

    ... Selecting previously unselected package x11proto-dev.
    Preparing to unpack .../513-x11proto-dev_2018.4-4_all.deb ...
    Unpacking x11proto-dev (2018.4-4) ...
    Preparing to unpack .../514-xbrlapi_5.6-10_amd64.deb ...
    Unpacking xbrlapi (5.6-10) over (5.4-7+deb9u1) ...
    Preparing to unpack .../515-xscreensaver-data_5.42+dfsg1-1_amd64.deb ...
    Unpacking xscreensaver-data (5.42+dfsg1-1) over (5.36-1) ...
    Preparing to unpack .../516-xscreensaver-gl_5.42+dfsg1-1_amd64.deb ...
    Unpacking xscreensaver-gl (5.42+dfsg1-1) over (5.36-1) ...
    Preparing to unpack .../517-xserver-xephyr_2%3a1.20.4-1_amd64.deb ...
    Unpacking xserver-xephyr (2:1.20.4-1) over (2:1.19.2-1+deb9u5) ...
    Preparing to unpack .../518-xterm_344-1_amd64.deb ...
    Unpacking xterm (344-1) over (327-2) ...
    Errors were encountered while processing:
     /tmp/apt-dpkg-install-3w5XWy/270-libel-api-java_3.0.0-2_all.deb
     /tmp/apt-dpkg-install-3w5XWy/303-libjsp-api-java_2.3.4-2_all.deb
     /tmp/apt-dpkg-install-3w5XWy/361-libwebsocket-api-java_1.1-1_all.deb
     /tmp/apt-dpkg-install-3w5XWy/433-plymouth_0.9.4-1.1_amd64.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    I am running Debian 9 on an Optiplex 755 PC

    Thank you for your time!

    Nikolai.

  • Stephen Kitt
    Stephen Kitt over 4 years
    +1; the OP will probably need to remove linux-firmware explicitly too.
  • GAD3R
    GAD3R over 4 years
    Welcome, You can edit your question here. please disable or remove all the repository under /etc/apt/sources.list.d/ after upgrading your can add the google-chrome repository .All the Ubuntu repos will break your system.