paramiko RSA key failure
Today I upgraded the Ubuntu version used in my Github Actions for building and uploading Fdroid nightlies from 20.04 to 22.04 [1] because I was hitting this error message [2]:
The following packages have unmet dependencies:
fdroidserver : Depends: apksigner (>= 31) but 30.0.3-4~focal is to be installed
E: Unable to correct problems, you have held broken packages.
Error: Process completed with exit code 100.
The dependencies error is gone now, but I see a new error now [3]:
Importing keystore /home/runner/.android/debug.keystore to /tmp/.in3s3dfx/.keystore.p12...
writing RSA key
2022-09-08 22:03:05,397 CRITICAL: Unknown exception found!
Traceback (most recent call last):
File "/usr/bin/fdroid", line 33, in <module>
sys.exit(load_entry_point('fdroidserver==2.1.1', 'console_scripts', 'fdroid')())
File "/usr/lib/python3/dist-packages/fdroidserver/__main__.py", line 230, in main
raise e
File "/usr/lib/python3/dist-packages/fdroidserver/__main__.py", line 211, in main
mod.main()
File "/usr/lib/python3/dist-packages/fdroidserver/nightly.py", line 310, in main
ssh_private_key_file = _ssh_key_from_debug_keystore()
File "/usr/lib/python3/dist-packages/fdroidserver/nightly.py", line 114, in _ssh_key_from_debug_keystore
rsakey = paramiko.RSAKey.from_private_key_file(privkey)
File "/usr/lib/python3/dist-packages/paramiko/pkey.py", line 249, in from_private_key_file
key = cls(filename=filename, ***
File "/usr/lib/python3/dist-packages/paramiko/rsakey.py", line 64, in __init__
self._from_private_key_file(filename, password)
File "/usr/lib/python3/dist-packages/paramiko/rsakey.py", line 190, in _from_private_key_file
data = self._read_private_key_file("RSA", filename, password)
File "/usr/lib/python3/dist-packages/paramiko/pkey.py", line 322, in _read_private_key_file
data = self._read_private_key(tag, f, password)
File "/usr/lib/python3/dist-packages/paramiko/pkey.py", line 338, in _read_private_key
raise SSHException("not a valid {} private key file".format(tag))
paramiko.ssh_exception.SSHException: not a valid RSA private key file
Error: Process completed with exit code 1.
This doesn't seem to be a random failure since I retried the job and it failed with the same message. I also checked and saw that the last paramiko release was in May this year, so there shouldn't be any version change for paramiko that makes this fail. Maybe it is still related to it though, because a newer Ubuntu version might allow to pull in a newer paramiko version? To me it's not clear where the problem originates because I couldn't find any relevant code changes in fdroidserver.
[1] https://github.com/jld3103/nextcloud-neon/commit/6b13f5dc1cb7b1824a8cd868c619169743b85e16
[2] https://github.com/jld3103/nextcloud-neon/runs/8259235421
[3] https://github.com/jld3103/nextcloud-neon/runs/8259546902