Cant`t upgrade kali linux

What have you tried: i tried sudo kill -9 60159

What is the error: Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 60159 (apt-get)

What device is this on: Laptop

i cant kill the processes, i dont know why, via Task Manager i can`t see any of the process but if i check with

ps aux | grep -i apt

i get this...

root       60156  0.0  0.1  20900  5524 ?        S    17:56   0:00 sudo apt-get autoremove -y
root       60158  0.0  0.0  20900  1524 pts/6    Ss   17:56   0:00 sudo apt-get autoremove -y
root       60159  0.0  0.1  85920  4920 pts/6    T+   17:56   0:02 apt-get autoremove -y
root       60996  0.0  0.1  20900  5424 ?        S    17:57   0:00 sudo apt autoremove
root       60998  0.0  0.0  20900  1268 pts/8    Ss   17:57   0:00 sudo apt autoremove
root       60999  0.0  0.1  21908  4496 pts/8    T+   17:57   0:00 apt autoremove
root       61504  0.0  0.1  20364  5356 ?        S    17:58   0:00 sudo apt autoremove
root       61540  0.0  0.0  20364  1428 pts/9    Ss   17:58   0:00 sudo apt autoremove
root       61541  0.0  0.1  21908  4556 pts/9    T+   17:58   0:00 apt autoremove
root       67862  0.0  0.1  20364  5388 ?        S    18:10   0:00 sudo apt full-upgrade -y
root       67864  0.0  0.0  20364  1612 pts/10   Ss   18:10   0:00 sudo apt full-upgrade -y
root       67865  0.0  0.1  21908  4544 pts/10   T+   18:10   0:00 apt full-upgrade -y
root       70495  0.0  0.1  20364  5268 pts/1    T    18:35   0:00 sudo apt full-upgrade -y
root       70497  0.0  0.0  20364  1332 pts/4    Ss   18:35   0:00 sudo apt full-upgrade -y
root       70498  0.0  0.1  21908  4668 pts/4    T+   18:35   0:00 apt full-upgrade -y
root       70573  0.0  0.1  20364  5404 pts/1    T    18:35   0:00 sudo apt full-upgrade -y
root       70575  0.0  0.0  20364  1316 pts/11   Ss   18:35   0:00 sudo apt full-upgrade -y
root       70576  0.0  0.1  21908  4516 pts/11   T+   18:35   0:00 apt full-upgrade -y
root       72404  0.0  0.1  20364  5524 pts/1    T    18:38   0:00 sudo apt autoremove
root       72406  0.0  0.0  20364  1452 pts/12   Ss   18:38   0:00 sudo apt autoremove
root       72407  0.0  0.1  21908  4564 pts/12   T+   18:38   0:00 apt autoremove
root       79792  0.0  0.1  20364  5308 pts/1    T    18:50   0:00 sudo apt install apache2 dx aapt apktool -y
root       79802  0.0  0.0  20364  1528 pts/13   Ss   18:50   0:00 sudo apt install apache2 dx aapt apktool -y
root       79803  0.0  0.1  21908  4352 pts/13   T+   18:50   0:00 apt install apache2 dx aapt apktool -y
root       82967  0.0  0.1  20364  5404 pts/1    T    18:57   0:00 sudo apt full-upgrade -y
root       82969  0.0  0.0  20364  1456 pts/14   Ss   18:57   0:00 sudo apt full-upgrade -y
root       82970  0.0  0.1  21908  4596 pts/14   T+   18:57   0:00 apt full-upgrade -y
root       83092  0.0  0.1  20364  5476 pts/1    T    18:57   0:00 sudo apt full-upgrade -y
root       83094  0.0  0.0  20364  1312 pts/15   Ss   18:57   0:00 sudo apt full-upgrade -y
root       83095  0.0  0.1  21908  4404 pts/15   T+   18:57   0:00 apt full-upgrade -y
root       84544  0.0  0.1  20364  5516 pts/1    T    18:59   0:00 sudo apt upgrade
root       84549  0.0  0.0  20364  1436 pts/16   Ss   18:59   0:00 sudo apt upgrade
root       84550  0.0  0.1  21908  4628 pts/16   T+   18:59   0:00 apt upgrade
root      124615  0.0  0.1  20364  7480 pts/1    T    20:14   0:00 sudo apt install hardinfo
root      124617  0.0  0.0  20364  2612 pts/17   Ss   20:14   0:00 sudo apt install hardinfo
root      124618  0.0  0.2  21908  8504 pts/17   T+   20:14   0:00 apt install hardinfo
kalipso   131158  0.0  0.0   6920  1964 pts/1    S+   20:26   0:00 grep --color=auto -i apt

nothing works anymore i tried also a reboot but still happen.

Thank in Forwoard and i hope anyone can help me.

Interesting…

The earliest commands are “sudo apt autoremove”. I wonder if you have an autoremove action in a shell somewhere which is waiting for you to confirm y/n?

If you run:

ps aux | grep zsh

What does it return, and what happens if you kill each PID of the zsh instances it returns?

┌──(kalipso㉿Kali)-[~]
└─$ ps aux | grep zsh
kalipso 70158 0.0 0.1 10960 5552 pts/1 Ss 18:35 0:05 /usr/bin/zsh
kalipso 140525 0.0 0.0 7052 2064 pts/1 S+ 20:44 0:00 grep --color=auto zsh

