'List directory /var/lib/apt/lists/partial is missing. - Acquire (20: Not a directory)
When I executed sudo apt update
I'm getting
Reading package lists... Done
E: List directory /var/lib/apt/lists/partial is missing. - Acquire (20: Not a directory)
Also, I was getting a status error which I solved using
sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status
I tried sudo mkdir /var/lib/apt/lists/partial
as suggested in few other threads
mkdir: cannot create directory ‘/var/lib/apt/lists/partial’: Not a directory
Even I tried sudo mkdir /var/lib/apt/lists/
Any other solution?
Solution 1:[1]
The answer may be inappropriate here. But as I came here others may land here too.
If you're using docker and you face the same issue you can do like the following.
USER root
# RUN commands
USER 1001
Reference: Link
Solution 2:[2]
The same happened to me. I follow as guide this answer:The package lists or status file could not be parsed or opened
I assumed my lists were corrupted. I went to /var/lib/apt/
I saw a file (lists@) instead of a directory. I deleted it (sudo rm lists
) and re-created the path (sudo mkdir -p /var/lib/apt/lists/partial
). Double-check the path gets created.
Solution 3:[3]
I ran into the same issue while trying to build a new container and experimenting with Dockerfile
for a while.
What saved me finally was just to delete all containers I've created during this process using docker rm
.
Solution 4:[4]
You can try adding -u 0
in the command
sudo docker exec -u 0 -it ContainerID bin/bash
According to Docker, the u flag allow developer to specify the user you are going to use in the container. Reference here
Solution 5:[5]
I had this same issue when trying to install an Typora on Ubuntu 20.04.
I was running into the error whenever I run the command below:
# add Typora's repository
sudo add-apt-repository 'deb https://typora.io/linux ./'
Here's how I solved it:
I disconnected and reconnected my network connection, and when I ran the command again, it worked fine.
I think it was an issue with my network connectivity.
That's all.
I hope this helps
Solution 6:[6]
I had a similar error when using bitnami spark image and docker exec command with arguments -u didn't work for me. I found my answer in the image documentation here.
In case you are using a docker image, it might be that the image is a non root container image. Read the documents of the docker image provider to find the solution to see how you can use the image as a root container image.
Solution 7:[7]
You first need to have super user privilege by typing in sudo -i
and then inserting your password.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | ssi-anik |
Solution 2 | |
Solution 3 | |
Solution 4 | Vardy |
Solution 5 | Promise Preston |
Solution 6 | Gru97 |
Solution 7 | PiRocks |