Could not get lock /var/lib/apt/lists/lock
code:log
E: Could not get lock /var/lib/apt/lists/lock. It is held by process <process id> (apt-get)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to lock directory /var/lib/apt/lists/
aptは、多重起動をさせないつくりになっている
このエラーが出るときは、他のaptが動いている
まずはなんのプロセスか見てみる
$ ps aux | grep <process id>
自動アップデートの場合はしばらく待てば終わる
https://ysuzuki19.github.io/post/ubuntu-apt-could-not-get-lock
aptコマンドが異常終了するなどして、/var/lib/apt/lists/lock が残っていて上記のエラーが出る場合は
/var/lib/apt/lists/lock(そういうファイルがある)を消す(root権限が必要)
$ sudo rm -i /var/lib/apt/lists/lock
apt
ubuntu.icon
Debian.icon