Linux Tips: Cannot update cache in update manager

Linux Tips: Cannot update cache in update manager

If you've encountered one or more "fail" error message (because files are  missing from your selected repositories) when you try to refresh your cache (when using the update manager/apt-get - under Ubuntu/Linux mint), do this:

# apt-get upgrade --fix-missing

/ *********
i) If after running the above command, you're getting the error messages that are similar to "could not get lock - open", do this:

// Search for apt process & kill it

# ps -A | grep apt

# kill -9  [processnumber]

//  Remove file lock from apt list

#  cd /var/lib/apt/lists/

#  rm -rf lock

//  Remove file lock from apt archives


#  cd /var/cache/apt/archives/
#  rm -rf lock

// Update packages sources list

# apt-get update

Refresh your update manager.

/ *********

ii) If after running the above command, you're getting the error message or similar:

//-  Errors were encountered while processing:
//-  /var/cache/apt/archives/xdg-desktop-portal_1.0.2-flatpak1~xenial_amd64.deb
//-  E: Sub-process /usr/bin/dpkg returned an error code (1)

#  dpkg -i --force-overwrite /var/cache/apt/archives/xdg-desktop-portal_1.0.2-flatpak1~xenial_amd64.deb

// Update packages sources list

# apt-get update

Refresh your update manager. 

/ *********

Part B:

// Or if you encounter the following errors after doing:


# apt-get update

E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/

// Stop apt-daily-upgrade.timer service temporarily

# systemctl stop apt-daily-upgrade.timer

// Proceed with  apt-get update

# apt-get update

// Re-enable apt-daily-upgrade.timer service

# systemctl start apt-daily-upgrade.timer


Comments