Ubuntu22.04 Waiting for cache lock: Could not get lockの解決方法

環境
OSバージョンを確認します

# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"

エラー現象

# sudo apt install -y postgresql
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 6583 (unattended-upgr)

方法1
# sudo rm /var/lib/apt/lists/lock
# sudo rm /var/lib/dpkg/lock
# sudo rm /var/lib/dpkg/lock-frontend

方法2

暫く待ちます

Ubuntu 22.04

Posted by arkgame