I think I've found a bug with emacs+org+babel. This block runs fine

#+BEGIN_SRC sh :dir /ssh:ubuntu@ :exports both :results output                                
sudo service --status-all                                                                                  

This block freezes emacs

#+BEGIN_SRC sh :dir /ssh:ubuntu@ :exports both :results output                                
sudo service apache2 status                                                                                   

enter image description here

This is the expected output

ubuntu@ip-172-31-4-188:~$ sudo service apache2 status
● apache2.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

1 Answer 1


Likely, there is a problem in handling the password of the sudo command. Try

#+BEGIN_SRC sh :dir /ssh:ubuntu@|sudo: :exports both :results output
service apache2 status

The sudo password is handled by Tramp then. This works for me, at least.

  • but, "sudo service --status-all" works.... Feb 17, 2018 at 20:02
  • on an Amazon EC2 ubuntu vm, the ubuntu user is a privileged "sodoer" , so no prompts to sudo. Feb 17, 2018 at 20:03
  • Have you tried whether the recipe works? This is what counts. Feb 18, 2018 at 9:06
  • No luck. same deal. Last thing printed in echo area is "Wrote /ssh:ubuntu@|sudo:root@" before emacs freezes Feb 18, 2018 at 21:45
  • You could try to trace Tramp, by setting tramp-verbose to 10. But I fear it won't help, because the freezing is in the command out of Tramp control. Feb 19, 2018 at 6:53

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.