how to tell "dpkg" to NOT to download / install a broken source? - linux

Whenever I try to use apt-get/dpkg, it tries a to install a broken source.
How can I tell it to NOT do so ?
here is its error:
dpkg: error processing oracle-java7-installer (--configure):
subprocess installed post-installation script returned error exit status 1
E: Sub-process /usr/bin/dpkg returned an error code (1)
UPDATE :
I found the perfect solution here:
https://askubuntu.com/questions/121226/how-to-completely-remove-a-oracle-jdk-that-didnt-install-properly

You need to define does this package depends on something and do you need it. If not just force to purge it with
aptitude purge oracle-java7-installer
or even
dpkg --force-all --purge oracle-java7-installer
If you need it try to determine why it is broken. Due to your posted error there is broken script in installer. So you'll need to fix it. The simplest way is to unpack it, fix script and repack. After that install should success.

you also need to install aptitude first as it is no longer default installed.
and use sudo privileges.
sudo apt-get install aptitude
and
sudo aptitude purge oracle-java7-installer
or
sudo dpkg --force-all --purge oracle-java7-installer

Related

Error updating Node - ubuntu (WSL) - how to update node

I need at least any >14 version of node, but when i tried to update i had to uninstall. now i1m trying to install the 16 version but i keep gettimg this error:
Unpacking nodejs (16.19.0-deb-1nodesource1) ... dpkg: error processing
archive
/var/cache/apt/archives/nodejs_16.19.0-deb-1nodesource1_amd64.deb
(--unpack): trying to overwrite '/usr/include/node/common.gypi',
which is also in package libnode-dev 12.22.9~dfsg-1ubuntu3 dpkg-deb:
error: paste subprocess was killed by signal (Broken pipe) Errors were
encountered while processing:
/var/cache/apt/archives/nodejs_16.19.0-deb-1nodesource1_amd64.deb E:
Sub-process /usr/bin/dpkg returned an error code (1)
To install NodeJS Firstly make sure to update your packages
sudo apt update
sudo apt upgrade
Then make sure to have curl installed, sudo apt install curl -y
Then import NodeJS repo by curl -fsSL https://deb.nodesource.com/setup_NODEJS_VERSION | sudo -E bash -
Make sure to change NODEJS_VERSION to the version u wish to install, for example if u want to instal v16 change it to 16.x then simply run sudo apt install nodejs -y to install nodejs
Hope that helped!

How do I fix broken dependencies if apt-get --fix-broken is giving me a "not known" error?

I've been attempting to install OpenLDAP on Ubuntu, but I keep receiving a dependency error whenever I try to install it.
The console output is:
dpkg: error processing package libapache2-mpm-itk (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of apache2-mpm-itk:
apache2-mpm-itk depends on libapache2-mpm-itk; however:
Package libapache2-mpm-itk is not configured yet.
dpkg: error processing package apache2-mpm-itk (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
libapache2-mpm-itk
apache2-mpm-itk
I tried running the code below to fix these errors:
sudo apt-get -f
But I received the error:
E: Command line option 'f' [from -f] is not known.
I have also tried to use the alternative --fix-broken, but I get the same error. Has anyone ever experience this and know a way around this?
First you'll have to resolve the problem with libapache2-mpm-itk. There isn't enough info in what you posted above to see why it's failing to install, but a quick workaround would be to just remove it:
sudo apt-get purge libapache2-mpm-itk apache2-mpm-itk
After that you should be able to install other packages again.
-f has to be used with an action, for example: sudo apt-get -f install (you don't need to provide any packages names when doing this.)
Whilst
sudo apt --fix-broken install
should work to repair damage. You might also find
sudo apt-get -f install
yeilds better result. Even though it's meant to be same.
You need to run sudo apt-get -f install NOT just sudo apt-get -f.

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-*

Error on "update-alternatives" when installing/upgrading nodejs v0.10.30

So I get this error when doing apt-get upgrade
Setting up nodejs (0.10.30-1chl1~trusty1) ...
update-alternatives: error: alternative link /usr/bin/node is already managed by nodejs
dpkg: error processing package nodejs (--configure): subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing: nodejs
E: Sub-process /usr/bin/dpkg returned an error code (1)
NB: "nodejs --version" works, I get a clean "v0.10.30" but "node --version" doesn't since there is no link.
So far, I have tried:
complete removal of nodejs & new install
I manually removed the link /usr/bin/node to nodejs after removing nodejs, since it was still there and the issue is related to update-alternatives
using "update-alternatives --config nodesjs" (something was broken and repaired the first time I used it, but it didn't solve the issue. That error has not reappeared since).
Other answers didn't resolved the problem on my setup, maybe because I was using the NodeSource repository instead of the official ones.
But I've simply removed all "alternatives" for the nodejs group first:
sudo update-alternatives --remove-all nodejs
And after that, a sudo apt-get install nodejs just worked.
I really encourage you to use nvm to install Node.js on your ubuntu machine (https://github.com/creationix/nvm). With that, the installation of any Node.js version becomes very easy.
Probably you have an older version of NodeJS installed and you get a conflict while upgrading.
The only package that uses /usr/bin/node is nodejs-legacy, so unless you have created that link by yourself or installed NodeJS from sources that's the package you need to remove:
$ sudo apt-get purge nodejs-legacy nodejs
After that just reinstall NodeJS, update and upgrade your software:
$ sudo apt-get install nodejs
$ sudo apt-get update && sudo apt-get upgrade
From the output you gave the NodeJS version from the PPA has priority over the other, so you should not have any problem installing it.

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