'W: GPG error: Unknown error executing apt-key

While running "sudo apt-get update", I getting below error:

Err:1 https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64  InRelease                                                                                     
  Unknown error executing apt-key
Err:2 http://in.archive.ubuntu.com/ubuntu bionic InRelease                                                                                                                 
  Unknown error executing apt-key
Err:5 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease                                                                                                       
  Unknown error executing apt-key
Err:6 http://packages.microsoft.com/repos/code stable InRelease                                                                                                            
  Unknown error executing apt-key
Err:4 https://download.docker.com/linux/ubuntu bionic InRelease                                                                                                            
  Unknown error executing apt-key
and more ...

While running "sudo apt install gpg", I getting below error:

/usr/bin/apt-key: 659: /usr/bin/apt-key: grep: not found
Warning: The postinst maintainerscript of the package cumulus-archive-keyring
Warning: seems to use apt-key (provided by apt) without depending on gnupg or gnupg2.
Warning: This will BREAK in the future and should be fixed by the package maintainer(s).
Note: Check first if apt-key functionality is needed at all - it probably isn't!
/usr/bin/apt-key: 695: /usr/bin/apt-key: touch: not found
dpkg: error processing package cumulus-archive-keyring (--configure):
 installed cumulus-archive-keyring package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
 cumulus-archive-keyring
sh: 1: touch: not found
E: Sub-process /usr/bin/dpkg returned an error code (1)

Also, I similar error while running, "sudo apt install grep --reinstall".

"sudo apt install cumulus-archive-keyring" gave below error:

After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up cumulus-archive-keyring (4-cl3u5) ...
/usr/bin/apt-key: 659: /usr/bin/apt-key: grep: not found
Warning: The postinst maintainerscript of the package cumulus-archive-keyring
Warning: seems to use apt-key (provided by apt) without depending on gnupg or gnupg2.
Warning: This will BREAK in the future and should be fixed by the package maintainer(s).
Note: Check first if apt-key functionality is needed at all - it probably isn't!
/usr/bin/apt-key: 695: /usr/bin/apt-key: touch: not found
dpkg: error processing package cumulus-archive-keyring (--configure):
 installed cumulus-archive-keyring package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
 cumulus-archive-keyring
sh: 1: touch: not found
E: Sub-process /usr/bin/dpkg returned an error code (1)

I tried to update all gpg key as well by: gpg --refresh-keys and apt-key. But nothing worked.

I couldn't install the y-ppa-manager manager as well.

I'm stuck, kindly help me! Thank you.



Solution 1:[1]

After some inspection I found out that "/usr/bin/touch" exist but not '/bin/touch', install the same using "sudo apt-get install --reinstall coreutils" solved my problem.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rajendra Singh