1

I am new to tramp and I am trying to edit a file stored in a remote server. I connect to the file through C-x C-f /ssh:username@host:path_to_file/myfile.m. And on my init.el I have the options: (setq tramp-default-method "ssh") and (setq auto-save-file-name-transforms nil).

After editing the file and trying to save it (C-x C-s), I get the following messages:

Saving file /ssh:username@host:/mypath/myfile.m...
Opening output file: No such file or directory, /ssh:username@host:/mypath/tramp.11638_lq.m

Problem: If I reopen the file I get the outdated version.

Question: Why can't I save the file with C-x C-s? And why is emacs trying to save a file named tramp.11638_lq.m?

Why is this happening and how can I fix it? Thanks for helping! :D

Edit 1: I connect to the server via /ssh:root@ip:/pathtofile/test.org, and debugging tramp while trying to save this file gives me this

10:50:58.242647 tramp-do-file-attributes-with-perl (5) # file attributes with perl: /Users/guilhermesalome/test.org
10:50:58.242811 tramp-send-command (6) # tramp_perl_file_attributes /Users/guilhermesalome/test.org integer 2>/dev/null; echo tramp_exit_status $?
10:50:58.271392 tramp-wait-for-regexp (6) # 
(nil 1 0 20 (23405 40366) (23401 56356) (23401 56356) 6.0 33188 t (23 . 40963) -1)
tramp_exit_status 0
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:50:58.273742 tramp-send-command (6) # test -e /Users/guilhermesalome/ 2>/dev/null; echo tramp_exit_status $?
10:50:58.298278 tramp-wait-for-regexp (6) # 
tramp_exit_status 0
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:50:58.300366 tramp-do-file-attributes-with-perl (5) # file attributes with perl: /Users/guilhermesalome/test.org
10:50:58.300588 tramp-send-command (6) # tramp_perl_file_attributes /Users/guilhermesalome/test.org string 2>/dev/null; echo tramp_exit_status $?
10:50:58.327907 tramp-wait-for-regexp (6) # 
(nil 1 "root" "dialout" (23405 40366) (23401 56356) (23401 56356) 6.0 33188 t (23 . 40963) -1)
tramp_exit_status 0
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:50:58.331693 tramp-send-command (6) # tramp_perl_file_name_all_completions /Users/guilhermesalome/
10:50:58.406682 tramp-wait-for-regexp (6) # 
../
test.org
test.org~
./
ok
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:50:58.407878 tramp-sh-handle-file-truename (4) # Finding true name for ‘/ssh:[email protected]:/Users/guilhermesalome/test.org’
10:50:58.408037 tramp-send-command (6) # \readlink --canonicalize-missing /Users/guilhermesalome/test.org 2>/dev/null; echo tramp_exit_status $?
10:50:58.433204 tramp-wait-for-regexp (6) # 
/Users/guilhermesalome/test.org
tramp_exit_status 0
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:50:58.434297 tramp-sh-handle-file-truename (4) # True name of ‘/Users/guilhermesalome/test.org’ is ‘/Users/guilhermesalome/test.org’
10:50:58.435968 tramp-send-command (6) # getfacl / 2>/dev/null; echo tramp_exit_status $?
10:50:58.461641 tramp-wait-for-regexp (6) # 
# file: .
# owner: root
# group: root
user::rwx
group::rwx
other::r-x

tramp_exit_status 0
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:50:58.462045 tramp-send-command (6) # getfacl -ac /Users/guilhermesalome/test.org 2>/dev/null; echo tramp_exit_status $?
10:50:58.488027 tramp-wait-for-regexp (6) # 
user::rw-
group::r--
other::r--

