Can't able to install Git

okayy

yes this i noticed ,this was my fault

but

how to clean this ? directly have to delete files ?


this??

i didn't get this , what do you mean by net drop?
sorry for lack of knowledge in me , but i really don't know about this

1 Like

The command

sudo apt clean

Should do it. You can also perform sudo apt autoremove to get rid of orphaned packages.

If you are using a Proxy or experiencing Internet Outages. An internet outage can be very fast, with the net dropping out only for a second or so. But that second is enough to cause "packet Loss."

1 Like

If it is still something to do with front end lock, have a look through what I have found by internet research. My favourite method is 4, but I guess the others can be valid:

  1. Try running sudo rm /var/lib/dpkg/lock && sudo rm /var/lib/apt/lists/lock , which will free up the particular files that apt is taking a look at when you’re running it. Make sure to be careful about the names of those files, since running rm as root is destructive.

  2. Coming back to the GUI-based applications we were talking about, another useful and time-saving option is to use the fuser command.

With “fuser” you only need to know the file being accessed (“/var/lib/dpkg/lock” in our case), and you can kill the process accessing that file even if you don’t know which process it is. For example:

sudo fuser -cuk /var/lib/dpkg/lock

Keep in mind that the fuser command will not release the lock acquired by the process you just killed, so you’ll have to do this manually:

sudo rm -f **/var/lib/dpkg/**lock

Note : to “release the lock ” simply means deleting the “lock” file so that other processes can “acquire the lock ” by recreating it.

You may also need to run the following two commands:

sudo fuser -cuk **/var/cache/apt/archives/**lock; sudo rm -f **/var/cache/apt/archives/**lock

  1. In this case, the root cause is the lock file. As mentioned earlier, the lock files are used to prevent two or more processes from using the same data. When apt or apt-get commands are run, they create lock files in a few places. If the previous apt command was not terminated properly, the lock files are not deleted and hence they prevent any new instances of apt-get or apt commands.

To fix the problem, all you need to do is to remove the lock files. But before you do that, it would be a good idea to stop any process that is using the lock files.

Use the lsof command to get the process ID of the process holding the lock files. Check the error and see what lock files it is complaining about and get the id of the processes holding these lock files. Run these commands one by one:

sudo lsof /var/lib/dpkg/lock
sudo lsof /var/lib/apt/lists/lock
sudo lsof /var/cache/apt/archives/lock

It’s possible that the commands don’t return anything, or return just one number. If they do return at least one number, use the number(s) and kill the processes like this (replace the <process_id> with the numbers you got from the above commands):

sudo kill -9 <process_id>

You can now safely remove the lock files using the commands below:

sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock

After that, reconfigure the packages:

sudo dpkg --configure -a

Now if you run the sudo apt update command, everything should be fine.

  1. First, find out the id of the process that is holding the lock file:

lsof /var/lib/dpkg/lock-frontend

The above command will give you the PID of the processes using the lock files. Use this PID to kill the process:

sudo kill -9 PID

Now you can remove the lock and reconfigure dpkg:

sudo rm /var/lib/dpkg/lock-frontend sudo dpkg --configure -a

  1. If you find the “dpkg: error: dpkg frontend lock is locked by another process” error while running the procedure described above, you need to do an extra step. First, find the ID of the process that contains the lock file. You can do so using below command:

itsmarttricks@ubuntu:~$ lsof /var/lib/dpkg/lock

Then make sure the process is not running:

itsmarttricks@ubuntu:~$ ps cax | grep PID PID TTY STAT TIME COMMAND

The above command will give you the process PID using lock files. Use this PID to kill the process:

itsmarttricks@ubuntu:~$ kill PID bash: kill: PID: arguments must be process or job IDs itsmarttricks@ubuntu:~$ kill -9 PID bash: kill: PID: arguments must be process or job IDs

To get an errant key:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys

sudo apt-get install

To Update, Upgrade and create a new Grub:

sudo apt-get -f install -y && sudo apt dist-upgrade -y && sudo update-initramfs -u -k all && reboot

2 Likes