代码之家  ›  专栏  ›  技术社区  ›  Nikeodeam

为什么sudo apt升级不能在Ubuntu上运行?

  •  0
  • Nikeodeam  · 技术社区  · 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)
    
    

    我试着在网上搜索解决方案,但什么也找不到。

    2 回复  |  直到 2 年前
        1
  •  0
  •   Esha Varma    2 年前

    可能的原因是

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

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

    sudo apt upgrade
    

    sudo rm /var/cache/debconf/config.dat
    sudo apt upgrade
    
        2
  •  0
  •   Borislav Gizdov    2 年前

    无法完成升级,因为 /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 .