tramp_exit_status 0
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:50:58.488945 tramp-send-command (6) # selinuxenabled 2>/dev/null; echo tramp_exit_status $?
10:50:58.513190 tramp-wait-for-regexp (6) # 
tramp_exit_status 127
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:50:58.515428 tramp-do-file-attributes-with-perl (5) # file attributes with perl: /Users/guilhermesalome/
10:50:58.515669 tramp-send-command (6) # tramp_perl_file_attributes /Users/guilhermesalome/ string 2>/dev/null; echo tramp_exit_status $?
10:50:58.542839 tramp-wait-for-regexp (6) # 
(t 2 "root" "root" (23405 42406) (23405 42346) (23405 42346) 4096.0 16877 t (23 . 40962) -1)
tramp_exit_status 0
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:50:58.544147 tramp-do-file-attributes-with-perl (5) # file attributes with perl: /Users/guilhermesalome/
10:50:58.544389 tramp-send-command (6) # tramp_perl_file_attributes /Users/guilhermesalome/ integer 2>/dev/null; echo tramp_exit_status $?
10:50:58.571390 tramp-wait-for-regexp (6) # 
(t 2 0 0 (23405 42406) (23405 42346) (23405 42346) 4096.0 16877 t (23 . 40962) -1)
tramp_exit_status 0
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:50:58.574580 tramp-send-command (6) # test -d /Users/guilhermesalome/test.org 2>/dev/null; echo tramp_exit_status $?
10:50:58.598908 tramp-wait-for-regexp (6) # 
tramp_exit_status 1
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:50:58.601656 tramp-do-copy-or-rename-file (0) # Copying /ssh:[email protected]:/Users/guilhermesalome/test.org to /ssh:[email protected]:/Users/guilhermesalome/test.org~...
10:50:58.605603 tramp-send-command (6) # cp -f -p /Users/guilhermesalome/test.org /Users/guilhermesalome/test.org\~ 2>/dev/null; echo tramp_exit_status $?
10:50:58.631692 tramp-wait-for-regexp (6) # 
tramp_exit_status 0
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:50:58.633161 tramp-send-command (6) # env TZ=UTC \touch -t 201808071751.32 /Users/guilhermesalome/test.org\~ 2>/dev/null; echo tramp_exit_status $?
10:50:58.658243 tramp-wait-for-regexp (6) # 
tramp_exit_status 0
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:50:58.659226 tramp-send-command (6) # chmod 644 /Users/guilhermesalome/test.org\~ 2>/dev/null; echo tramp_exit_status $?
10:50:58.684330 tramp-wait-for-regexp (6) # 
tramp_exit_status 0
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:50:58.685627 tramp-do-copy-or-rename-file (0) # Copying /ssh:[email protected]:/Users/guilhermesalome/test.org to /ssh:[email protected]:/Users/guilhermesalome/test.org~...done
10:50:58.686703 tramp-send-command (6) # setfacl --set-file=- /Users/guilhermesalome/test.org\~ <<'82abb4c70752cb3ab3e23e781c74e270'
user::rw-
group::r--
other::r--