ok, so

sudo kill -9 140525
sudo kill -9 70158

┌──(kalipso㉿Kali)-[~]
└─$ sudo kill -9 140525
[sudo] password for kalipso:
kill: (140525): No such process

do the ps aux | grep apt

again

it is still the same

root 60156 0.0 0.1 20900 5524 ? S 17:56 0:00 sudo apt-get autoremove -y
root 60158 0.0 0.0 20900 1524 pts/6 Ss 17:56 0:00 sudo apt-get autoremove -y
root 60159 0.0 0.1 85920 4920 pts/6 T+ 17:56 0:02 apt-get autoremove -y
root 60996 0.0 0.1 20900 5424 ? S 17:57 0:00 sudo apt autoremove
root 60998 0.0 0.0 20900 1268 pts/8 Ss 17:57 0:00 sudo apt autoremove
root 60999 0.0 0.1 21908 4496 pts/8 T+ 17:57 0:00 apt autoremove
root 61504 0.0 0.1 20364 5356 ? S 17:58 0:00 sudo apt autoremove
root 61540 0.0 0.0 20364 1428 pts/9 Ss 17:58 0:00 sudo apt autoremove
root 61541 0.0 0.1 21908 4556 pts/9 T+ 17:58 0:00 apt autoremove
root 67862 0.0 0.1 20364 5388 ? S 18:10 0:00 sudo apt full-upgrade -y
root 67864 0.0 0.0 20364 1612 pts/10 Ss 18:10 0:00 sudo apt full-upgrade -y
root 67865 0.0 0.1 21908 4544 pts/10 T+ 18:10 0:00 apt full-upgrade -y
root 70495 0.0 0.1 20364 5268 pts/1 T 18:35 0:00 sudo apt full-upgrade -y
root 70497 0.0 0.0 20364 1332 pts/4 Ss 18:35 0:00 sudo apt full-upgrade -y
root 70498 0.0 0.1 21908 4668 pts/4 T+ 18:35 0:00 apt full-upgrade -y
root 70573 0.0 0.1 20364 5404 pts/1 T 18:35 0:00 sudo apt full-upgrade -y
root 70575 0.0 0.0 20364 1316 pts/11 Ss 18:35 0:00 sudo apt full-upgrade -y
root 70576 0.0 0.1 21908 4516 pts/11 T+ 18:35 0:00 apt full-upgrade -y
root 72404 0.0 0.1 20364 5524 pts/1 T 18:38 0:00 sudo apt autoremove
root 72406 0.0 0.0 20364 1452 pts/12 Ss 18:38 0:00 sudo apt autoremove
root 72407 0.0 0.1 21908 4564 pts/12 T+ 18:38 0:00 apt autoremove
root 79792 0.0 0.1 20364 5308 pts/1 T 18:50 0:00 sudo apt install apache2 dx aapt apktool -y
root 79802 0.0 0.0 20364 1528 pts/13 Ss 18:50 0:00 sudo apt install apache2 dx aapt apktool -y
root 79803 0.0 0.1 21908 4352 pts/13 T+ 18:50 0:00 apt install apache2 dx aapt apktool -y
root 82967 0.0 0.1 20364 5404 pts/1 T 18:57 0:00 sudo apt full-upgrade -y
root 82969 0.0 0.0 20364 1456 pts/14 Ss 18:57 0:00 sudo apt full-upgrade -y
root 82970 0.0 0.1 21908 4596 pts/14 T+ 18:57 0:00 apt full-upgrade -y
root 83092 0.0 0.1 20364 5476 pts/1 T 18:57 0:00 sudo apt full-upgrade -y
root 83094 0.0 0.0 20364 1312 pts/15 Ss 18:57 0:00 sudo apt full-upgrade -y
root 83095 0.0 0.1 21908 4404 pts/15 T+ 18:57 0:00 apt full-upgrade -y
root 84544 0.0 0.1 20364 5516 pts/1 T 18:59 0:00 sudo apt upgrade
root 84549 0.0 0.0 20364 1436 pts/16 Ss 18:59 0:00 sudo apt upgrade
root 84550 0.0 0.1 21908 4628 pts/16 T+ 18:59 0:00 apt upgrade
root 124615 0.0 0.1 20364 7480 pts/1 T 20:14 0:00 sudo apt install hardinfo
root 124617 0.0 0.0 20364 2612 pts/17 Ss 20:14 0:00 sudo apt install hardinfo
root 124618 0.0 0.2 21908 8504 pts/17 T+ 20:14 0:00 apt install hardinfo
kalipso 150074 0.0 0.0 7052 1992 pts/1 S+ 21:03 0:00 grep --color=auto apt

and do ps aux | grep zsh

1 Like

also in the first sudo kill he didn`t accept and in the second he stock in operation

OK, lets try killing the terminals.

run:

ps -ft pts/6 -t pts/8 -t pts/9

That will return the PIDs for those three terminals.

Try killing them.

ok i solved it xD with an reboot he didn`t killed so i need to put the battery out of my laptop to solve the problem, unbelievable… Thanks for help

No problem. In future, make sure one apt command has completed before running another one.

1 Like

yes i will thanks for ur time and have a nice weekend

1 Like