Ubuntu 20.04 apt-get update fails - cannot get apt lists lock
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- aws, docker, shell, ubuntu
- Domain
- cloud, devops, operating-systems
Research direction
Start with the get.docker.com installation script and locate the apt-get commands involved in the reported update failure. Check the proposed apt-version handling, then verify that installation succeeds when another apt process holds the lock and that existing supported environments are unaffected.
Written by the indexing model from the issue text.
Description
Installing docker on AWS EC2 on an Ubuntu 20.04.6 AMI using https://get.docker.com/ is failling for me with the below error:
+ sudo -E sh -c apt-get-update -qq >/dev/null
E; Could not get lock /var/lib/apt/lists/lock. It is held by process 2023 (apt-get)
E: Unable to lock directory /var/lib/apt/lists/
Could -o DPkg::Lock::Timeout=120 be added to any apt-get commands?
This can be used for apt version checking and adding the arg if apt version > 1.9:
APT_VERSION="$(apt --version | tr ' ' '\n' | grep -E '[0-9]+\.[0-9]+\.[0-9]+')"
APT_ARGS=""
if [ "$(echo $APT_VERSION | cut -d '.' -f 1)" -gt 1 ]; then
# apt version 2.0 or newer
APT_ARGS="-o DPkg::Lock::Timeout=120"
elif [ "$(echo $APT_VERSION | cut -d '.' -f 2)" -gt 9 ]; then
# apt version 1.10 or newer
APT_ARGS="-o DPkg::Lock::Timeout=120"
fi
echo "APT_ARGS: '$APT_ARGS'"
echo apt-get $APT_ARGS update -q
apt-get $APT_ARGS update -q
- Dominant language
- Shell
- Stars
- 3.2k
- Forks
- 863
- Avg merge
- 3h 15m
- Merged PRs (30d)
- 2
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from docker/docker-install
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
docker/docker-install#575 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
docker/docker-install#559 · 4 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
docker/docker-install#554 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
docker/docker-install#548 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
docker/docker-install#540 ·
All issues in docker/docker-install
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug easy help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
lacs-project/sysknife#503 ·
-
help wanted kind/documentation
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
liquidmetal-dev/flintlock#1239 ·