E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 7384 (unattended-upgr)N: B

一、apt-get 报错:

E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 7384 (unattended-upgr)

N: Be aware that removing the lock file is not a solution and may break your system.

E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

二、根因

        1.apt的端口被占用

 三、解决办法

        1.等待占用端口的进程执行完毕。----一般可行

        2.如果不行,采用下面的办法:
                A.查看apt服务端口,上面其实已经说了

   lsof /var/lib/dpkg/lock-frontend

                B.查看哪个服务占有了端口 

   lsof /var/lib/apt/lists/lock

                3.输出如下:

                        1.如果B命令为空,并且执行 apt-install xxxx 还是同样报错,则执行下面命令,判断为进程卡死。

                            

    kill -9 7384

                        2.如果B命令为有输出,则kill掉输出的pid进程号

    

你可能感兴趣的:(记录学习或工作中遇到的问题,linux,运维,服务器)