E: Sub-process /usr/bin/dpkg returned an error code (1) 报错 输入apt-get update 报错解决办法

**

E: Sub-process /usr/bin/dpkg returned an error code (1) 报错 输入apt-get update 报错解决办法

Setting up redis-server (5:4.0.9-1ubuntu0.1) 
    Job for redis-server.service failed because a timeout was exceeded.######################...........] 
    See "systemctl status redis-server.service" and "journalctl -xe" for details.
    invoke-rc.d: initscript redis-server, action "start" failed.
    ● redis-server.service - Advanced key-value store
       Loaded: loaded (/lib/systemd/system/redis-server.service; disabled; vendor preset: enabled)
       Active: activating (auto-restart) (Result: timeout) since Thu 2019-06-27 11:06:22 CST; 10ms ago
         Docs: http://redis.io/documentation,
               man:redis-server(1)
      Process: 2535 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)
    
    Jun 27 11:06:22 iZwz9g088ikis8yemv5o7jZ systemd[1]: Failed to start Advanced key-value store.
    dpkg: error processing package redis-server (--configure):
     installed redis-server package post-installation script subprocess returned error exit status 1
    Processing triggers for systemd (237-3ubuntu10.23) ...
    Processing triggers for ureadahead (0.100.0-21) ...
    Errors were encountered while processing:
     redis-server
    E: Sub-process /usr/bin/dpkg returned an error code (1)

报错原因:usr目录下文件出错,重新配置即可
依次输入以下命令可以解决问题:

$ sudo mv /var/lib/dpkg/info/ /var/lib/dpkg/info_old/
$ sudo mkdir /var/lib/dpkg/info/
$ sudo apt-get update    
$ sudo apt-get -f install
$ sudo mv /var/lib/dpkg/info/* /var/lib/dpkg/info_old/
$ sudo rm -rf /var/lib/dpkg/info
$ sudo mv /var/lib/dpkg/info_old/ /var/lib/dpkg/info/

输入上述命令之后,在执行 sudo apt-get update 和 sudo apt-get upgrade 就不会有问题了 重新下载需要的包都没问题了

你可能感兴趣的:(python)