apt - dpkg python-rpi.gpio dependency problems - python

Every time i try to install something, upgrade or autoremove this error happens!
I've searched the web and tried some fixes but they don't seem to work, I don't have python2.7 installed only 3 and can't install python2 or anything because of this. I've tryed to sudo rm python-rpi.gpio_0.7.0-0.1~bpo10+4_armhf.deb but the file will keep comming. Pls I really need some help since I've got some work on my pi and don't want to get a new image
sudo apt autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
python-rpi.gpio
The following packages will be upgraded:
python-rpi.gpio
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
18 not fully installed or removed.
Need to get 0 B/20.7 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Reading changelogs... Done
(Reading database ... 152893 files and directories currently installed.)
Preparing to unpack .../python-rpi.gpio_0.7.0-0.1~bpo10+4_armhf.deb ...
/var/lib/dpkg/info/python-rpi.gpio.prerm: 6: /var/lib/dpkg/info/python-rpi.gpio.prerm: pyclean: Too many levels of symbolic links
dpkg: warning: old python-rpi.gpio package pre-removal script subprocess returned error exit status 2
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: pyclean: Too many levels of symbolic links
dpkg: error processing archive /var/cache/apt/archives/python-rpi.gpio_0.7.0-0.1~bpo10+4_armhf.deb (--unpack):
new python-rpi.gpio package pre-removal script subprocess returned error exit status 2
/var/lib/dpkg/info/python-rpi.gpio.postinst: 6: /var/lib/dpkg/info/python-rpi.gpio.postinst: pycompile: Too many levels of symbolic links
dpkg: error while cleaning up:
installed python-rpi.gpio package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
/var/cache/apt/archives/python-rpi.gpio_0.7.0-0.1~bpo10+4_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Some notes: I really really don't want to change the SD Card and parcially lose what I have, second I've tried sudo apt-get install -f and sudo apt update --fix-missing when i followed this guide the sudo dpkg --remove --force-remove --reinstreq command was showing this error dpkg: error: unknown force/refuse option 'remove'

As it turns out I still had remainnings of Python2 and Python3 binaries and those were not linked properly by the OS, this means that Python3 was linked to Python2 and vice-versa.
To get it working I had to:
Uninstall the Python2 dependencies
Get the link working correctly
Reinstall Python2 with wget
Verify if all links are working correctly (for Raspbian this means):
python --version links to Python2
python2 --version links to Python2
python3 --version links to Python3

Use the following commands:
sudo dpkg -i --force-overwrite /var/cache/apt/archives//python-rpi.gpio_0.7.0-0.1~bpo10+4_armhf.deb
Still have the same problem, use:
sudo mv /var/lib/dpkg/info/python-rpi.gpio.* /tmp/
sudo dpkg --remove --force-remove-reinstreq python-rpi.gpio
A typo in your command sudo dpkg --remove --force-remove --reinstreq isn't valide. The correct option is --force-remove-reinstreq. See dpkg --force-help.

Related

Transaction check error due to conflicting python versions during packstack install of OpenStack-Train

