之前我以 root 用户身份运行了 apt update 和 upgrade,从那时起这个问题就一直存在
Running with gitlab-runner 12.3.0 (a8a019e0)
on test runner XXXXXXXX
Using Shell executor...
Running on IP-XX-XXX-XXX-XXX…
Fetching changes with git depth set to 50...
Initialized empty Git repository in /home/gitlab-runner/builds/XXXXXXXX/0/XXXXXXXX/XXXX-XXXX/.git/
Created fresh repository.
From http://XX-XXX-XXX-XXX/XXX/XXXX
* [new branch] master -> origin/master
Checking out 2dca3aec as master...
Skipping Git submodules setup
Checking the cache for default...
Runtime platform
arch=amd64 os=linux pid=6537 revision=a8a019e0 version=12.3.0
No URL provided, the cache will not be downloaded from the shared cache server. Instead, a local version of the cache will be extracted.
Successfully extracted cache
$ apt-get update -yqq
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
ERROR: Job failed: exit status 1
答案1
使用 sudo 运行 apt-get 命令:
sudo apt-get update
如果错误仍然存在,请执行以下操作:
sudo rm -rf /var/lib/apt/lists/lock
然后按照上面所述使用 sudo 运行 apt-get 命令。