2
┌──(istiak㉿kali)-[~]
└─$ sudo apt-get upgrade
[sudo] password for istiak: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 nodejs : Depends: libnode72 (= 12.21.0~dfsg-1) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

When I try fix

┌──(istiak㉿kali)-[~]
└─$ sudo apt --fix-broken install                                                                                                                                  100 ⨯
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  libjs-highlight.js nodejs-doc xdg-desktop-portal-gtk
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  nodejs
The following packages will be upgraded:
  nodejs
1 upgraded, 0 newly installed, 0 to remove and 56 not upgraded.
Need to get 0 B/24.6 MB of archives.
After this operation, 119 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 339678 files and directories currently installed.)
Preparing to unpack .../nodejs_14.16.1-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (14.16.1-deb-1nodesource1) over (12.21.0~dfsg-1) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_14.16.1-deb-1nodesource1_amd64.deb (--unpack):
 trying to overwrite '/usr/share/doc/nodejs/api/cli.json.gz', which is also in package nodejs-doc 12.21.0~dfsg-1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/nodejs_14.16.1-deb-1nodesource1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

When I install the debian package.

┌──(istiak㉿kali)-[~]
└─$ sudo dpkg -i /var/cache/apt/archives/nodejs_14.16.1-deb-1nodesource1_amd64.deb
[sudo] password for istiak: 
(Reading database ... 339678 files and directories currently installed.)
Preparing to unpack .../nodejs_14.16.1-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (14.16.1-deb-1nodesource1) over (12.21.0~dfsg-1) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_14.16.1-deb-1nodesource1_amd64.deb (--install):
 trying to overwrite '/usr/share/doc/nodejs/api/cli.json.gz', which is also in package nodejs-doc 12.21.0~dfsg-1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Processing triggers for man-db (2.9.4-2) ...
Errors were encountered while processing:
 /var/cache/apt/archives/nodejs_14.16.1-deb-1nodesource1_amd64.deb

/etc/apt/

┌──(istiak㉿kali)-[/etc/apt]
└─$ ls
apt.conf.d   preferences.d  sources.list~   trusted.gpg
auth.conf.d  sources.list   sources.list.d  trusted.gpg.d

I didn't find anything called sources.d. And, sources.list.d is a directory where I have google-chrome.list nodesource.list.

sources.list :

# See https://www.kali.org/docs/general-use/kali-linux-sources-list-
repositories/
deb http://http.kali.org/kali kali-rolling main contrib non-free

# Additional line for source packages
# deb-src http://http.kali.org/kali kali-rolling main contrib non-free

os-release :

┌──(istiak㉿kali)-[/etc/apt]
└─$ cat /etc/os-release      
PRETTY_NAME="Kali GNU/Linux Rolling"
NAME="Kali GNU/Linux"
ID=kali
VERSION="2021.1"
VERSION_ID="2021.1"
VERSION_CODENAME="kali-rolling"
ID_LIKE=debian
ANSI_COLOR="1;31"
HOME_URL="https://www.kali.org/"
SUPPORT_URL="https://forums.kali.org/"
BUG_REPORT_URL="https://bugs.kali.org/"

I tried by cleaning(sudo apt clean) also. I am not sure what to do now..? I am unable to install npm for the reason. But, I am able to update properly... You may notice I am using Kali. Version is 2020.1. And, I am not expert nor intermediate. I have some ideas of Linux.

I found some questions similar to my question but, no answers worked for me.

  1. dpkg: error processing archive

  2. error processing package mysql-community-server during apt-get upgrade

  3. Errors were encountered while processing: /var/cache/apt/archives/apport_2.20.1-0ubuntu2.6_all.deb

I was reading the documentation. When I print out :grep -v '#' /etc/apt/sources.list | sort -u.

My outputs literally match ups.

From Documentation :

deb http://http.kali.org/kali kali-rolling main non-free contrib

My output(I had added it earlier also. I think I had updated branch after reading some answers in Unix SE or askubuntu ~ I actually forgot.) :

deb http://http.kali.org/kali kali-rolling main contrib non-free

"I think it may not be the problem".

You did an off-line install (such as missing a network connection during installation).

You have switched your branch.

Using a different (hardcoded) mirror.

I had actually lost my network connection lot of times while installing something. From that documentation, I print out two command also.

cat /etc/apt/sources.list

I had earlier give the output of it also.

sudo apt-cdrom add

Actually I don't have any cdrom that's why it returns error.

E: Failed to mount the cdrom. E: No CD-ROM could be auto-detected or found using the default mount point.

4
  • 1
    Please add your apt sources to the question. It looks like you've mixed and matched different collections. Oh, what Linux-based distribution are you using? Commented Apr 17, 2021 at 8:39
  • @roaima I have edited my question... !
    – user467213
    Commented Apr 17, 2021 at 13:42
  • It's good that you've provided more context, but you haven't yet provided the apt sources. (These are the content of /etc/apt/sources and all the files under /etc/apt/sources.d`.) Commented Apr 17, 2021 at 14:41
  • 3
    As a side issue, if you're not an expert then I, and just about everyone else here, would strongly recommend you don't use Kali but instead start with a more friendly distribution Commented Apr 17, 2021 at 14:42

2 Answers 2

1

Remove google-chrome.list and nodesource.list from /etc/apt/sources.d. If you're lucky you've not broken too much of your Kali distribution and these two commands will get you back on the right track

apt update
apt full-upgrade

For context please read Kali's own documentation about repositories and in particular the section entitled "Non-Kali Repositories",

[…] adding other operating system’s repositories into Kali (such as trying to put Ubuntu on Kali), will break your installation. This is the single most common reason why Kali Linux systems break

0
-2

I had did as @roaima said. Although I was facing the issue. Then, I directly tried upgrade again.

sudo apt-get upgrade or, sudo apt upgrade

But, I was getting error. Then, I thought to run those command as root user(sudo su sudo is also represent root).

sudo su
apt --fix-broken install
apt upgrade

Now, everything is upgrading one by one..

You must log in to answer this question.