Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 623
stefun Avatar asked Jun 13 '19 11:06

stefun


4 Answers

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

like image 119
ssi-anik Avatar answered Dec 30 '22 16:12

ssi-anik


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.

like image 39
Jofe Avatar answered Dec 30 '22 17:12

Jofe


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

like image 30
Vardy Avatar answered Dec 30 '22 18:12

Vardy


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.

like image 42
Ngoral Avatar answered Dec 30 '22 16:12

Ngoral