Solving python3.10-minimal error on Ubuntu 22.04
1 min read

Solving python3.10-minimal error on Ubuntu 22.04

Hey, short post to share with you about a problem I faced recently, and that took me some time to fix. It's not super difficult or anything but I feel it could help someone. Essentially what happened is that we had a major update to the docker image of the software I work on which caused, among other things, for my docker install to become corrupted.

Out of nowhere,

docker compose up container_name

wouldn't work and

docker compose build image_name

would throw me the following error:

[Errno 13] Permission denied: '/usr/lib/python3.10/__pycache__/__future__.cpython-310.pyc.139642951244288'dpkg: error processing package python3.10-minimal (--configure):
#0 34.05  installed python3.10-minimal package post-installation script subprocess returned error exit status 1
#0 34.07 Errors were encountered while processing:
#0 34.07  python3.10-minimal
#0 34.10 E: Sub-process /usr/bin/dpkg returned an error code (1)

That error seemed unrelated to the major change that happened in the image, which was an upgrade to the language version we use (from Ruby 2 to Ruby 3).
I tried different approaches, from trying to correct the installation of that package in the host machine to trying to get access to the bash console of the docker container. That didn't happen, since to have access to the console that container needed to be working, which was precisely the problem.

What I found out to work was that the whole installation of Docker on my machine (an intel-based Linux machine) was somewhat wrong. I found out that installing docker through

sudo snap install docker

is not recommended since it's not officially endorsed by Docker, rather being maintained by a third party.

So I uninstalled snap docker doing the following:

sudo snap remove docker --purge

the purge option here is important, otherwise, it'll take forever for docker to be removed. Once that's done, I proceeded to install docker through the official guide, available here. I know - not a super exciting bug discovery or anything, but it did work.

Once that was done,

docker version

showed the version had been updated from 20.0.4 to 24.0.4. That enabled the image to be properly built again, without the need to go crazy hunt whatever on earth was causing that python issue.

That's it for today folks, hope you enjoyed!