Score:0

IsADIrectoryError while trying to run apt update

ph flag

I don't know what's wrong with my packages or ppas but every time I try to run sudo apt update in my zsh terminal, it logs this error:

Fetched 222 kB in 1s (155 kB/s)                  
Traceback (most recent call last):
  File "/usr/lib/cnf-update-db", line 26, in <module>
    col.create(db)
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 108, in create
    os.rename(tmpdb, dbname)
IsADirectoryError: [Errno 21] Is a directory: '/var/lib/command-not-found/commands.db.tmp' -> '/var/lib/command-not-found/commands.db'
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code

I just know it's a python error but I don't know what it means. Os is kubuntu 20.04, and python3 version is 3.9.9

guiverc avatar
cn flag
We don't know your OS & release details; but I'd use that knowledge & check the results of `python3 --version` are correct for your *unstated* release; as python3 errors are commonly the result of incorrect python3 version changes.
Aprime avatar
ph flag
Os is kubuntu 20.04, and python3 version is 3.9.9.
guiverc avatar
cn flag
and there is your issue; you've changed your default python3 to a result that doesn't belong in 20.04; reverse your python3 changes & do it properly.
Aprime avatar
ph flag
Dude I need 3.9.9 python:) What's the proper issue? Can you suggest a link or something?
guiverc avatar
cn flag
Many Ubuntu tools are designed to work with the `python3` the machine comes with; so you'll have to leave the default python3 be what the machine comes with (`python3` defaults to 3.9.9 for my newer release) and use a second/newer python3 for your scripts that rely on it; OR don't use Ubuntu tools that rely on python3 being the default (eg. live with `apt` & like tools that are designed/tested to work only with the default python3). As I said do it properly (and don't change the default!) Your question/problem here is because you changed the python3 version incorrectly.
guiverc avatar
cn flag
Does this answer your question? [Ubuntu 16.04 Completely broken python3 + dpkg + apt-get!](https://askubuntu.com/questions/1092919/ubuntu-16-04-completely-broken-python3-dpkg-apt-get)
karel avatar
sa flag
Does this answer your question? [Problem with sudo apt update in Ubuntu 18.04: Post-Invoke-Success if /usr/bin/test -w /var/lib/command-not-found/](https://askubuntu.com/questions/1041226/problem-with-sudo-apt-update-in-ubuntu-18-04-post-invoke-success-if-usr-bin-te)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.