Can't remove, purge, unistall mongodb from debian - linux

I'm trying to reinstall it, because it has problems. For example, I can't install Chromium because mongodb-org-server is not configured. But I can't even remove it for the same reason.
apt-get autoremove --purge mongodb
Or:
apt-get purge mongodb
Or:
apt-get remove --purge mongodb
All end in the same way:
dpkg: error processing package mongodb-org-server (--configure):
subprocess installed post-installation script returned error exit status 102
Errors were encountered while processing:
mongodb-org-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Some data about my machine from hostnamectl:
Operating System: Debian GNU/Linux 8 (jessie)
Kernel: Linux 3.14-2-amd64
Architecture: x86_64
How can I fix this?
Updates: things I tried/I'm trying
apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 973 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mongodb-org-server (3.0.2) ...
dpkg: error processing package mongodb-org-server (--configure):
subprocess installed post-installation script returned error exit status 102
Errors were encountered while processing:
mongodb-org-server

To avoid that sort of problems you should install software only from native Debian repositories. Unfortunately it is not unusual when sloppy/incompetent 3rd party packages are responsible for such troubles.
To recover try removing file /var/lib/dpkg/info/mongodb-org-server.postinst before attempting to apt-get purge mongodb.

Remove all mongodb file inside
/var/lib/dpkg/info/mongodb
And then do
sudo apt purge mongodb-org*
Answer credits to: Lazyexpert

Related

Sub-process /usr/bin/dpkg returned an error code (1) When using sudo apt install --fix-broken

