1

I'm trying to move my OS configuration over to org mode, and in the process I'd like to be able to tangle to write-protected directories like /etc

Unfortunately, tangle doesn't seem to work whenever the target file needs elevated permissions. So for instance, using org-babel-tangle works on this code block

#+BEGIN_SRC sh :tangle psmouse.conf
options psmouse synaptics_intertouch=1
#+END_SRC

but trying to tangle this one will ask me for my password (which I can give just fine) and then promptly fail

#+BEGIN_SRC sh :tangle /sudo::/etc/modprobe.d/psmouse.conf
options psmouse synaptics_intertouch=1
#+END_SRC

The error message I get in the minibuffer says

Copying directly failed. See buffer '*tramp/sudo root@pop-os*' for details

But the weird part is, although the buffer mentioned above is created on error, it's actually empty.

My Messages buffer is a little bit more informative as to what's going on

Setting up indent for shell type bash
Indentation variables are now local.
Indentation setup for shell type bash
Copying /tmp/tramp.l6Xnsw.conf to /sudo:root@pop-os:/etc/modeprobe.d/psmouse.conf...failed
tramp-error: Copying directly failed, see buffer ‘*tramp/sudo root@pop-os*’ for details.
| improve this question | | | | |
  • 1
    Did you try using the :dir /sudo:root@pop-os:/etc/modeprobe.d :tangle psmouse.conf :session *my-session* ? – Melioratus Feb 1 at 1:07
  • Just tried it: it removes the error ("1 block tangled successfully from file.org") but, weirdly, doesn't actually create the specified file – pipsqueaker117 Feb 2 at 7:20
  • 1
    That is weird. I’m going to guess the tangle put the file in ~root/ directory. If so, please try updating :tangle /etc/modeprobe.d :mkdirp yes and tangle again please. – Melioratus Feb 2 at 13:29
  • 1
    Sorry for the delay. Did the file still tangle as root user even though it was on Desktop? If so then we just need to troubleshoot the :tangle path. – Melioratus Feb 5 at 13:55
  • 1
    My own turn to apologize for the delay. I just revisited the problem, and my issue was a misspelling of the path I wanted to tangle to. I typo'd "modprobe" and "modeprobe" (this is actually visible in the error message I posted, meaning that I must not have actually tried to tangle the "sudo" block I posted since that's spelled right), and didn't pass the ":mkdirp yes" flag. A more informative error message might have been nice, but the fault is mine. Thank you for your help and patience, and sorry for wasting your time! – pipsqueaker117 Feb 22 at 4:12
1

The source of the error ended up being a spelling mistake on my part. See my comments on the question. Thanks to @Melioratus for their help!

| improve this answer | | | | |

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.