Wha*_*eIt 2 upgrade package-management python apt dpkg
我已经开始恢复到大约 1.5 周前的 MicroSD 备份映像,直到将其写入全新的 SanDisk Micro SD 卡后,ext4 文件系统在启动时出现了一堆 inode 错误,所有内容都在操作系统或多或少完全损坏了,并且fsck基本上给出了文件系统级别损坏的疯狂列表。这是一张全新的 Sandisk Micro SD 卡,但显然在备份过程中,数据损坏从后门溜进来。
我在 Raspberry Pi 4B 上运行 Ubuntu 20.04,这意味着它在 arm64 架构上运行,因此建议直接从 kernel.org 下载 .deb 软件包或安装 iepython3-minimal不起作用,因为没有任何ARM64 的安装候选。
指向 .deb 和其他安装包的解决方案根本不存在于 arm64 架构中。
还有很多过时的或完全糟糕的建议——而且,手册或 Ubuntu 用户社区中描述的系统恢复方法(Raspberry Pi 上的启动 CD?)都不适用于 Raspberry Pi 上的 20.04 4B,至少现在还没有。
我的安装仍然进展缓慢,但无论我如何尝试,apt/dpkg 更新系统仍然很糟糕。我尝试下载 .deb 软件包并单独安装它们,但没有成功。
至于这一刻;Py3compile 和 Pyclean 在任何地方都找不到,这两个是 dpkg/apt 不起作用的罪魁祸首,所以这个答案不起作用。
$ sudo apt install python3-all
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-all is already the newest version (3.8.2-0ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
Need to get 0 B/129 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up pychess (0.12.2-1build1) ...
/var/lib/dpkg/info/pychess.postinst: 6: pycompile: not found
dpkg: error processing package pychess (--configure):
installed pychess package post-installation script subprocess returned error ex it status 127
dpkg: error processing package python-pkg-resources (--configure):
package is in a very bad inconsistent state; you should
reinstall it before attempting configuration
Setting up gir1.2-dee-1.0 (1.2.7+17.10.20170616-4ubuntu6) ...
/var/lib/dpkg/info/gir1.2-dee-1.0.postinst: 6: pycompile: not found
dpkg: error processing package gir1.2-dee-1.0 (--configure):
installed gir1.2-dee-1.0 package post-installation script subprocess returned e rror exit status 127
Setting up python3-minimal (3.8.2-0ubuntu2) ...
Traceback (most recent call last):
File "/usr/bin/py3compile", line 28, in <module>
import struct
File "/usr/lib/python3.8/struct.py", line 13, in <module>
from _struct import *
ModuleNotFoundError: No module named '_struct'
dpkg: error processing package python3-minimal (--configure):
installed python3-minimal package post-installation script subprocess returned error exit status 1
No apport report written because MaxReports is reached already
Errors were encoun tered while processing:
pychess
python-pkg-resources
gir1.2-dee-1.0
python3-minimal
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)
sudo apt install --reinstall -f python3-all也没有帮助。 $ sudo apt install --reinstall -f python3-all
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
Need to get 0 B/131 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 1052975 files and directories currently installed.)
Preparing to unpack .../python3-all_3.8.2-0ubuntu2_arm64.deb ...
Unpacking python3-all (3.8.2-0ubuntu2) over (3.8.2-0ubuntu2) ...
Setting up pychess (0.12.2-1build1) ...
/var/lib/dpkg/info/pychess.postinst: 6: pycompile: not found
dpkg: error processing package pychess (--configure):
installed pychess package post-installation script subprocess returned error exit status 127
dpkg: error processing package python-pkg-resources (--configure):
package is in a very bad inconsistent state; you should
reinstall it before attempting configuration
Setting up python3-all (3.8.2-0ubuntu2) ...
Setting up gir1.2-dee-1.0 (1.2.7+17.10.20170616-4ubuntu6) ...
/var/lib/dpkg/info/gir1.2-dee-1.0.postinst: 6: pycompile: not found
dpkg: error processing package gir1.2-dee-1.0 (--configure):
installed gir1.2-dee-1.0 package post-installation script subprocess returned error exit status 127
Setting up python3-minimal (3.8.2-0ubuntu2) ...
Traceback (most recent call last):
File "/usr/bin/py3compile", line 28, in <module>
import struct
File "/usr/lib/python3.8/struct.py", line 13, in <module>
from _struct import *
ModuleNotFoundError: No module named '_struct'
dpkg: error processing package python3-minimal (--configure):
installed python3-minimal package post-installation script subprocess returned error exit status 1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
pychess
python-pkg-resources
gir1.2-dee-1.0
python3-minimal
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)
sudo dpkg --configure -a和sudo apt -f install,导致相同的错误。/var/cache/apt/archives/。我尝试直接从 Ubuntu 网站获取 .deb 软件包,解压它们并单独安装。
事实上,根据我浏览过的论坛帖子,至少在过去十年里,每当 Python 出现问题时,人们就会破坏他们的 Ubuntu 和其他基于 Debian 的系统 - 无论是用户错误还是如果包破坏了东西,以某种方式以 Linux 中处理 dpkg/apt 架构的方式进行根本性修复并隔离它们需要从操作系统的其余部分运行的任何 Python 模块和依赖项会更安全吗?或者在出现这种似乎相当普遍的严重情况时创建某种故障安全系统恢复方法。
我回复了您之前的帖子,但似乎它被锁定导致了一些问题。
正如我在原来的帖子中提到的,您可以手动提取相关的 .deb 文件并重建拼凑起来的 Python 来引导自己。看起来https://packages.ubuntu.com/focal/python3没有列出任何适用于 arm64 的镜像,但是经过一些简短的搜索,我发现https://ubuntu.pkgs.org/20.04/ubuntu-main- arm64/python3_3.8.2-0ubuntu2_arm64.deb.html为您提供所有软件包名称,然后指向http://ports.ubuntu.com/pool/main/p/python3.8/进行下载(该镜像包含所有arm64 包)。您必须从“python3”包开始并手动深入所有依赖项以获取所有依赖项。它看起来像py3compile并且py3clean都在python3-minimal 包中
其次,我自己也犯了很多错误,人们可以做无数的事情,这些事情sudo可能会导致系统无法运行,并且没有现实的保障措施。sudo rm每次都需要警告/确认吗?怎么样sudo chmod?对于每一篇关于有人用 Python 问题破坏系统的帖子,我可能都可以指出人们在权限方面做了不好的事情或删除了错误的文件。
| 归档时间: |
|
| 查看次数: |
7006 次 |
| 最近记录: |