Upgrading from Debian 8 problems
I'm trying to upgrade debian to the latest version (I tried to go one upgrade at a time but the apt sources in the guide don't exist anymore)
I'm following the instructions here which seem to be little out of date even though its dated as updated in March this year, Stretch is a long way from being the latest version
https://www.linode.com/docs/guides/upgrade-debian-to-the-newest-release/
I changed stretch to bookworm and that was working. I didn't get asked about grub but otherwise it seemed to be going ok until it exited, which apparently was expected with fail2ban installed, I followed the troubleshooting and I don't have a fail2ban.local but that line did exist in fail2ban.conf so I commented it out and moved on to the next step when I get the following errors
root@localhost:~# sudo dpkg --configure -a
Setting up python3-pkg-resources (66.1.1-1) …
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2622
**kw,
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/importlib_resources/_adapters.py", line 134
return CompatibilityFiles.OrphanPath(*self._path, other)
^
SyntaxError: only named arguments may follow *expression
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/importlib_resources/_common.py", line 55
raise TypeError(f'{package!r} is not a package')
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/importlib_resources/_itertools.py", line 24
seen: Set[Union[_T, _U]] = set()
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/importlib_resources/_legacy.py", line 19
f"{func.name} is deprecated. Use files() instead. "
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/importlib_resources/readers.py", line 74
raise FileNotFoundError(f'{self} is not a file')
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/jaraco/functools.py", line 175
bound_method: CallableT = types.MethodType( # type: ignore[assignment]
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/more_itertools/more.py", line 3169
yield [[e], *p]
^
SyntaxError: can use starred expression only as assignment target
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/_manylinux.py", line 39
result: Tuple[int, …] = struct.unpack(fmt, data)
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/_musllinux.py", line 72
major: int
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/vendor/packaging/markers.py", line 63
return f"<{self.class_.__name}('{self}')>"
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/requirements.py", line 105
f'Parse error at "{ requirement_string[e.loc : e.loc + 8]!r}": {e.msg}'
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/specifiers.py", line 92
_operators: Dict[str, str] = {}
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/tags.py", line 30
INTERPRETER_SHORT_NAMES: Dict[str, str] = {
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/utils.py", line 56
parts.append(f"{parsed.epoch}!")
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/version.py", line 61
_key: Union[CmpKey, LegacyCmpKey]
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/vendor/platformdirs/init_.py", line 5
from __future import annotations
SyntaxError: future feature annotations is not defined
File "/usr/lib/python3/dist-packages/pkg_resources/vendor/platformdirs/main_.py", line 22
print(f"-- platformdirs {__version} --")
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/platformdirs/android.py", line 89
result: str | None = Context.getFilesDir().getParentFile().getAbsolutePath()
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/platformdirs/api.py", line 1
from future import annotations
SyntaxError: future feature annotations is not defined
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/platformdirs/macos.py", line 1
from future import annotations
SyntaxError: future feature annotations is not defined
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/platformdirs/unix.py", line 51
path = f"/usr/local/share{os.pathsep}/usr/share"
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/platformdirs/windows.py", line 114
raise ValueError(f"Unknown CSIDL name: {csidl_name}")
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/pyparsing/init.py", line 100
major: int
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/pyparsing/core.py", line 50
str_type: Tuple[type, …] = (str, bytes)
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/pyparsing/diagram/init.py", line 251
self.element: pyparsing.ParserElement = element
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/pyparsing/helpers.py", line 22
) -> ParserElement:
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/pyparsing/results.py", line 7
str_type: Tuple[type, …] = (str, bytes)
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/pyparsing/testing.py", line 186
for rpt, expected in zip(run_test_results, expected_parse_results)
^
SyntaxError: can use starred expression only as assignment target
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/pyparsing/unicode.py", line 53
_ranges: UnicodeRangeList = []
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/pyparsing/util.py", line 15
_all_names: List[str] = []
^
SyntaxError: invalid syntax
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/typing_extensions.py", line 94
raise TypeError(f"{cls} is not a generic class")
^
SyntaxError: invalid syntax
dpkg: error processing package python3-pkg-resources (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of postfix-policyd-spf-python:
postfix-policyd-spf-python depends on python3-pkg-resources; however:
Package python3-pkg-resources is not configured yet.
dpkg: error processing package postfix-policyd-spf-python (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python3-pkg-resources
postfix-policyd-spf-python
Now I'm stuck half way through an OS upgrade
1 Reply
It appears that there's an issue with the python3-pkg-resources
package after the upgrade. The error messages you provided suggest that there are syntax problems in certain Python files. These errors are likely due to an incompatibility between the version of python3-pkg-resources
you currently have installed and the version of Python on your system. To address this problem, you may want to give the following steps a try:
Remove the python3-pkg-resources
package:
sudo dpkg --remove python3-pkg-resources
Note, you may have to add --force-depends
to the first command if you get dependency errors when attempting to remove the package.
Then attempt to repair any broken dependencies:
sudo apt --fix-broken install
Finally, proceed with the upgrade process:
sudo apt dist-upgrade
If all worked, the the dist-upgrade
command should continue the upgrade process.
If these above steps does not resolve the problem, then it's possible that there are additional conflicting packages or other configuration issues within your system. In such cases, it may be worth performing a fresh installation of Debian 12 (and then migrating your data over) rather than attempting to upgrade from an older version (see link below).