when trying to remove nodjs from my Ubuntu sudo apt-get remove nodejs
Getting error E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
When performing sudo apt install --fix-broken iam getting below error.
Any reason why iam getting this issue.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
linux-image-5.11.0-46-generic
Suggested packages:
fdutils linux-doc | linux-hwe-5.11-source-5.11.0 linux-hwe-5.11-tools
The following NEW packages will be installed:
linux-image-5.11.0-46-generic
0 upgraded, 1 newly installed, 0 to remove and 132 not upgraded.
4 not fully installed or removed.
Need to get 0 B/11.5 MB of archives.
After this operation, 11.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 208109 files and directories currently installed.)
Preparing to unpack .../linux-image-5.11.0-46-generic_5.11.0-46.51~20.04.1_amd64.deb ...
Unpacking linux-image-5.11.0-46-generic (5.11.0-46.51~20.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-5.11.0-46-
generic_5.11.0-46.51~20.04.1_amd64.deb (--unpack):
unable to open '/boot/vmlinuz-5.11.0-46-generic.dpkg-new': Operation not permitted
Errors were encountered while processing:
/var/cache/apt/archives/linux-image-5.11.0-46-generic_5.11.0-46.51~20.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Try it:
apt clean
apt autoclean
cd /var/lib/dpkg/
mv info/ info_bak
mkdir info
apt-get update
apt-get -f install
mv info/* info_bak/
rm -rf info
mv info_bak info
I think this will solve your problem, execute all commands in order.

Unable to install python3-tk on Ubuntu 18.04.2 LTS

I am running Ubuntu 18.04.2 LTS:
user#vmubu01:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic
And I am unable to install python3-tk using 'apt-get install' command as you can see below:
user#vmubu01:~$ sudo apt-get install python3-tk
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
tix python3-tk-dbg
The following NEW packages will be installed:
python3-tk
0 upgraded, 1 newly installed, 0 to remove and 91 not upgraded.
3 not fully installed or removed.
Need to get 0 B/101 kB of archives.
After this operation, 891 kB of additional disk space will be used.
(Reading database ... 206924 files and directories currently installed.)
Preparing to unpack .../python3-tk_3.6.8-1~18.04_amd64.deb ...
Unpacking python3-tk:amd64 (3.6.8-1~18.04) ...
dpkg: error processing archive /var/cache/apt/archives/python3-tk_3.6.8-1~18.04_amd64.deb (--unpack):
trying to overwrite '/usr/lib/python3.6/tkinter/__init__.py', which is also in package libpython3.6-stdlib:amd64 3.6.8-1+xenial1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/python3-tk_3.6.8-1~18.04_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
I am also unable to install it using pip, see the error below:
user#vmubu01:~$ pip3.6 install python3-tk
Collecting python3-tk
ERROR: Could not find a version that satisfies the requirement python3-tk (from versions: none)
ERROR: No matching distribution found for python3-tk
If I try to run the 'apt --fix-broken install' command I get:
user#vmubu01:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
python3-tk
Suggested packages:
tix python3-tk-dbg
The following NEW packages will be installed:
python3-tk
0 upgraded, 1 newly installed, 0 to remove and 91 not upgraded.
3 not fully installed or removed.
Need to get 0 B/101 kB of archives.
After this operation, 891 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 206924 files and directories currently installed.)
Preparing to unpack .../python3-tk_3.6.8-1~18.04_amd64.deb ...
Unpacking python3-tk:amd64 (3.6.8-1~18.04) ...
dpkg: error processing archive /var/cache/apt/archives/python3-tk_3.6.8-1~18.04_amd64.deb (--unpack):
trying to overwrite '/usr/lib/python3.6/tkinter/__init__.py', which is also in package libpython3.6-stdlib:amd64 3.6.8-1+xenial1
Errors were encountered while processing:
/var/cache/apt/archives/python3-tk_3.6.8-1~18.04_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
I please advise
Not sure this solution fits for every situation, but here is one that worked for me.
I had the same issue (except it was with Ubuntu 16.04), also tried what #Column01 wrote in comments:
sudo apt-get install python3.6-tk
Same problem.
But that gave me an idea. Checked:
$ python --version
Python 3.5.2
So the solution was as simple as:
sudo apt-get install python3.5-tk

docker.io error when upgrading packages on linux mint

So I have docker installed on Linux Mint 18.3 (dual-boot with Windows 7) and I can run and work with the containers without an issue. However, ever since I installed it, I keep getting errors while I try to upgrade my packages.
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up docker.io (1.13.1-0ubuntu1~16.04.2) ...
addgroup: The group `docker' already exists and is not a system group. Exiting.
dpkg: error processing package docker.io (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
docker.io
E: Sub-process /usr/bin/dpkg returned an error code (1)
I tried to install docker.io again and see what happens:
$ sudo apt-get install docker.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
docker.io is already the newest version (1.13.1-0ubuntu1~16.04.2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up docker.io (1.13.1-0ubuntu1~16.04.2) ...
addgroup: The group `docker' already exists and is not a system group. Exiting.
dpkg: error processing package docker.io (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
docker.io
E: Sub-process /usr/bin/dpkg returned an error code (1)
Running $ groups returns this:
$ groups
kosara adm dialout cdrom sudo dip plugdev lpadmin sambashare docker
I did some digging and ran $ sudo dpkg --configure -a:
$ sudo dpkg --configure -a
Setting up docker.io (1.13.1-0ubuntu1~16.04.2) ...
addgroup: The group `docker' already exists and is not a system group. Exiting.
dpkg: error processing package docker.io (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
docker.io
But it seems that a package that isn't fully installed is to blame, so I tried to fix it:
$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up docker.io (1.13.1-0ubuntu1~16.04.2) ...
addgroup: The group `docker' already exists and is not a system group. Exiting.
dpkg: error processing package docker.io (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
docker.io
E: Sub-process /usr/bin/dpkg returned an error code (1)
I removed docker and did a clean install, to no avail. I'm not really sure what to try next and I couldn't find a solution that works for me so far. Any help would be welcome!

Error when installing libapache2-mod-fastcgi for apache2

When i'm trying to install libapache2-mod-fastcgi for apache as following:
OS: Ubuntu 14.04
root#server:~# sudo apt-get install libapache2-mod-fastcgi
Reading package lists... Done
Building dependency tree
Reading state information... Done
libapache2-mod-fastcgi is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up libapache2-mod-fastcgi (2.4.7~0910052141-1.1) ...
dpkg: error processing package libapache2-mod-fastcgi (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
libapache2-mod-fastcgi
E: Sub-process /usr/bin/dpkg returned an error code (1)
What's wrong ? I've done this before on Ubuntu, But this time an error came up.
Both sudo dpkg --configure -a and sudo apt-get install -f
Setting up libapache2-mod-fastcgi (2.4.7~0910052141-1.1) ...
dpkg: error processing package libapache2-mod-fastcgi (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
libapache2-mod-fastcgi
There was a better solution (yours doesn't works for me):
Uninstall the module
sudo apt-get remove --auto-remove libapache2-mod-fastcgi
Purge config/data
sudo apt-get purge --auto-remove libapache2-mod-fastcgi
Then you can install the module
sudo apt-get install libapache2-mod-fastcgi

dpkg:- error processing package javascript-common (--configure):- while using apt-get command

I was trying to reinstall my apache 2 after un-installing it. But on installing it using command-
sudo apt-get install apache2
i am getting error-
Error while installing apache2
rahul#rahulpc:~$ sudo apt-get clean && sudo apt-get autoclean
[sudo] password for rahul:
Reading package lists... Done
Building dependency tree
Reading state information... Done
rahul#rahulpc:~$ sudo apt-get --reinstall install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libblas3 liblinear-tools liblinear1
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 474 not upgraded.
1 not fully installed or removed.
Need to get 87.4 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main apache2 amd64 2.4.7-1ubuntu4.4 [87.4 kB]
Fetched 87.4 kB in 3s (28.0 kB/s)
(Reading database ... 172062 files and directories currently installed.)
Preparing to unpack .../apache2_2.4.7-1ubuntu4.4_amd64.deb ...
Unpacking apache2 (2.4.7-1ubuntu4.4) over (2.4.7-1ubuntu4.4) ...
Processing triggers for ureadahead (0.100.0-16) ...
ureadahead will be reprofiled on next reboot
Processing triggers for ufw (0.34~rc-0ubuntu2) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up javascript-common (11) ...
dpkg: error processing package javascript-common (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up apache2 (2.4.7-1ubuntu4.4) ...
/etc/init.d/apache2: 64: .: Can't open /etc/apache2/envvars
/etc/init.d/apache2: 76: .: Can't open /etc/apache2/envvars
ERROR: APACHE_PID_FILE needs to be defined in /etc/apache2/envvars
invoke-rc.d: initscript apache2, action "restart" failed.
Errors were encountered while processing:
javascript-common
E: Sub-process /usr/bin/dpkg returned an error code (1)
Also when i run command-
sudo apt-get upgrade
i am getting same error,I think i have removed some essential directories while un-installing apache 2 . Anybody please help me to recover the files and to install apache 2.
Finally i solved the error by running commands-
sudo apt-get clean && sudo apt-get autoclean
sudo apt-get purge apache2
sudo apt-get install apache2
No need to reinstall apache2 (and with purge deleting all configs). Just do:
sudo apt-get purge javascript-common
sudo apt-get install javascript-common

Resources