1

OS : Linux kaushal 5.8.0-36-generic #40~20.04.1-Ubuntu SMP Wed Jan 6 10:15:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Every Day when my pc boots up and write the first command apt update I got the following error.

After some time it auto resolved. This is normal?

kaushal@kaushal:~$ sudo apt update
[sudo] password for kaushal: 
Reading package lists... Done
E: Could not get lock /var/lib/apt/lists/lock. It is held by process 2346 (packagekitd)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to lock directory /var/lib/apt/lists/
kaushal@kaushal:~$ sudo apt update
Reading package lists... Done
E: Could not get lock /var/lib/apt/lists/lock. It is held by process 2346 (packagekitd)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to lock directory /var/lib/apt/lists/
kaushal@kaushal:~$ sudo apt update
Hit:1 http://in.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://dl.google.com/linux/chrome/deb stable InRelease                        
Hit:3 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease                   
Hit:4 http://ppa.launchpad.net/git-core/ppa/ubuntu focal InRelease                  
Hit:5 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease                 
Hit:6 http://security.ubuntu.com/ubuntu focal-security InRelease                    
Get:7 https://mega.nz/linux/MEGAsync/xUbuntu_20.04 ./ InRelease [2,441 B]
Fetched 2,441 B in 2s (1,115 B/s)         
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
kaushal@kaushal:~$ 
2
  • You run update every day? – David Jan 9 at 8:49
  • 1
    This is not a dupe. – Pilot6 Jan 9 at 21:45
1

Ubuntu checks for updates on every boot automatically. You can't run the same command manually at the same time.

If you really want to do it manually, disable automatic updates.

The setting is in the Software & Updates application.

3
  • My auto-update is on, I noticed today. Thank you so much. I also turned it off because I really want to do it manually. – Kaushal Bhatol Jan 9 at 15:14
  • It is really annoying when you want to install something by uisng apt and have to wait. I disable it too. It used to be off before in previous releases. – Pilot6 Jan 9 at 15:15
  • As soon as you get another 2 rep, you'll be able to upvote the other answer. I upvoted it already. – Pilot6 Jan 9 at 15:22
1

I also faced the same problem. When it happens try the below command to find out if background updates are happening.

ps aux | grep apt

I found that there was a background update happening in my case(Ubuntu 16.04, 18.04 and 20.04). It is part of unattended-upgrades. I followed the below steps to disable it-

  1. Searched for Update in application list
  2. Opened it. There is an option for Settings
  3. In one of the tabs, I found the option to set the frequency of updates and the contents of automatic updates. I update weekly on my own. So I set it to Never check for updates. It is only recommended if you are managing your updates regularly on your own.
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.