How do I fix "Unknown error executing gpgv" when doing sudo apt-get update?
Solution 1
I have two solutions:
Solution #1 (Recommended ):
Just open a terminal and run the following commands:
sudo apt-get clean
sudo rm /var/lib/apt/lists/*
sudo rm /var/lib/apt/lists/partial/*
sudo apt-get clean
sudo apt-get update
Done! When running those
sudo rm ...
commands, don't worry about errors or warnings.Solution #2:
First remove all ppa repositories in Update Manager -> Settings -> Other Software;
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
sudo touch /etc/apt/sources.list
sudo apt-get update
sudo mv /etc/apt/sources.list.bak /etc/apt/sources.list
sudo apt-get update
Now add all your ppa repos back again.
sudo apt-get update
Done!
Solution 2
Your original error :
mv: cannot move `lists' to `lists.old/lists': Directory not empty
can be addressed by adding a timestamp to the directory rename as you can see below.
Also, by adding a &&
in between each line will demarcate each command will allow you to cut and paste entire set of below commands from your notes back into a terminal
sudo apt-get clean && \
cd /var/lib/apt && \
sudo mv lists lists.old_`date '+%Y%m%d_%H%M%S'` && \
sudo mkdir -p lists/partial && \
sudo apt-get clean && \
sudo apt-get update
another approach is to put it into a script which will exit on error ... vi myscript.sh
#!/bin/bash
set -o errexit
sudo apt-get clean
cd /var/lib/apt
sudo mv lists lists.old_`date '+%Y%m%d_%H%M%S'`
sudo mkdir -p lists/partial
sudo apt-get clean
sudo apt-get update
Related videos on Youtube
Kapil Anand
Updated on September 18, 2022Comments
-
Kapil Anand over 1 year
I got the following error
Reading package lists... Done W: GPG error: http://extras.ubuntu.com oneiric Release: Unknown error executing gpgv executing gpgv ---- ---- W: GPG error: http://archive.ubuntu.com oneiric-updates Release: Unknown error executing gpgv
Then after googling it I found and followed the following instruction but that caused one error:
**sudo -i apt-get clean cd /var/lib/apt mv lists lists.old mkdir -p lists/partial apt-get clean apt-get update**
While running I got the error:
kapil@ubuntu:/var/lib/apt$ sudo mv lists lists.old mv: cannot move `lists' to `lists.old/lists': Directory not empty
So once again running the update command I got the same error again. Please help me what should I do?
I did the following on your advice and it showed the following
root@ubuntu:/home/kapil# df -h Filesystem Size Used Avail Use% Mounted on /dev/loop0 15G 4.7G 8.8G 35% / udev 1.5G 4.0K 1.5G 1% /dev tmpfs 591M 880K 590M 1% /run none 5.0M 0 5.0M 0% /run/lock none 1.5G 488K 1.5G 1% /run/shm /dev/sda5 229G 221G 7.2G 97% /host /dev/sda1 100M 25M 76M 25% /media/System Reserved root@ubuntu:/home/kapil# ls -al /var/lib/apt/ total 68 drwxr-xr-x 7 root root 4096 2012-04-08 09:53 . drwxr-xr-x 58 root root 4096 2012-03-28 09:59 .. -rw-r--r-- 1 root root 203 2012-03-24 13:18 cdroms.list -rw-r--r-- 1 root root 7261 2012-04-06 15:27 extended_states drwxr-xr-x 2 root root 4096 2011-10-12 10:27 keyrings drwxr-xr-x 3 root root 16384 2012-04-14 06:26 lists drwxr-xr-x 4 root root 20480 2012-04-08 07:46 lists.old drwxr-xr-x 3 root root 4096 2011-10-12 10:27 mirrors drwxr-xr-x 2 root root 4096 2012-03-24 14:39 periodic*
When I followed the above instruction it showed following warnings first :
root@ubuntu:/home/kapil# sudo apt-get clean root@ubuntu:/home/kapil# sudo rm /var/lib/apt/lists/* rm: cannot remove `/var/lib/apt/lists/partial': Is a directory root@ubuntu:/home/kapil# sudo rm /var/lib/apt/lists/partial/* root@ubuntu:/home/kapil# sudo apt-get clean root@ubuntu:/home/kapil# sudo apt-get update
After this it again showed the error :
Reading package lists... Done W: GPG error: http//archive.canonical.com oneiric Release: Unknown error executing gpgv W: GPG error: http//extras.ubuntu.com oneiric Release: Unknown error executing gpgv W: GPG error: http//archive.ubuntu.com oneiric Release: Unknown error executing gpgv W: GPG error: http//archive.ubuntu.com oneiric-backports Release: Unknown error executing gpgv W: GPG error: http//archive.ubuntu.com oneiric-security Release: Unknown error executing gpgv W: GPG error: http//archive.ubuntu.com oneiric-proposed Release: Unknown error executing gpgv W: GPG error: http//archive.ubuntu.com oneiric-updates Release: Unknown error executing gpgv
What to do now?
-
jippie about 12 yearsLong shot, but please check file system usage with
df -h
. Also check if lists.old already exists. In that case move it somewhere else. -
Kapil Anand about 12 yearsThanks for ur answer but im a amateur in ubuntu ...can u give me step wise intruction for above advice because im not allowed to move a folder/file in root folder location of "var/lib/apt"
-
jippie about 12 yearsEnter the following on the command line, then update your question with what you found:
df -h
andls -al /var/lib/apt/
-
Kapil Anand about 12 yearsdone ... i hv updated in above problem to show u the output..
-
jippie about 12 yearsYou're currently booted from a (install) CD?
-
Kapil Anand about 12 yearsno i have installed ubuntu 11.10 in windows ...no booting from a CD
-
jippie about 12 yearsI find the
/dev/loop0
for the root filesystem fishy. Can you give us the output tomount
andlosetup -a
?
-
-
Kapil Anand about 12 yearsi have mentioned the output ...problem still persists ...any help will be greatfull .kindly help
-
Seyed Mohammad about 12 yearsThe commands I provided are slightly different from those you posted in the question. Carefully follow the commands I have provided. These should work, because I've used this method to solve GPG-errors many times and it has always worked for me.
-
Kapil Anand about 12 yearsi have updated my question by including ur instruction tht u just said...check the o/p whihch im getting .....@seyed
-
Kapil Anand about 12 yearsplz reply to my question @ seyed mohammad
-
Seyed Mohammad about 12 yearsHmm, strange! Currently I don't have any clue why this didn't fix the issue. I will come back as soon as I find anything useful.
-
Seyed Mohammad about 12 yearsOK, I have edited my solution by providing another fix. If this one doesn't work too, I'm afraid I'm out of solutions for you! But I'm almost sure that one of these solutions should work for you.