Can't Fix Broken Git installation on Ubuntu - linux

I was trying to install git on ubuntu, but there is an error when I try to install or fix broken
git installation.
This is the error:
cp: cannot stat '/usr/lib/git-core/git': No such file or directory
dpkg: error processing archive /var/cache/apt/archives/git_1%3a2.17.1-1ubuntu0.8_amd64.deb (--unpack):
new git package pre-installation script subprocess returned error exit status 1
dpkg-query: warning: files list file for package 'git' missing; assuming package has no files currently installed
dpkg-query: warning: files list file for package 'git' missing; assuming package has no files currently installed
Errors were encountered while processing:
/var/cache/apt/archives/git_1%3a2.17.1-1ubuntu0.8_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
I tried other possibles solutions, I will list here:
apt --fix-broken install. Error: The same problem as above.
apt purge git. Show me to make an apt fix broken install
sudo dpkg -i --force-overwrite /var/cache/apt/archives/git_1%3a2.17.1-1ubuntu0.8_amd64.deb. Error: dpkg-query: warning: files list file for package 'git' missing; assuming package has no files currently installed
I tried to remove all files inside dpkg/updates, apt/lists, apt/*.bin, and clen apt-get, to try to force the installation, but again the same error above.
sudo rm -rf /var/lib/dpkg/updates/*
sudo rm -rf /var/lib/apt/lists/*
sudo rm /var/cache/apt/*.bin
sudo apt-get clean
sudo apt-get autoremove
sudo apt-get update
sudo dpkg --configure -a
sudo apt-get install -f
I tryed to remove the git .deb file from /var/cache/apt/archives and install git again, but doesn't work.

I resolved the problem with the commands below:
sudo apt-mark hold git
sudo dpkg -r --force-depends git
And then install git-core
sudo apt install git-core

Related

dpkg: error processing archive ( On installing Nodejs)

This error occurred while installing nodejs](https://i.stack.imgur.com/JMRiT.jpg)
I am trying to install nodejs but facing this error while installing.
sudo dpkg -i --force-overwrite /var/cache/apt/archives/nodejs_18.12.1-deb-1nodesource1_amd64.deb
sudo apt -f install
sudo apt update
sudo apt dist-upgrade
Adapted from this: https://askubuntu.com/a/1362727/666464
I had the same problem today, and now it is solved.

Unable to install/remove mongodb-org on Ubuntu 18.04 Bionic - "mongodb-org-tools : Depends: mongodb-database-tools but it is not installed"

I've tried following the instructions to install mongodb, as per the mongodb.com instructions.
When I run: sudo apt-get install -y mongodb-org, I get the following:
The following packages have unmet dependencies.
mongodb-org-tools : Depends: mongodb-database-tools but it is not going to be installed
There's a suggestion to run apt --fix-broken install. So I run it with sudo. I get the following:
The following packages were automatically installed and are no longer required:
libboost-program-options1.65.1 libgoogle-perftools4 libpcrecpp0v5 libtcmalloc-minimal4 libyaml-cpp0.5v5 mongo-tools
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
mongodb-database-tools
Which then fails, with this error report:
Unpacking mongodb-database-tools (100.5.0) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-database-tools_100.5.0_amd64.deb (--unpack):
trying to overwrite '/usr/bin/bsondump', which is also in package mongo-tools 3.6.3-0ubuntu1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/mongodb-database-tools_100.5.0_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
My reading of this: trying to overwrite '/usr/bin/bsondump', which is also in package mongo-tools 3.6.3-0ubuntu1 suggests to me that there is something in mongo-tools that is stubbornly not letting itself be removed. So I tried running sudo apt autoremove to remove the mongo-tools. Unfortunately I get the following:
The following packages have unmet dependencies.
mongodb-org-tools : Depends: mongodb-database-tools but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
So I try apt --fix-broken install again, as recommended, but without any success. I need to find a way to get rid of that darned mongo-tools - but how? I tried following the "Uninstall MongoDB Community Edition" instructions on those on the same page I linked above.
When I enter sudo apt-get purge mongodb-org*, this forms part of the message:
The following packages were automatically installed and are no longer required:
libboost-program-options1.65.1 libgoogle-perftools4 libpcrecpp0v5 libtcmalloc-minimal4 libyaml-cpp0.5v5 mongo-tools mongodb-mongosh
Use 'sudo apt autoremove' to remove them.
So now I have mongo-tools and this new mongodb-mongosh? I've attempted to install again but I run into the same problems. What's the fix?
1.Stop the mongod process by issuing the following command:-
sudo service mongod stop
2.Remove any MongoDB packages that you had previously installed:-
sudo apt-get purge mongodb-org*
3.Remove MongoDB databases and log files:-
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
4.Then reinstall mangodb 4.4.8
5.Import the public key used by the package management system:-
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
6.The following instruction is for Ubuntu 18.04 (Bionic):-
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
7.Update Apt
sudo apt-get update
8.Install mongodb
sudo apt-get install mongodb-org=4.4.8 mongodb-org-server=4.4.8 mongodb-org-shell=4.4.8 mongodb-org-mongos=4.4.8 mongodb-org-tools=4.4.8
9.Use mongod --version to check its succesfully installed.
10.If u encounter any error while using mongod
sudo mkdir /data
cd /data
sudo mkdir db
sudo pkill -f mongod
11.Then use sudo mongod command to start server.
12.Use mongo to use mongodb shell
Finally got it working: I tried sudo apt-get purge mongo-tools* and sudo apt-get purge mongodb-mongosh*, and this seemed to fix things and permit an install.
For some reason, the uninstall directions in the documentation (command: sudo apt-get purge mongodb-org*) didn't remove mongo-tools. It may have been something I'd installed from another source previously.

gnome-terminal not opening after library installation. ERROR: FT_Get_Var_Design_Coordinates

I am using Ubuntu 20.04 and tried to install the Python version of Tecplot (Pytecplot), after which I'm unable to open the terminal anymore.
$ gnome-terminal
/usr/bin/gnome-terminal.real: symbol lookup error: /lib/x86_64-linux-gnu/libcairo.so.2: undefined symbol: FT_Get_Var_Design_Coordinates
My Bash_history shows following commands:
python3 setup.py install
sudo python3 setup.py install
sudo apt-get install libjpeg62:i386
sudo apt update sudo apt install libpng12-0
sudo cp libjpeg.so.62 ../
sudo cp libjpeg.so.62 ../../local/lib/
sudo dpkg -i libpng12-0_1.2.54-1ubuntu1.1_amd64.deb
I made a backup of usr/local/lib before starting, but restoring that backup did not solve the problem.
Can someone help me in solving the above issue?

apt-get error: Sub-process /usr/bin/dpkg returned an error code (1)

I have error in apt-get install
it is a error:
The following packages have unmet dependencies:
gcc-4.8-multilib : Depends: libc6-dev-i386 (>= 2.11) but it is not going to be installed
libc6-dev-x32 : Depends: libc6-dev-i386 (= 2.19-0ubuntu6.6) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
I try several command
like: apt-get -f install
apt-get clean
I try change my source list, and remake apt-get update
$ sudo apt-get install g++
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
gcc-4.8-multilib : Depends: libc6-dev-i386 (>= 2.11) but it is not going to be installed
libc6-dev-x32 : Depends: libc6-dev-i386 (= 2.19-0ubuntu6.6) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
in apt-get -f install
$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
libc6-dev-i386
The following NEW packages will be installed:
libc6-dev-i386
0 upgraded, 1 newly installed, 0 to remove and 434 not upgraded.
3 not fully installed or removed.
Need to get 0 B/1.148 kB of archives.
After this operation, 6.333 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 194963 files and directories currently installed.)
Preparing to unpack .../libc6-dev-i386_2.19-0ubuntu6.6_amd64.deb ...
Unpacking libc6-dev-i386 (2.19-0ubuntu6.6) ...
dpkg: error processing archive /var/cache/apt/archives/libc6-dev-i386_2.19-0ubuntu6.6_amd64.deb (--unpack):
trying to overwrite '/usr/include/bits', which is also in package libc6-dev-amd64 2.19-0ubuntu6.6
Errors were encountered while processing:
/var/cache/apt/archives/libc6-dev-i386_2.19-0ubuntu6.6_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
The same dpkg error is also possible when uninstalling:
apt-get uninstall
and
apt-get purge
First, uninstall the package:
rm -f /var/lib/dpkg/info/<package-name>*
apt-get purge <package-name>
Afterwards you can re-install it:
apt-get install <package-name>
Try this. Open a new terminal and paste it
sudo dpkg -i --force-overwrite /var/cache/apt/archives/libc6-dev-i386_2.19-0ubuntu6.6_amd64.deb
After that type:
sudo apt-get autoremove
Lastly type
sudo apt-get update
hope your problem will be solved.
none of the solutions i could find solved the problem for me...still broken packes, no matter the autoremove, -f install ... and so forth.
After playing around a little, the following solved it for me:
sudo apt-get --purge remove libc6-dev-i386 libc6-dev-x32 gcc-5-multilib gcc-multilib
sudo apt autoremove -f
sudo apt-get -f install
Try the following steps from the terminal :
sudo apt-get --purge remove libc6-dev-amd64
sudo apt-get -f install
sudo apt-get update
Hope this will fix your issues.
Try is to reconfigure the package database. Probably the database got corrupted while installing a package.
sudo dpkg --configure -a
I found my solution, because the others quoted below did not work. Generally, it is a conflict with a dependency already installed.
I solved this problem with these command for recreate blank configuration (debian) :
sudo mv /var/lib/dpkg/info /var/lib/dpkg/info_silent
sudo mkdir /var/lib/dpkg/info
sudo apt-get update
sudo apt-get -f install <xxxx>
It looks like you have installed libc6-dev-amd64 and you are trying to install packages that depend on libc6-dev-i386, and these two are in conflict (they both contain /usr/include/bits).
My guess is you don't want both of these installed at the same time. I would use apt-get remove libc6-dev-amd64 to get yourself back to a good state, and then try again to install the packages that you want.
If those two packages are meant to work when they're both installed at the same time, then file a bug with the package maintainer because they need to fix the packages to allow that.
When the upgrade command (sudo apt-get upgrade -y) is run in Ubuntu 18.04.3 (With Linux kernel version 5.7.14) the following errors get reported (in red):
... bind /var/run/spice-vdagentd/spice-vdagent-sock: No such file or directory
... Fatal could not create server socket /var/run/spice-vdagentd/spice-vdagent-sock
...
... Failed to start Agent daemon for Spice guests.
The following steps fixed the issue:
Make spice-vdagentd directory if it does not exist:
> sudo mkdir /var/run/spice-vdagentd (if it does not exist)
Open a new file spice-vdagent-sock
> sudo vi /var/run/spice-vdagentd/spice-vdagent-sock
Save the file by running: :wq
Re-run the upgrade command to verify that the issue is fixed.
Using below steps my problem resolve in "Oracle VM VirtualBox Manager"
apt autoremove
apt purge libreoffice-base libreoffice-core
dpkg -l "libreoffice" | grep "^ii"
sudo dpkg --configure -a
sudo apt-get install -f
now you can try to install - pip3 install jupyter etc.
You can fix this problem with this command:
sudo apt-get remove --purge libreoffice-core libreoffice-common
python3-uno libreoffice-*

apt-get not installing anything linux server

Anything with apt-get install is giving following error
You might want to run 'apt-get -f install' to correct these:
The
following packages have unmet dependencies:
openssh-server : Depends:
openssh-client (= 1:6.0p1-4) but 1:6.0p1-4+deb7u2 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or
specify a solution).
If i try to install apt-get -f install it give following error
reparing to replace openssh-server 1:6.0p1-4 (using .../openssh-server_1%3a6.0p1-4+deb7u2_amd64.deb) ...
Unpacking replacement openssh-server ...
dpkg: error processing /var/cache/apt/archives/openssh-server_1%3a6.0p1-4+deb7u2_amd64.deb (--unpack):
unable to make backup link of `./usr/sbin/sshd' before installing new version: Operation not permitted
Processing triggers for man-db ...
Errors were encountered while processing:
/var/cache/apt/archives/openssh-server_1%3a6.0p1-4+deb7u2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
sudo apt-get update also not working completely. Suggestion please
Thanks in advance
sudo apt-get update
sudo apt-get -f install
sudo apt-get install openssh-server
If you are not logged in as root (as I'm assuming), you should put sudo before adding/removing packages to the system.
If that doesn't work, run these commands:
chattr -i /usr/bin/sshd
chattr -a /usr/bin/sshd
sudo apt-get update
sudo apt-get -f install
sudo apt-get install openssh-server
If that doesn't work, you can also go to /var/lib/dpkg/info and /var/cache/apt/archives to delete anything with a name close to openssh-server. Then, run the commands:
sudo apt-get update
sudo apt-get -f install
sudo apt-get install openssh-server
pd: this is quite complex, so not having access to the system means a lot of "try and fail" :(
Ok I tried all of this and more, and not one of the methods worked. So I tried to remove openssh-client, then install openssh-server and that worked for me.

Resources