Error handling of apt instruction e: unmet dependencies. Try ‘apt — fix broken install’ with no packages in Ubuntu 20.04

Record the error handling of * * e: unmet dependencies. Try ‘apt — fix broken install’ with no packages and errors were accounted while processing and E: sub process/usr/bin/dpkg returned an error code (1) * *
only my process and solutions are recorded here.

Process

This error was reported when using apt and apt get packages today.

$ sudo apt install git
[sudo] password for wh: 
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:
 cypher-shell : Breaks: neo4j (< 3.1.4) but 2.1.5 is to be installed
 git : Depends: liberror-perl but it is not going to be installed
       Depends: git-man (> 1:2.17.1) but it is not going to be installed
       Depends: git-man (< 1:2.17.1-.) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

Follow the prompts to run sudo apt -- fix broken install , and report an error. The echo is as follows:

YPreconfiguring packages ...
(Reading database ... 209743 files and directories currently installed.)
Preparing to unpack .../neo4j_1%3a3.5.14_all.deb ...
-----------------------------------------------------------------------------
It looks like you are upgrading from Neo4j 2.x. Many configuration
changes and improvements have been made in 3.0, including the location of
the databases. These changes cannot be handled automatically by this package
installation.

You will need to upgrade from Neo4j 2.x to Neo4j 3.2 and THEN to this release.
The upgrade guide for Neo4j 3.2 can be found at 
https://neo4j.com/docs/operations-manual/3.2/upgrade/
-----------------------------------------------------------------------------

dpkg: error processing archive /var/cache/apt/archives/neo4j_1%3a3.5.14_all.deb 
(--unpack):
 new neo4j package pre-installation script subprocess returned error exit status
 1
Errors were encountered while processing:
 /var/cache/apt/archives/neo4j_1%3a3.5.14_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Here I want to install neo4j_ 1%3a3.5.14_ All.deb, but I already have neo4j 2. X. I need to upgrade from neo4j 2. X to neo4j 3.2, and then to this version
the following error report also means to analyze neo4j_ 1%3a3.5.14_ Error in all.deb
(but I didn’t look at the above information carefully, so I only know that the following error report says my neo4j_ 1%3a3.5.14_ All.deb parsing error)

I’ve checked a lot of blogs here, but it doesn’t work for a long time
I followed the method in reference 1. Method 1 and method 2 are useless. I have achieved method 3
the process of trying method 3 is as follows:

$ sudo rm /var/cache/apt/archives/neo4j_1%3a3.5.14_all.deb 
$ sudo apt-get clean
$ sudo apt-get autoremove
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:
 cypher-shell : Breaks: neo4j (< 3.1.4) but 2.1.5 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

When you run sudo apt get autoremove , you will be prompted

The following packages have unmet dependencies:
 cypher-shell : Breaks: neo4j (< 3.1.4) but 2.1.5 is installed

At this time, I realized that there is a 2.1.5 version of neo4j in my system
if this step is not successful, the following instructions will not be executed successfully.

Here, I query the directory of neo4j version 2.1.5 through the where is command, and modify the corresponding directory name. It is reasonable to say that after the modification, the system cannot find neo4j2.1.5, sudo apt get autoremove should be able to execute successfully. But it didn’t.

In fact, it’s very simple here. We just need to uninstall neo4j in version 2.1.5. As follows:
perform sudo apt get remove neo4j uninstall
then follow method 3 in reference blog 1 to execute it again. The above error will not be reported in the process.

Then apt and apt get can be used normally.

reference resources

    Fix “Sub-process /usr/bin/dpkg returned an error code (1)” In Ubuntu


Read More: