Unable to update python39 on Raspberry Pi

I keep getting this error.

Is the package itself broken?

Even after I clean out /var/cache/pkg and run pkg upgrade again I get the same error


Code:
[36/38] Fetching sqlite3-3.41.2,1.pkg: 100%    1 MiB   1.1MB/s    00:01   
[37/38] Fetching glib-2.76.2,2.pkg: 100%    3 MiB   3.5MB/s    00:01   
[38/38] Fetching libvpx-1.13.0.pkg: 100%    1 MiB   1.2MB/s    00:01   
Checking integrity... done (0 conflicting)
[1/38] Upgrading python39 from 3.9.16_1 to 3.9.16_2...
[1/38] Extracting python39-3.9.16_2: 100%
python39-3.9.16_1: missing file /usr/local/share/licenses/python39-3.9.16_1/LICENSE
python39-3.9.16_1: missing file /usr/local/share/licenses/python39-3.9.16_1/PSFL
python39-3.9.16_1: missing file /usr/local/share/licenses/python39-3.9.16_1/catalog.mk
pkg: Unable to open the tigger: python3.9.ucl
pkg: plop(python3.9.ucl): No such file or directory
python39-3.9.16_1: missing file /usr/local/share/pkg/triggers/python3.9.ucl
pkg: Fail to rename /usr/local/lib/python3.9/test/.pkgtemp.test_warnings.5wHdsMTtEFTz -> /usr/local/lib/python3.9/test/test_warnings:Invalid argument
 
Try upgrading to 13.2. It's not a solution but it will do no harm.
Then do
Code:
pkg update -f
pkg upgrade -f
This will solve any conflicts
After check if there are older python packages.
Code:
pkg info | grep py | grep -v py39
Remove those older python packages manually. And install the newer ones.
 
Try cleaning out the cache, maybe the package you downloaded was corrupt in some way.

pkg clean -a
 
After check if there are older python packages.
Code:
pkg info | grep py | grep -v py39
Remove those older python packages manually. And install the newer ones.
Would it not be easier to just do pkg install of devel/[pkgname]?
I ran into this recently with an install. Discovered I could mitigate not having to worry about what python version to install with the package name. Just stating the category/package name simplifies from a maintenance perspective.
 
Does /usr/local/lib/python3.9/test/test_warnings already exist? Try to delete it if that's the case.
 
Make sure to restart, specifically sshd needs to be restarted, but you need a restart anyway, so may as well restart the whole machine.
 
Make sure to restart, specifically sshd needs to be restarted, but you need a restart anyway, so may as well restart the whole machine.

Yep, I had walked away from the computer that I used for sshing into the pi thinking I had run restart after the freebsd-update install, but it turned out I was still logged in over ssh on that computer and had not run restart 😅
 
Anyway, after the restart was done it was still failing to update Python 3.9 so I put

Code:
pkg prime-list > prime.txt

So that I have a list of all manually installed packages

And then I did pkg remove python3.9

And indeed as some others were asking, it seems that the previous install of python3.9 was missing some files

Perhaps the crappy SD card lost some of the files from the originally installed python3.9 at some point or something

Currently upgrading other packages and will then try to install the things that were using python3.9 again
 
Yep, it's filesystem corruption :/

Code:
doas rm -rf /usr/local/lib/python3.9

Code:
rm: /usr/local/lib/python3.9/test/test_tk.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_tokenize.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_trace.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_traceback.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_ucn.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_tracemalloc.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_ttk_guionly.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_ttk_textonly.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_tuple.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_turtle.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_type_comments.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_typechecks.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_types.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_typing.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unary.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unicode.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unicode_file.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unicode_file_functions.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unicode_identifiers.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unicodedata.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unittest.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_univnewlines.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unpack.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unpack_ex.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unparse.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_urllib.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_urllib2.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_urllib2_localnet.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_urllib2net.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_urllib_response.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_urllibnet.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_urlparse.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_userdict.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_userlist.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_userstring.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_utf8_mode.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_utf8source.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_uu.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_uuid.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_venv.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_wait3.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_wait4.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_warnings: Invalid argument
rm: /usr/local/lib/python3.9/test/test_wave.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_weakref.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_xmlrpc_net.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_xxtestfuzz.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_yield_from.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_zipapp.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_zoneinfo/__pycache__: Invalid argument
rm: /usr/local/lib/python3.9/test/test_zoneinfo/_support.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_zoneinfo/data: Invalid argument
rm: /usr/local/lib/python3.9/test/test_zoneinfo/test_zoneinfo.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_zoneinfo: Directory not empty
rm: /usr/local/lib/python3.9/test/testcodec.py: Invalid argument
rm: /usr/local/lib/python3.9/test/testtar.tar: Invalid argument
rm: /usr/local/lib/python3.9/test/tf_inherit_check.py: Invalid argument
rm: /usr/local/lib/python3.9/test/time_hashlib.py: Invalid argument
rm: /usr/local/lib/python3.9/test/tokenize_tests-latin1-coding-cookie-and-utf8-bom-sig.txt: Invalid argument
rm: /usr/local/lib/python3.9/test/tokenize_tests-no-coding-cookie-and-utf8-bom-sig-only.txt: Invalid argument
rm: /usr/local/lib/python3.9/test/tracedmodules/__init__.py: Invalid argument
rm: /usr/local/lib/python3.9/test/tracedmodules/__pycache__: Invalid argument
rm: /usr/local/lib/python3.9/test/tracedmodules: Directory not empty
rm: /usr/local/lib/python3.9/test: Directory not empty
rm: /usr/local/lib/python3.9: Directory not empty

Code:
doas dmesg -c


Code:
/: inode 1289600: check-hash failed
/: inode 1289601: check-hash failed
/: inode 1289601: check-hash failed
/: inode 1289602: check-hash failed
/: inode 1289602: check-hash failed
/: inode 1289603: check-hash failed
/: inode 1289603: check-hash failed
/: inode 1289613: check-hash failed
/: inode 1289613: check-hash failed
/: inode 1289604: check-hash failed
/: inode 1289604: check-hash failed
/: inode 1289605: check-hash failed
/: inode 1289605: check-hash failed
/: inode 1289606: check-hash failed
/: inode 1289606: check-hash failed
/: inode 1289607: check-hash failed
/: inode 1289607: check-hash failed
/: inode 1289608: check-hash failed
/: inode 1289608: check-hash failed
/: inode 1289609: check-hash failed
/: inode 1289609: check-hash failed
/: inode 1289610: check-hash failed
/: inode 1289610: check-hash failed
/: inode 1289611: check-hash failed
/: inode 1289611: check-hash failed
/: inode 1289612: check-hash failed
/: inode 1289612: check-hash failed
/: inode 1289614: check-hash failed
/: inode 1289614: check-hash failed
/: inode 1289615: check-hash failed
/: inode 1289615: check-hash failed
/: inode 1289616: check-hash failed
/: inode 1289616: check-hash failed
/: inode 1289617: check-hash failed
/: inode 1289617: check-hash failed
/: inode 1289618: check-hash failed
/: inode 1289618: check-hash failed
/: inode 1289619: check-hash failed
/: inode 1289619: check-hash failed
/: inode 1289620: check-hash failed
/: inode 1289620: check-hash failed
/: inode 1289621: check-hash failed
/: inode 1289621: check-hash failed
/: inode 1289622: check-hash failed
/: inode 1289622: check-hash failed
/: inode 1289623: check-hash failed
/: inode 1289623: check-hash failed
/: inode 1289624: check-hash failed
/: inode 1289624: check-hash failed
/: inode 1289625: check-hash failed
/: inode 1289625: check-hash failed
/: inode 1289626: check-hash failed
/: inode 1289626: check-hash failed
/: inode 1289627: check-hash failed
/: inode 1289627: check-hash failed
/: inode 1289628: check-hash failed
/: inode 1289628: check-hash failed
/: inode 1289629: check-hash failed
/: inode 1289629: check-hash failed
/: inode 1289630: check-hash failed
/: inode 1289630: check-hash failed
/: inode 1289631: check-hash failed
/: inode 1289631: check-hash failed
/: inode 1289632: check-hash failed
/: inode 1289632: check-hash failed
/: inode 1289633: check-hash failed
/: inode 1289633: check-hash failed
/: inode 1289634: check-hash failed
/: inode 1289634: check-hash failed
/: inode 1289635: check-hash failed
/: inode 1289635: check-hash failed
/: inode 1289636: check-hash failed
/: inode 1289636: check-hash failed
/: inode 1289637: check-hash failed
/: inode 1289637: check-hash failed
/: inode 1289638: check-hash failed
/: inode 1289638: check-hash failed
/: inode 1289639: check-hash failed
/: inode 1289639: check-hash failed
/: inode 1289640: check-hash failed
/: inode 1289640: check-hash failed
/: inode 1289641: check-hash failed
/: inode 1289641: check-hash failed
/: inode 1289642: check-hash failed
/: inode 1289642: check-hash failed
/: inode 1289662: check-hash failed
/: inode 1289662: check-hash failed
/: inode 1289663: check-hash failed
/: inode 1289663: check-hash failed
/: inode 1289676: check-hash failed
/: inode 1289676: check-hash failed
/: inode 1289677: check-hash failed
/: inode 1289677: check-hash failed
/: inode 1289678: check-hash failed
/: inode 1289678: check-hash failed
/: inode 1289679: check-hash failed
/: inode 1289679: check-hash failed
/: inode 1289710: check-hash failed
/: inode 1289710: check-hash failed
/: inode 1289711: check-hash failed
/: inode 1289711: check-hash failed
/: inode 1289712: check-hash failed
/: inode 1289712: check-hash failed
/: inode 1289713: check-hash failed
/: inode 1289713: check-hash failed
/: inode 1289714: check-hash failed
/: inode 1289714: check-hash failed
/: inode 1289715: check-hash failed
/: inode 1289715: check-hash failed
/: inode 1289688: check-hash failed
/: inode 1289688: check-hash failed
/: inode 1289701: check-hash failed
/: inode 1289701: check-hash failed
/: inode 1289702: check-hash failed
/: inode 1289702: check-hash failed
/: inode 1289709: check-hash failed
/: inode 1289709: check-hash failed
/: inode 1289720: check-hash failed
/: inode 1289720: check-hash failed
/: inode 1289721: check-hash failed
/: inode 1289721: check-hash failed
 