The packstack installation of openstack is failing with the following error -
/Stage[main]/Nova::Vncproxy/Nova::Generic_service[vncproxy]/Package[nova-vncproxy]/ensure: change from 'purged' to 'present' failed: Execution of '/usr/bin/yum -d 0 -e 0 -y install openstack-nova-novncproxy' returned 1: Transaction check error:
file /usr/bin/websockify from install of python2-websockify-0.8.0-13.el7.noarch conflicts with file from package python3-websockify-0.10.0-3.el8.noarch
file /usr/share/man/man1/websockify.1.gz from install of python2-websockify-0.8.0-13.el7.noarch conflicts with file from package python3-websockify-0.10.0-3.el8.noarch
Above you can see that two files (/usr/bin/websockify & /usr/share/man/man1/websockify.1.gz) are conflicting between python2-websockify & python3-websockify & so any one of them has to be removed but,
while checking the installed packages of the system I can see that python2-websockify is only available in the system but not installed in the system.
[root#controller ~]# yum list | grep -i python2-web
python2-webob.noarch 1.8.5-1.el7 #centos-ceph-nautilus
python2-websocket-client.noarch 0.54.0-1.el7 centos-ceph-nautilus
python2-websockify.noarch 0.8.0-13.el7 centos-openstack-train
[root#controller ~]# yum list installed | grep -i python2-web
python2-webob.noarch 1.8.5-1.el7 #centos-ceph-nautilus
However python3-websockify is installed in the system & I cannot remove it because the nova-novnc package has a dependency on that one.
[root#controller ~]# yum list installed | grep -i python3-web
python3-websockify.noarch 0.10.0-3.el8 #/python3-websockify-0.10.0-3.el8.noarch
Now, how can I remove the python2-websockify.noarch which is not even installed on the system?
& when it is not installed then why the error is mentioning
from install of python2-websockify-0.8.0-13.el7.noarch conflicts with file from package python3-websockify-0.10.0-3.el8.noarch
I tried to delete the python2-websockify but as it is not installed so giving following messages -
[root#controller ~]# yum remove python2-websockify-0.8.0-13.el7.noarch
Loaded plugins: fastestmirror
No Match for argument: python2-websockify-0.8.0-13.el7.noarch
No Packages marked for removal
Problem solved after removing the epel-release because the puppet was coming updated from Epel instead of packstack
#yum autoremove epel-release

Can't install packages like simpleHTTPServer with pip2.7

I'm trying to install a module called simpleHTTPServer but can't do so as described below:
root#kali:~# pip install simpleHTTPServer
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
ERROR: Could not find a version that satisfies the requirement simpleHTTPServer (from versions: none)
ERROR: No matching distribution found for simpleHTTPServer
root#kali:~#
I've screwed up my python2.7 a few hours ago by accidentally removing (rm) the python2.7 file in /usr/bin instead of renaming it with mv because i didn't pay attention to what i was doing. So I removed everything that had to do with python2.7. I've then managed to download python 2.7.18 from the official site and executed these commands below AS ROOT:
cd /home/johnmap007/Downloads/Python-2.7.18
./configure
make
make install
python setup.py clean
python setup.py build
python setup.py install
Then I got back up and running. pip started to work ok and python gives me the interpreter when i execute it in the cmd line. I am running Kali Linux by the way. I tried installing other packages like scapy and they worked. I don't know why i can't install this specific package. Any help would be greatly appreciated. Thanks in advance!
EDIT: For some reason, as i was running apt upgrade, i got errors about python2.7 not being configured the right way:
Setting up python2.7 (2.7.18-1) ...
/var/lib/dpkg/info/python2.7.postinst: 9: /usr/bin/python2.7: not found
dpkg: error processing package python2.7 (--configure):
installed python2.7 package post-installation script subprocess returned error exit status 127
Setting up sqlmap (1.4.11-1) ...
Installing new version of config file /etc/sqlmap/sqlmap.conf ...
Setting up libgstreamer-plugins-base1.0-0:amd64 (1.18.1-1) ...
Setting up libgstreamer-plugins-base1.0-0:i386 (1.18.1-1) ...
dpkg: dependency problems prevent configuration of python2:
python2 depends on python2.7 (>= 2.7.18~); however:
Package python2.7 is not configured yet.
dpkg: error processing package python2 (--configure):
dependency problems - leaving unconfigured
Setting up seclists (2020.4-0kali1) ...
Setting up libgstreamer-gl1.0-0:amd64 (1.18.1-1) ...
Setting up gstreamer1.0-plugins-base:amd64 (1.18.1-1) ...
Setting up gstreamer1.0-plugins-base:i386 (1.18.1-1) ...
Setting up python3-cryptography (3.2.1-1) ...
Setting up libsvn1:amd64 (1.14.0-3) ...
dpkg: dependency problems prevent configuration of python2.7-dev:
python2.7-dev depends on python2.7 (= 2.7.18-1); however:
Package python2.7 is not configured yet.
dpkg: error processing package python2.7-dev (--configure):
dependency problems - leaving unconfigured
Setting up gstreamer1.0-gl:amd64 (1.18.1-1) ...
Setting up gstreamer1.0-x:amd64 (1.18.1-1) ...
Setting up gstreamer1.0-x:i386 (1.18.1-1) ...
Setting up gstreamer1.0-alsa:amd64 (1.18.1-1) ...
dpkg: dependency problems prevent configuration of python2-dev:
python2-dev depends on python2 (= 2.7.18-2); however:
Package python2 is not configured yet.
python2-dev depends on python2.7-dev (>= 2.7.18~); however:
Package python2.7-dev is not configured yet.
dpkg: error processing package python2-dev (--configure):
dependency problems - leaving unconfigured
Setting up gir1.2-gst-plugins-base-1.0:amd64 (1.18.1-1) ...
Setting up subversion (1.14.0-3) ...
Processing triggers for kali-menu (2020.4.0) ...
Processing triggers for libc-bin (2.31-4) ...
Processing triggers for man-db (2.9.3-2) ...
Errors were encountered while processing:
python2.7
python2
python2.7-dev
python2-dev
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
I have no idea what happened and i tried running dpkg --configure -a already. Can someone help me please?
That's in the standard library, so you don't need to install anything
https://docs.python.org/2/library/simplehttpserver.html
You can start it with
python -m SimpleHTTPServer
But you should use Python3, anyway, where it's renamed
python3 -m http.server
I removed everything that had to do with python2.7
You're modifying operating system files at that point, and Kali Linux uses Python for more than your own scripting purposes. But based on /usr/bin/python2.7: not found, you could start symlink-ing files around to fix at least that error

Elasticsearch Errors while doing any operation with system?

I have installed Elasticsearch and now due to some changes done by other folks at my work place some errors keep on popping up during any operation like update, install a new package and also the elasticsearch is not working properly.
Error Log is attached for installing new package.
$ sudo apt-get install bash-completion
Reading package lists... Done
Building dependency tree
Reading state information... Done
bash-completion is already the newest version (1:2.1-4.2ubuntu1.1).
0 upgraded, 0 newly installed, 0 to remove and 15 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 elasticsearch (5.5.0) ...
Failed to restart systemd-sysctl.service: No such method 'RestartUnit'
See system logs and 'systemctl status systemd-sysctl.service' for details.
dpkg: error processing package elasticsearch (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
elasticsearch
E: Sub-process /usr/bin/dpkg returned an error code (1)
I even tried different solutions from online like trying to remove elasticsearch completely from system.
Steps I followed.
sudo rm -rf /var/lib/elasticsearch
sudo rm -rf /etc/elasticsearch
sudo apt-get install -f
$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 15 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up elasticsearch (5.5.0) ...
Failed to restart systemd-sysctl.service: No such method 'RestartUnit'
See system logs and 'systemctl status systemd-sysctl.service' for details.
dpkg: error processing package elasticsearch (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
elasticsearch
E: Sub-process /usr/bin/dpkg returned an error code (1)
sudo apt-get --purge autoremove elasticsearch
$ sudo apt-get --purge autoremove elasticsearch
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
elasticsearch*
0 upgraded, 0 newly installed, 1 to remove and 15 not upgraded.
1 not fully installed or removed.
After this operation, 37.3 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 329402 files and directories currently installed.)
Removing elasticsearch (5.5.0) ...
Stopping elasticsearch service...Failed to stop elasticsearch.service: Unknown unit: elasticsearch.service
See system logs and 'systemctl status elasticsearch.service' for details.
Failed to get load state of elasticsearch.service: No such property 'LoadState'
dpkg: error processing package elasticsearch (--purge):
subprocess installed pre-removal script returned error exit status 1
Failed to restart systemd-sysctl.service: No such method 'RestartUnit'
See system logs and 'systemctl status systemd-sysctl.service' for details.
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
elasticsearch
E: Sub-process /usr/bin/dpkg returned an error code (1)
I restarted the system but the error keep on appearing again and again.
Any one with suggestions on how to solve this issue?
Also this command gives nothing
$ systemctl status systemd-sysctl.service
Failed to get properties: No such interface ''
is systemd your init service in this installation? Also what linux distribution is this? Which version of your distribution? I am currently thinking that you might not be using systemd, but the elasticsearch package is assuming this somehow.
I'd highly appreciate if you open up a bug report in the elasticsearch repository with all of the above information, this warrants more research on the ES side (disclaimer: I'm an ES developer and keen to get this fixed :-).
Also: You can try to remove the elasticsearch package completely by running dpkg -P elasticsearch.
And in addition you can try to add set -x to /var/lib/dpkg/info/elasticsearch.postinst and run sh /var/lib/dpkg/info/elasticsearch.postinst configure
to get more debugging output
I had quite the same problem.
It is obiviously related to systemctl, not elasticsearch.
First you have to determine if u are using it.
[[ `systemctl` =~ -\.mount ]] && echo yes || echo no
In my case, the answer was "no"
So you have to enable it.

Remove mercurial-common from Ubuntu 15.04

I'm having Python 2.x problems on Ubuntu 15.04. I wanted to completely uninstall and reinstall Python. I can't uninstall Python because mercurial-common depends on it. I try to remove that and I get an error:
➜ ~ sudo apt-get remove --purge mercurial-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
gnome-control-center-data gnome-icon-theme gnome-icon-theme-symbolic gnome-settings-daemon libcolord-gtk1 libexpat1-dev libgoa-backend-1.0-1 libjs-excanvas libpython3-dev
libpython3.4-dev python3-colorama python3-dev python3-distlib python3-wheel python3.4-dev
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
mercurial-common*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 8,610 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 206144 files and directories currently installed.)
Removing mercurial-common (3.1.2-2+deb8u1build0.15.04.2) ...
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
dpkg: error processing package mercurial-common (--purge):
subprocess installed pre-removal script returned error exit status 1
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
mercurial-common
E: Sub-process /usr/bin/dpkg returned an error code (1)
The mercurial-common removal scripts use python
/var/lib/dpkg/info/mercurial-common.prerm
If you type which pyclean I assume it exists.
However I suspect you python problems prevent it working. (you could try running it manually to verify this)
Unfortunately pyclean is in package python-minimal so you prolly can't uninstall this before mercurial-common.
you could try just removing it manually by:
sudo mv /usr/bin/pyclean /usr/bin/pyclean.backup
(Just remember to put it back).
Alternatively rather than completely removing python you could try just reinstalling python package .deb over the top of the existing install using dpkg --install

dependencies of python 27 for RHEL5

Essentially I am trying to get Python2.7 to work on Linux EL5, but currently with no success. Really appreciate some pointer from anyone who has done this before.
Anyone happens to know whether there is a repo to get all the dependencies (EL5 rpms if not sources) for Python 2.7?
I could find the RPMs for Python27 EL5 at http://ftp.srce.hr/redhat/test/el5/x86_64/ but still not complete.
m000772#hkl20030997 ~]$ rpm -ivh python27-2.7.2-5.2.el5.x86_64.rpm
error: Failed dependencies:
libpython2.7.so.1.0()(64bit) is needed by python27-2.7.2-5.2.el5.x86_64 python27-libs = 2.7.2-5.2.el5 is needed by python27-2.7.2-5.2.el5.x86_64
[m000772#hkl20030997 ~]$ rpm -ivh python27-libs-2.7.2-5.2.el5.x86_64.rpm
error: Failed dependencies:
libdb-4.8.so()(64bit) is needed by python27-libs-2.7.2-5.2.el5.x86_64
Now there is no RPM for libdb-4.8
You can use yum, this command take care of all dependencies.
First check with the following command:
# yum search python27
And the try with the available version..for example
# yum install python27

Categories