2

I'm having a weird problem opening files as root. From emacs -Q, I issue (require 'tramp), customize tramp-verbose to 10, and try to open a file as root: C-x C-f /su::/etc/fstab. I'm then prompted for my root password. Entering the password, Emacs pauses for ca. 10 seconds, then appears to open a new file called fstab, but it's not the fstab that already exists in /etc/fstab. The message about calling make-directory to create the parent directories shows up, so I've apparently opened a new file somewhere. I can't see where, exactly, as C-x C-f, or even M-x shell-commmand pwd both prompt me for the root password, and then fail.

Despite having turned tramp-verbose to the maximum value, there's not much in my *Messages* buffer after all this:

Creating customization setup...done
Tramp: Opening connection for root@onottra672626p using su...
Tramp: Sending command ‘exec su - root’
Tramp: Waiting for prompts from remote shell...
Tramp: Sending Password
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for root@onottra672626p using su...failed
Use M-x make-directory RET RET to create the directory and its parents

Tramp: Checking ‘vc-registered’ for /su:root@onottra672626p: /etc/fstab...failed
Use M-x make-directory RET RET to create the directory and its parents
Tramp: Opening connection for root@ using su...
Tramp: Sending command ‘exec su - root’
Tramp: Waiting for prompts from remote shell...
Tramp: Sending Password
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for root@onottra672626p using su...failed
Quit

This is all on a laptop, I'm not trying to connect to another machine.

Emacs 25.1.91.1, and confirmed again with Emacs 25.2.1.

Any suggestions for further troubleshooting, or is this just a regular bug?

Update

The problem was due to my use of the powerline prompt. The debug-log contained the lines:

08:34:24.189824 tramp-accept-process-output (10) # *tramp/su root@....* run *tramp/su root@....*

[30;41m~ [0;31m [m

The symbol is provided by powerline. Tramp needs to detect shell prompts, and this unexpected character was confusing it. The fix required modifying the variable tramp-shell-prompt-pattern to include the new symbol:

Original value was: "\(?:^\| \)[^]#$%>\n]*#?[]#$%>] \(\[[0-9;][a-zA-Z] \)"

New new, corrected value is "\(?:^\| \)[^]#$%>\n]*#?[]#$%>] \(\[[0-9;][a-zA-Z] \)"

2

For the records, this has been discussed on the Emacs bugtracker. It's not a Tramp error, but an unusual prompt from the remote machine.

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.