82abb4c70752cb3ab3e23e781c74e270
10:50:58.712340 tramp-wait-for-regexp (6) # 
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:50:58.712732 tramp-send-command (6) # echo tramp_exit_status $?
10:50:58.737094 tramp-wait-for-regexp (6) # 
tramp_exit_status 0
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:50:58.739244 tramp-send-command (6) # test -e /Users/guilhermesalome/ 2>/dev/null; echo tramp_exit_status $?
10:50:58.763746 tramp-wait-for-regexp (6) # 
tramp_exit_status 0
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:50:58.764897 tramp-do-file-attributes-with-perl (5) # file attributes with perl: /Users/guilhermesalome/
10:50:58.765132 tramp-send-command (6) # tramp_perl_file_attributes /Users/guilhermesalome/ string 2>/dev/null; echo tramp_exit_status $?
10:50:58.793686 tramp-wait-for-regexp (6) # 
(t 2 "root" "root" (23405 42406) (23405 42346) (23405 42346) 4096.0 16877 t (23 . 40962) -1)
tramp_exit_status 0
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:50:58.794940 tramp-do-file-attributes-with-perl (5) # file attributes with perl: /Users/guilhermesalome/
10:50:58.795185 tramp-send-command (6) # tramp_perl_file_attributes /Users/guilhermesalome/ integer 2>/dev/null; echo tramp_exit_status $?
10:50:58.821953 tramp-wait-for-regexp (6) # 
(t 2 0 0 (23405 42406) (23405 42346) (23405 42346) 4096.0 16877 t (23 . 40962) -1)
tramp_exit_status 0
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:51:18.933723 tramp-sh-handle-file-truename (4) # Finding true name for ‘/ssh:[email protected]:/Users/guilhermesalome/test.org’
10:51:18.933872 tramp-send-command (6) # \readlink --canonicalize-missing /Users/guilhermesalome/test.org 2>/dev/null; echo tramp_exit_status $?
10:51:18.960843 tramp-wait-for-regexp (6) # 
/Users/guilhermesalome/test.org
tramp_exit_status 0
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:51:18.962644 tramp-do-file-attributes-with-perl (5) # file attributes with perl: /Users/guilhermesalome/test.org
10:51:18.963585 tramp-send-command (6) # tramp_perl_file_attributes /Users/guilhermesalome/test.org integer 2>/dev/null; echo tramp_exit_status $?
10:51:18.990091 tramp-wait-for-regexp (6) # 
(nil 1 0 20 (23405 40366) (23401 56356) (23401 56356) 6.0 33188 t (23 . 40963) -1)
tramp_exit_status 0
///ae57c2b1a4c9c01ffc0931388f49cffb#$
10:51:18.990493 tramp-sh-handle-file-truename (4) # True name of ‘/Users/guilhermesalome/test.org’ is ‘/Users/guilhermesalome/test.org’

Edit 2: I am on GNU Emacs 26.1 on Mac OS high sierra, and there is not init.el besides the following

(setq tramp-default-method "ssh"
      tramp-auto-save-directory "~/tmp/tramp/"
      tramp-chunk-size 2000
      tramp-default-user "root"
      tramp-verbose 6)
2
  • Try emacs -Q and see, whether the problem still persist. If not (that's what I expect), bisect your .emacs in order to see what's up. Commented Dec 30, 2017 at 19:38
  • @MichaelAlbinus I am running into this problem without a .emacs, just the bare bones tramp configuration. Commented Aug 10, 2018 at 14:44

2 Answers 2

1

Emacs saves files by creating a new file with a temporary name, deleting the old file, and then renaming the new file to the correct name. This is less error-prone; you won't end up with content from the new and old files mixed together if there's an error during writing. Check that you have permission to create files in that directory on the remote machine.

4
  • Thanks for your comment. I thought I had permission to write since I was able to copy and extract files in the folder I am working at. Is there a good way to check for that? Commented Jan 2, 2018 at 15:42
  • I connected via ssh using terminal and I was able to create/write/delete files in the directory. Commented Jan 2, 2018 at 16:06
  • Make a more verbose log and it may reveal what's going on: gnu.org/software/emacs/manual/html_node/tramp/…
    – db48x
    Commented Jan 2, 2018 at 18:54
  • I edited the question to have what I find from debugging when trying to save a file. Commented Aug 10, 2018 at 14:55
1

I've been testing other versions of Emacs for Mac, and it seems this error was somehow caused by the Emacs version I was using.

I was using these binaries.

I tested other Emacs versions: Aquamacs, Emacsformacosx, Homebrew version (--with-cocoa), and MacPorts version (emacs-app). From those, the Homebrew version also generated the same error when saving a remote file.

However, the Emacs from Aquamacs, Emacsformacosx and MacPorts all just worked!

1
  • If you are using the current MacPorts install (at this time 26.1), then emacs-jupyter install might not work. However, you can still install it with the Emacs Homebrew version (brew cask install emacs), and then go back to MacPorts version and use emacs-jupyter. See this discussion for details. Commented Feb 14, 2019 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.