S.gpg-agent.browser not found error while adding ppa in debian strech

Sathish Kumar picture Sathish Kumar · Jul 4, 2017 · Viewed 16.8k times · Source

I am using debian strech. I try to add repostory for vim with python support , while adding I encountered gpg-agent.browser not found error

sudo add-apt-repository ppa:pi-rho/dev
[sudo] password for sathish: 
Dev Packages
More info: https://launchpad.net/~pi-rho/+archive/ubuntu/dev
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keybox '/tmp/tmpxl_vk750/pubring.gpg' created
gpg: /tmp/tmpxl_vk750/trustdb.gpg: trustdb created
gpg: key CC892FC6779C27D7: public key "Launchpad PPA for pi-rho" imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg: no valid OpenPGP data found.
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 688, in addkey_func
    func(**kwargs)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 386, in add_key
    return apsk.add_ppa_signing_key()
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 273, in add_ppa_signing_key
    cleanup(tmp_keyring_dir)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 234, in cleanup
    shutil.rmtree(tmp_keyring_dir)
  File "/usr/lib/python3.5/shutil.py", line 480, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib/python3.5/shutil.py", line 438, in _rmtree_safe_fd
    onerror(os.unlink, fullname, sys.exc_info())
  File "/usr/lib/python3.5/shutil.py", line 436, in _rmtree_safe_fd
    os.unlink(name, dir_fd=topfd)
FileNotFoundError: [Errno 2] No such file or directory: 'S.gpg-agent.browser'

Answer

Artem picture Artem · Aug 18, 2017

This is how it worked for me:

  1. Look for the file S.gpg-agent.browser, it resides under /root in my system
  2. Login (i.e. su) as root. Update: not necessary, just execute the last item under sudo, it does not change current directory
  3. cd to /root
  4. execute add-apt-repository ppa:pi-rho/dev or sudo add-apt-repository ppa:pi-rho/dev

If execution fails the same way - execute add-apt-repository ppa:pi-rho/dev again.

The point is to execute the script from the directory where it looks for this file. This is a gpg-agent's socket file, agent is started automatically by gpg, but sometimes it takes some time to start, so you need to execute twice.

Of course, there is a right way to fix this issue updating some configuration, but I'm not familiar with linux that much.