I got this error when trying to install anything on ubuntu 16.04.
SyntaxError: invalid syntax
dpkg: error processing archive /var/cache/apt/archives/python-
samba_2%3a4.3.11+dfsg-0ubuntu0.16.04.6_amd64.deb (--unpack):
subprocess new pre-removal script returned error exit status 1
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 1
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
/var/cache/apt/archives/python-libxml2_2.9.3+dfsg1-1ubuntu0.2_amd64.deb
/var/cache/apt/archives/python-samba_2%3a4.3.11+dfsg-0ubuntu0.16.04.6_amd64.deb
N: Ignoring file '50unattended-upgrades.ucf-dist' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension
E: Sub-process /usr/bin/dpkg returned an error code (1)
I have tried apt-get -f install but it shows the same error . could anyone help ?
After a while in searching , i have fixed the problem with those lines in terminal:
$ sudo apt-get clean
$ sudo apt-get update
$ sudo apt-get install --reinstall python-minimal python-lockfile
$ sudo apt-get -f install
For a generic approach on how to deal with the issue stated in this question's header, also check answers of this question
the following fixed my issue
sudo dpkg -P <program>
To fix this problem, please check your Python versions.
Insert command:
update-alternatives --config python
Then enable version 2.7.
Now check.
Related
I am using Ubuntu v20.04.5 LTS for Windows 11. While trying to run sudo apt update.
I get the following error
Hit:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Fetched 114 kB in 2s (58.3 kB/s)
Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFound.db.creator import DbCreator
File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 12, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code.
I've tried re-installing python 3
sudo apt-get install python3-apt --reinstall
Then created a symlink from apt_pkg 34m to apt_pkg 35m & apt_pkg35m to apt_pkg36m
cd /usr/lib/python3/dist-packages
sudo ln -s apt_pkg.cpython-{34m,35m}-x86_64-linux-gnu.so apt_pkg.so
sudo ln -s apt_pkg.cpython-{35m,36m}-x86_64-linux-gnu.so apt_pkg.so
I'm not quite sure executing the above commands helped out on anything. Or I am totally off the track in solving this one. I don't seem to understand why this is happening. Does anyone who might have a rough idea of where the problem is?
I utilize Ubuntu 20.4 and python3.10, but when I run:
sudo apt-get update or sudo apt update
my terminal show me this code:
Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFou/?nd.db.creator import DbCreator
File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 12, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code
When I run: sudo apt-get upgrade no problems happen.
Detail my python3.8 and python3.10 run normally
I don't know what is this.
I ran into same problem today. I did some search via google. Per https://www.linuxquestions.org/questions/linux-software-2/errors-trying-to-run-apt-get-update-4175665017/#3, finally my problem is fixed by followings:
cd /usr/lib/python3/dist-packages
ls -la apt.pkg.*
if apt.pkg.so is no there, copy the one to there.
sudo cp apt_pkg.cpython-38-x86_64-linux-gnu.so apt_pkg.so
I am trying to install this package software-properties-common on Ubuntu 20.04 and I'm facing the following problem:
cp: '/etc/resolv.conf' and '/run/systemd/resolve/stub-resolv.conf' are the same file
dpkg: error processing package systemd (--configure):
installed systemd package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
systemd
E: Sub-process /usr/bin/dpkg returned an error code (1)
Any idea how I could solve it?
I am considering deleting the /run/systemd/resolve/stub-resolv.conf but I am not sure this is a good idea and if it would solve the problem.
I removed /run/systemd/resolve/stub-resolv.conf and ran sudo apt-get -f install again and it solved the issue.
I am getting the error as follows in cygwin
$ make
g++ -O3 -W -Wall -g -c -o ImageIOpng.o ImageIOpng.cpp
ImageIOpng.cpp:19:17: fatal error: png.h: No such file or directory
compilation terminated.
make: *** [<builtin>: ImageIOpng.o] Error 1
After followin to this answer. png.h file not found - Linux,
I had error in the following,
$ sudo apt-get install libpng-dev
-bash: /usr/bin/sudo: Permission denied
I have read that in Linux, I don't need to write sudo, instead of that I can use yum. So, I have tried yum install. But, it says
Traceback (most recent call last):
File "/usr/bin/yum", line 22, in <module>
import yummain
File "/usr/share/yum/yummain.py", line 22, in <module>
import clientStuff
File "/usr/share/yum/clientStuff.py", line 18, in <module>
import rpm
ImportError: No module named rpm
Almost, in every steps, I am getting errors. What was the problem? yum is very useful package, but it seems installed not correctly.I have installed yum-2.0.7.
To install package on cygwin you need to use its setup as downloaded by
https://cygwin.com
see
https://cygwin.com/cygwin-ug-net/setup-net.html#setup-packages
for how to select packages.
yum will not work and please note that Cygwin is not Linux. Most things works in the same way but not all.
I'm trying to run sudo apt-get purge postgresql*, but I get a dependency error and a suggestion to run sudo apt-get -f install, so I try to run it which gives me:
Unpacking linux-image-3.13.0-63-generic (3.13.0-63.104~precise1) over (3.13.0-63.103) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-3.13.0-63-generic_3.13.0-63.104~precise1_amd64.deb (--unpack):
trying to overwrite '/lib/modules/3.13.0-63-generic/kernel/mm/hwpoison-inject.ko', which is also in package linux-image-extra-3.13.0-63-generic 3.13.0-63.103
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-63-generic /boot/vmlinuz-3.13.0-63-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-63-generic /boot/vmlinuz-3.13.0-63-generic
Errors were encountered while processing:
/var/cache/apt/archives/linux-image-3.13.0-63-generic_3.13.0-63.104~precise1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
I'm on 14.04
It seems there is a problem with installer. This command should help:
sudo dpkg --configure -a
After this, you should be able to install required dependencies