Can't 'sudo apt upgrade grafana'

MaximB

New Member
Joined
Jul 30, 2024
Messages
1
Reaction score
0
Credits
86
when I try to upgrade grafana, I get this error:

ubuntu@ip-172-31-28-186:~$ sudo apt upgrade grafana
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
linux-aws-6.5-headers-6.5.0-1024 linux-headers-6.5.0-1024-aws linux-image-6.5.0-1024-aws linux-modules-6.5.0-1024-aws
The following packages will be upgraded:
apt apt-transport-https apt-utils bind9-dnsutils bind9-host bind9-libs binutils binutils-common binutils-x86-64-linux-gnu bsdextrautils cloud-init cpio curl dpkg-dev ec2-hibinit-agent eject ethtool fdisk
git git-man grafana gtk-update-icon-cache intel-microcode iptables klibc-utils landscape-common less libarchive13 libbinutils libc-bin libctf-nobfd0 libctf0 libcups2 libcurl3-gnutls libcurl4 libdpkg-perl
libexpat1 libexpat1-dev libfdisk1 libgnutls30 libgpgme11 libgtk-3-0 libgtk-3-bin libgtk-3-common libip4tc2 libip6tc2 libklibc libldap-2.5-0 libldap-common libnghttp2-14 libnspr4 libnss3 libpython3.10
libpython3.10-dev libpython3.10-minimal libpython3.10-stdlib libsmartcols1 libssl-dev libssl3 libtiff5 libtss2-esys-3.0.2-0 libtss2-mu0 libtss2-sys1 libtss2-tcti-cmd0 libtss2-tcti-device0
libtss2-tcti-mssim0 libtss2-tcti-swtpm0 libxml2 libxml2-dev libxtables12 linux-aws linux-headers-aws linux-image-aws linux-libc-dev locales mount mysql-client-8.0 mysql-client-core-8.0 mysql-server
mysql-server-8.0 mysql-server-core-8.0 open-vm-tools openssh-client openssh-server openssh-sftp-server openssl passwd python3-apt python3-cryptography python3-distro-info python3-distupgrade python3-idna
python3-jinja2 python3-pil python3-pil.imagetk python3-update-manager python3-zipp python3.10 python3.10-dev python3.10-minimal snapd tcpdump tzdata ubuntu-minimal ubuntu-pro-client-l10n ubuntu-standard
update-notifier-common uuid-runtime vim vim-common vim-runtime vim-tiny wget xxd
114 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
18 not fully installed or removed.
Need to get 0 B/292 MB of archives.
After this operation, 285 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Extracting templates from packages: 100%
Preconfiguring packages ...
Setting up coreutils (8.32-4.1ubuntu1.2) ...
(Reading database ... 165887 files and directories currently installed.)
Preparing to unpack .../0-python3-apt_2.4.0ubuntu3_amd64.deb ...
/var/lib/dpkg/info/python3-apt.prerm: 6: py3clean: not found
dpkg: warning: old python3-apt package pre-removal script subprocess returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: py3clean: not found
dpkg: error processing archive /tmp/apt-dpkg-install-hiAkOo/0-python3-apt_2.4.0ubuntu3_amd64.deb (--unpack):
new python3-apt package pre-removal script subprocess returned error exit status 127
/var/lib/dpkg/info/python3-apt.postinst: 6: py3compile: not found
dpkg: error while cleaning up:
installed python3-apt package post-installation script subprocess returned error exit status 127
Preparing to unpack .../1-python3-distro-info_1.1ubuntu0.2_all.deb ...
/var/lib/dpkg/info/python3-distro-info.prerm: 6: py3clean: not found
dpkg: warning: old python3-distro-info package pre-removal script subprocess returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: py3clean: not found
dpkg: error processing archive /tmp/apt-dpkg-install-hiAkOo/1-python3-distro-info_1.1ubuntu0.2_all.deb (--unpack):
new python3-distro-info package pre-removal script subprocess returned error exit status 127
/var/lib/dpkg/info/python3-distro-info.postinst: 6: py3compile: not found
dpkg: error while cleaning up:
installed python3-distro-info package post-installation script subprocess returned error exit status 127
Preparing to unpack .../2-python3-distupgrade_1%3a22.04.19_all.deb ...
/var/lib/dpkg/info/python3-distupgrade.prerm: 6: py3clean: not found
dpkg: warning: old python3-distupgrade package pre-removal script subprocess returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: py3clean: not found
dpkg: error processing archive /tmp/apt-dpkg-install-hiAkOo/2-python3-distupgrade_1%3a22.04.19_all.deb (--unpack):
new python3-distupgrade package pre-removal script subprocess returned error exit status 127
/var/lib/dpkg/info/python3-distupgrade.postinst: 6: py3compile: not found
dpkg: error while cleaning up:
installed python3-distupgrade package post-installation script subprocess returned error exit status 127
Preparing to unpack .../3-python3-update-manager_1%3a22.04.20_all.deb ...
/var/lib/dpkg/info/python3-update-manager.prerm: 6: py3clean: not found
dpkg: warning: old python3-update-manager package pre-removal script subprocess returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: py3clean: not found
dpkg: error processing archive /tmp/apt-dpkg-install-hiAkOo/3-python3-update-manager_1%3a22.04.20_all.deb (--unpack):
new python3-update-manager package pre-removal script subprocess returned error exit status 127
/var/lib/dpkg/info/python3-update-manager.postinst: 6: py3compile: not found
dpkg: error while cleaning up:
installed python3-update-manager package post-installation script subprocess returned error exit status 127
Preparing to unpack .../4-landscape-common_23.02-0ubuntu1~22.04.3_amd64.deb ...
/var/lib/dpkg/info/landscape-common.prerm: 42: py3clean: not found
dpkg: warning: old landscape-common package pre-removal script subprocess returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 42: py3clean: not found
dpkg: error processing archive /tmp/apt-dpkg-install-hiAkOo/4-landscape-common_23.02-0ubuntu1~22.04.3_amd64.deb (--unpack):
new landscape-common package pre-removal script subprocess returned error exit status 127
/var/lib/dpkg/info/landscape-common.postinst: 126: py3compile: not found
dpkg: error while cleaning up:
installed landscape-common package post-installation script subprocess returned error exit status 127
Preparing to unpack .../5-python3-jinja2_3.0.3-1ubuntu0.2_all.deb ...
/var/lib/dpkg/info/python3-jinja2.prerm: 6: py3clean: not found
dpkg: warning: old python3-jinja2 package pre-removal script subprocess returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: py3clean: not found
dpkg: error processing archive /tmp/apt-dpkg-install-hiAkOo/5-python3-jinja2_3.0.3-1ubuntu0.2_all.deb (--unpack):
new python3-jinja2 package pre-removal script subprocess returned error exit status 127
/var/lib/dpkg/info/python3-jinja2.postinst: 6: py3compile: not found
dpkg: error while cleaning up:
installed python3-jinja2 package post-installation script subprocess returned error exit status 127
Preparing to unpack .../6-cloud-init_24.1.3-0ubuntu1~22.04.5_all.deb ...
/var/lib/dpkg/info/cloud-init.prerm: 20: py3clean: not found
dpkg: warning: old cloud-init package pre-removal script subprocess returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 21: py3clean: not found
dpkg: error processing archive /tmp/apt-dpkg-install-hiAkOo/6-cloud-init_24.1.3-0ubuntu1~22.04.5_all.deb (--unpack):
new cloud-init package pre-removal script subprocess returned error exit status 127
/var/lib/dpkg/info/cloud-init.postinst: 414: py3compile: not found
dpkg: error while cleaning up:
installed cloud-init package post-installation script subprocess returned error exit status 127
Preparing to unpack .../7-libc-bin_2.35-0ubuntu3.8_amd64.deb ...
Unpacking libc-bin (2.35-0ubuntu3.8) over (2.35-0ubuntu3.6) ...
Errors were encountered while processing:
/tmp/apt-dpkg-install-hiAkOo/0-python3-apt_2.4.0ubuntu3_amd64.deb
/tmp/apt-dpkg-install-hiAkOo/1-python3-distro-info_1.1ubuntu0.2_all.deb
/tmp/apt-dpkg-install-hiAkOo/2-python3-distupgrade_1%3a22.04.19_all.deb
/tmp/apt-dpkg-install-hiAkOo/3-python3-update-manager_1%3a22.04.20_all.deb
/tmp/apt-dpkg-install-hiAkOo/4-landscape-common_23.02-0ubuntu1~22.04.3_amd64.deb
/tmp/apt-dpkg-install-hiAkOo/5-python3-jinja2_3.0.3-1ubuntu0.2_all.deb
/tmp/apt-dpkg-install-hiAkOo/6-cloud-init_24.1.3-0ubuntu1~22.04.5_all.deb
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
 


I see a couple of Python 3 errors
py3clean: not found
py3compile: not found

which is most likely caused by python3.10-minimal in your case being in a bad state - py3clean and py3complie are part of it - I would use Synaptic Package Manager and remove that version then install the python3.11-minimal version - after install reboot and try upgrading again

In fact I would also check the following files as well - python3.10 - python3.10-dev - most likely they are installed as well and upgrade them through the Synaptic Package Manager to 3.11 if they are install reboot after all 3 files have been upgraded then try again
 
If the above is not working, I'd be even more radical than @GatorsFan and purge anything Python* and then let installation procedure install what it wants from scratch.
 
Last edited:
No, please don't try that. A Linux OS needs Python to function. Removing it all will probably kill the OS. See here. Even though that link is old, I think the risk is still there. :eek:
Thanks for pointing out! I'll go strike trough my post.
 
Use apt install <package> instead of apt upgrade package.

Signed,

Matthew Campbell
 


Members online


Top