0

Due to COVID-19 we are working from home. Now I have a linux (Ubuntu) pc at my workplace which has TortoiseHG Workbench installed. I connect via MobaXTerm to my computer over ssh.

Normally when I try to update the repo it works due to the password and user is saved in the keyring. Now when I connect over ssh I can not update my repos due to an error in THG:

** Mercurial Distributed SCM (version 4.5.3)
** Extensions loaded: mercurial_keyring, extdiff, rebase, strip, histedit, tortoisehg.util.hgcommands, tortoisehg.util.partialcommit, tortoisehg.util.pipeui, tortoisehg.util.hgdispatch
Traceback (most recent call last):
  File "/usr/bin/hg", line 41, in <module>
    dispatch.run()
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 88, in run
    status = (dispatch(req) or 0) & 255
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 183, in dispatch
    ret = _runcatch(req)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 324, in _runcatch
    return _callcatch(ui, _runcatchfunc)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 332, in _callcatch
    return scmutil.callcatch(ui, func)
  File "/usr/lib/python2.7/dist-packages/mercurial/scmutil.py", line 154, in callcatch
    return func()
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 314, in _runcatchfunc
    return _dispatch(req)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 918, in _dispatch
    cmdpats, cmdoptions)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 673, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 926, in _runcommand
    return cmdfunc()
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 915, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
  File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 1197, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mercurial/commands.py", line 4764, in serve
    return server.runservice(opts, initfn=service.init, runfn=service.run)
  File "/usr/lib/python2.7/dist-packages/mercurial/server.py", line 107, in runservice
    return runfn()
  File "/usr/lib/python2.7/dist-packages/mercurial/commandserver.py", line 339, in run
    return sv.serve()
  File "/usr/lib/python2.7/dist-packages/mercurial/commandserver.py", line 292, in serve
    while self.serveone():
  File "/usr/lib/python2.7/dist-packages/mercurial/commandserver.py", line 267, in serveone
    handler(self)
  File "/usr/lib/python2.7/dist-packages/mercurial/commandserver.py", line 251, in runcommand
    ret = (dispatch.dispatch(req) or 0) & 255 # might return None
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 183, in dispatch
    ret = _runcatch(req)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 324, in _runcatch
    return _callcatch(ui, _runcatchfunc)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 332, in _callcatch
    return scmutil.callcatch(ui, func)
  File "/usr/lib/python2.7/dist-packages/mercurial/scmutil.py", line 154, in callcatch
    return func()
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 314, in _runcatchfunc
    return _dispatch(req)
  File "/usr/lib/python2.7/dist-packages/tortoisehg/util/hgdispatch.py", line 23, in _dispatch
    return orig(req)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 918, in _dispatch
    cmdpats, cmdoptions)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 673, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 926, in _runcommand
    return cmdfunc()
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 915, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
  File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 1197, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 1197, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/hgext/rebase.py", line 1771, in pullrebase
    ret = orig(ui, repo, *args, **opts)
  File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 1197, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mercurial/commands.py", line 3990, in pull
    other = hg.peer(repo, opts, source)
  File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 181, in peer
    return _peerorrepo(rui, path, create).peer()
  File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 156, in _peerorrepo
    obj = _peerlookup(path).instance(ui, path, create)
  File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 497, in instance
    inst._fetchcaps()
  File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 239, in _fetchcaps
    self._caps = set(self._call('capabilities').split())
  File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 407, in _call
    fp = self._callstream(cmd, **args)
  File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 336, in _callstream
    resp = self._openurl(req)
  File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 193, in _openurl
    ret = self._urlopener.open(req)
  File "/usr/lib/python2.7/urllib2.py", line 435, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 548, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 467, in error
    result = self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 916, in http_error_401
    url, req, headers)
  File "/usr/lib/python2.7/dist-packages/mercurial/url.py", line 422, in http_error_auth_reqed
    self, auth_header, host, req, headers)
  File "/usr/lib/python2.7/dist-packages/mercurial_keyring.py", line 565, in basic_http_error_auth_reqed
    return basic_http_error_auth_reqed.orig(self, authreq, host, req, headers)
  File "/usr/lib/python2.7/urllib2.py", line 894, in http_error_auth_reqed
    return self.retry_http_basic_auth(host, req, realm)
  File "/usr/lib/python2.7/dist-packages/mercurial/url.py", line 426, in retry_http_basic_auth
    realm, urllibcompat.getfullurl(req))
  File "/usr/lib/python2.7/dist-packages/mercurial_keyring.py", line 556, in find_user_password
    return self._pwd_handler.find_auth(self, realm, authuri, req)
  File "/usr/lib/python2.7/dist-packages/mercurial_keyring.py", line 386, in find_auth
    pwmgr, realm, authuri, skip_caches=after_bad_auth)
  File "/usr/lib/python2.7/dist-packages/mercurial_keyring.py", line 349, in get_credentials
    keyring_pwd = password_store.get_http_password(keyring_url, actual_user)
  File "/usr/lib/python2.7/dist-packages/mercurial_keyring.py", line 164, in get_http_password
    self._format_http_key(url, username))
  File "/usr/lib/python2.7/dist-packages/mercurial_keyring.py", line 206, in _read_password_from_keyring
    password = keyring.get_password(KEYRING_SERVICE, pwdkey)
  File "/usr/lib/python2.7/dist-packages/keyring/core.py", line 41, in get_password
    return _keyring_backend.get_password(service_name, username)
  File "/usr/lib/python2.7/dist-packages/keyring/backends/SecretService.py", line 66, in get_password
    collection = self.get_preferred_collection()
  File "/usr/lib/python2.7/dist-packages/keyring/backends/SecretService.py", line 60, in get_preferred_collection
    raise InitError("Failed to unlock the collection!")
keyring.errors.InitError: Failed to unlock the collection!
** Unknown exception encountered with possibly-broken third-party extension mercurial_keyring
** which supports versions unknown of Mercurial.
** Please disable mercurial_keyring and try your action again.
** If that fixes the bug please report it to https://bitbucket.org/Mekk/mercurial_keyring/issues
** Python 2.7.17 (default, Apr 15 2020, 17:20:14) [GCC 7.5.0]
** Mercurial Distributed SCM (version 4.5.3)
** Extensions loaded: mercurial_keyring, extdiff, rebase, strip, histedit, tortoisehg.util.hgcommands, tortoisehg.util.partialcommit, tortoisehg.util.pipeui, tortoisehg.util.hgdispatch
cmdserver: process exited unexpectedly with code 1

As I understand the keyring demon has not been started. I did some research but could not find a way to start the right agent. Is it right, that Ubuntu Gnome has a special keyring which only starts when the desktop environment starts? How can I start that service?

0

You can start GNOME keyring on a host, for example following these instructions.

However, if you are accessing a regular desktop PC, you might already have an X session, just locked. If this is the case, you can just share these credentials with the ssh session. Then, you only need to share the credentials to access the daemon:

$ source $HOME/.dbus/session-bus/*-0

see also other options.

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.