I have a one-line patch (attached) that works for me on Ubuntu Xenial (16.04). There is a related bug report: https://bugs.launchpad.net/ubuntu/+source/emacs24/+bug/1594166
The patch changes the test for the control path to the one used in emacs25. David. -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
Patch provides alternative test for to determine ssh options. This is effectively a backport of this fix for emacs 25.0: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20015Index: emacs24-24.5+1/lisp/net/tramp.el =================================================================== --- emacs24-24.5+1.orig/lisp/net/tramp.el +++ emacs24-24.5+1/lisp/net/tramp.el @@ -320,7 +320,7 @@ useful only in combination with `tramp-d (unless (zerop (length result)) (with-temp-buffer (call-process - "ssh" nil t nil "-o" "ControlPath=%C" "host.does.not.exist") + "ssh" nil t nil "-p" "23" "-o" "ControlPath=%C" "localhost") (goto-char (point-min)) (if (search-forward-regexp "unknown.+key" nil t) (setq result