为什么 sudo apt update 在 Ubuntu 上不起作用?

问题描述 投票:0回答:2

我正在尝试在我的服务器上安装升级,但收到此“错误”。

我对 Ubuntu 还很陌生,所以如果您需要任何信息来帮助我,请随时询问!

user@server~$ sudo apt upgrade

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
  libldns-dev libldns3 libjs-jquery-ui libavdevice58 libpostproc55 php-twig
  libavcodec58 libavutil56 libswscale5 libswresample3 libavformat58
  libpmix-dev libpmix2 libavfilter7
Learn more about Ubuntu Pro at https://ubuntu.com/pro
The following packages will be upgraded:
  postfix
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
1 standard LTS security update
Need to get 0 B/1,248 kB of archives.
After this operation, 1,024 B of additional disk space will be used.
Do you want to continue? [Y/n] y
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
(Reading database ... 174475 files and directories currently installed.)
Preparing to unpack .../postfix_3.6.4-1ubuntu1.3_amd64.deb ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing archive /var/cache/apt/archives/postfix_3.6.4-1ubuntu1.3_amd64.deb (--unpack):
 new postfix package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/postfix_3.6.4-1ubuntu1.3_amd64.deb
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试在网上寻找解决方案,但找不到任何东西。

ubuntu apt ubuntu-22.04 dpkg
2个回答
0
投票

无法完成升级,因为

/var/cache/debconf/config.dat
被另一个进程锁定。

您可以尝试以下方法:

  • 重新启动服务器,这可能会释放锁定。
  • 检查其他进程是否正在使用 apt 或 dpkg。
ps aux | grep -i apt
ps aux | grep -i dpkg

如果有,请运行 sudo Kill PID 来终止该进程。

  • 清除锁定文件(危险)。
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock*

运行 sudo

apt --fix-broken install

最后,尝试使用

sudo apt update && sudo apt upgrade
升级。


0
投票

可能的原因是

debconf:DbDriver“config”:/var/cache/debconf/config.dat 被另一个进程锁定:资源暂时不可用

由于此进程已锁定,您可以等待它被释放并再次尝试更新,或者手动删除包上的锁定并重试

sudo apt upgrade

sudo rm /var/cache/debconf/config.dat
sudo apt upgrade
© www.soinside.com 2019 - 2024. All rights reserved.