Is there any way I can delete the old directories related to python so that I can install python3.9 again?
 
Make a backup.
Boot in single user with mounted root as read-only.
And perform
Code:
fsck -v -f -y /
mount -o rw /
rm -vfR /TODELETE_DIRECTORY
Make a backup.
Check the SDD/Hard-drive on hardware faults.
 
This is an SD card, as mentioned, not an SSD or hard drive. But yeah the procedure is the same anyways I suppose.

However the thing is that I am not currently physically in the location of the Raspberry Pi. So I am not able to boot into single user mode.

Is there some other way I could use in order to be able to delete these files and directories?
 
you can edit /etc/rc and add /sbin/fsck -fy / at the top (after #!/bin/sh) then reboot
after it does its job remove it
i used to tunefs like this on boxes with no console access
 
covacat thank you I tried your advice. Unfortunately it did not work for me.

I followed your suggestion and modified my /etc/rc file adding /sbin/fsck -fy / at the top after #!/bin/sh

After making that edit to my /etc/rc file I rebooted

After having edited that file and rebooted I ran

Code:
doas rm -rf /usr/local/lib/python3.9

I still get the same like before

Code:
rm: /usr/local/lib/python3.9/test/test_tk.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_tokenize.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_trace.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_traceback.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_ucn.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_tracemalloc.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_ttk_guionly.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_ttk_textonly.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_tuple.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_turtle.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_type_comments.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_typechecks.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_types.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_typing.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unary.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unicode.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unicode_file.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unicode_file_functions.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unicode_identifiers.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unicodedata.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unittest.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_univnewlines.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unpack.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unpack_ex.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_unparse.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_urllib.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_urllib2.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_urllib2_localnet.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_urllib2net.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_urllib_response.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_urllibnet.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_urlparse.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_userdict.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_userlist.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_userstring.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_utf8_mode.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_utf8source.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_uu.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_uuid.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_venv.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_wait3.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_wait4.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_warnings: Invalid argument
rm: /usr/local/lib/python3.9/test/test_wave.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_weakref.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_xmlrpc_net.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_xxtestfuzz.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_yield_from.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_zipapp.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_zoneinfo/__pycache__: Invalid argument
rm: /usr/local/lib/python3.9/test/test_zoneinfo/_support.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_zoneinfo/data: Invalid argument
rm: /usr/local/lib/python3.9/test/test_zoneinfo/test_zoneinfo.py: Invalid argument
rm: /usr/local/lib/python3.9/test/test_zoneinfo: Directory not empty
rm: /usr/local/lib/python3.9/test/testcodec.py: Invalid argument
rm: /usr/local/lib/python3.9/test/testtar.tar: Invalid argument
rm: /usr/local/lib/python3.9/test/tf_inherit_check.py: Invalid argument
rm: /usr/local/lib/python3.9/test/time_hashlib.py: Invalid argument
rm: /usr/local/lib/python3.9/test/tokenize_tests-latin1-coding-cookie-and-utf8-bom-sig.txt: Invalid argument
rm: /usr/local/lib/python3.9/test/tokenize_tests-no-coding-cookie-and-utf8-bom-sig-only.txt: Invalid argument
rm: /usr/local/lib/python3.9/test/tracedmodules/__init__.py: Invalid argument
rm: /usr/local/lib/python3.9/test/tracedmodules/__pycache__: Invalid argument
rm: /usr/local/lib/python3.9/test/tracedmodules: Directory not empty
rm: /usr/local/lib/python3.9/test: Directory not empty
rm: /usr/local/lib/python3.9: Directory not empty

and the dmesg output shows corruption still

Code:
doas dmesg -c

Code:
/: inode 1289600: check-hash failed
/: inode 1289601: check-hash failed
/: inode 1289601: check-hash failed
/: inode 1289602: check-hash failed
/: inode 1289602: check-hash failed
/: inode 1289603: check-hash failed
[...]
/: inode 1289709: check-hash failed
/: inode 1289709: check-hash failed
/: inode 1289720: check-hash failed
/: inode 1289720: check-hash failed
/: inode 1289721: check-hash failed
/: inode 1289721: check-hash failed
 
you can edit /etc/rc and add /sbin/fsck -fy / at the top (after #!/bin/sh) then reboot
Code:
fsck_flags="-p"         # May be changed to -f (or -f -y) to force a full fsck
fsck_y_enable="NO"      # Set to YES to do fsck -y if the initial preen fails.
fsck_y_flags="-T ffs:-R -T ufs:-R"      # Additional flags for fsck -y
background_fsck="YES"   # Attempt to run fsck in the background where possible.
background_fsck_delay="60" # Time to wait (seconds) before starting the fsck.

In /etc/rc.conf set background_fsck to NO and set fsck_y_enable to YES.
 
Back
Top