glacambre / firenvim

Embed Neovim in Chrome, Firefox & others.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Neovim died without answering"

ASong5 opened this issue · comments

  • OS Version: Kubuntu v23.10, KDE Plasma 5.27 Wayland
  • Browser Version: Mozilla Firefox 122.0 - deb version, not snap/flatpak
  • Browser Addon Version: 0.2.15
  • Neovim Plugin Version: 0.10.0

What I tried to do

  • Installed firenvim using lazy with the following .lua config (also tried the suggested config in the installation section which includes lazy loading - same result):
return {
    'glacambre/firenvim',
    build = function()
        vim.fn["firenvim#install"](0)
    end
}
  • Successfully ran $ nvim --headless "+call firenvim#install(0) | q"
  • Installed firenvim firefox extension
  • Ensured that firenvim script was created by running:
    echo 'abcde{}' | ${XDG_DATA_HOME:-${HOME}/.local/share}/firenvim/firenvim
  • Ensured that firenvim native manifest was created by running:
    ls $HOME/.mozilla/native-messaging-hosts

What happened

  • When focusing a textarea, firenvim does not open
    • <C-e> does not open it either
  • I see the following when I click the extension icon:
    image
    • The same message is logged in the background console when I click the icon (but not when focusing a textarea element or clicking the "Reload settings" button, as mentioned under the relevant troubleshooting section)
  • Alternatively, when using the default lazy config that includes lazy loading, I get:
Error detected while processing command line:
E117: Unknown function: firenvim#install

when running nvim --headless "+call firenvim#install(0) | q" or call firenvim#install(0) from within neovim

Hey, thanks for the quick reply. As I mentioned under "Browser Version", I am using the deb version of firefox, not snap nor flatpak. Firefox does not show up under snap list or flatpak list.

Thanks

As I mentioned under "Browser Version", I am using the deb version of firefox, not snap nor flatpak.

Ah, yes, sorry, did not see the edit through email :).

Would it be possible for you to:

  • Edit ${XDG_DATA_HOME:-${HOME}/.local/share}/firenvim/firenvim to add touch /tmp/firenvim_script_has_run before thhe mkdir -p line
  • Afterwards, in Firefox, click the "Reload settings" button twice
  • Then, check if a file named "firenvim_script_has_run" exists in /tmp.

This should tell us if the problem is that firefox cannot run the firenvim script, or if the problem is that the firenvim script cannot run neovim.

I followed those instructions and "firenvim_script_has_run" was generated in /tmp. I take this to mean that firenvim isn't able to run neovim for some reason? How do we go about troubleshooting this?

Great, that's progress! In order to debug this, please try the following:

  • Remove the touch line you added to the firenvim script
  • Replace the exec at the end of the firenvim script with tee /tmp/firenvim_stdin |
  • Append tee /tmp/firenvim_stdout at the end of the same line

i.e. the last line of the firenvim script should look like this:

tee /tmp/firenvim_stdin | 'PATH_TO_YOUR_NVIM_BINARY' --headless --cmd [very long list of arguments] | tee /tmp/firenvim_stdout

Then, try to reload your firenvim settings twice, and upload the content of the files named /tmp/firenvim_stdin and /tmp/firenvim_stdout here :)

It turns out I may have messed up a bit; it seems like previously when I had added the "touch firenvim_script_has_run", the file was generated only because I had inadvertently run the nvim --headless "+call firenvim#install(0) | q
command afterwards. Reloading the settings via the firenvim extension in firefox does not seem to generate the file, nor the ...stdin/...stdout files via the tee commands. So it seems that firefox isn't able to execute the firenvim script.

Apologies for the confusion - would appreciate if you could continue to help me diagnose the problem :)

Okay, so the problem likely is that firefox cannot run the firenvim script. Could you close all firefox instances and then from your terminal run strace -o /tmp/strace -s 4096 -Tfe trace=clone,execve firefox, and once firefox has started click the "reload settings" button? Once this is done, shut down firefox and upload the file /tmp/strace here :)

strace.txt

Grepping for "firenvim" outputs some "EACCES (Permission Denied) errors. Is this relevant? Is it a permissions issue?

We know that the script is executable because you were able to run it from the command line, so it sounds firefox is being denied the right to run the firenvim script. This sounds a lot like #1363 (comment) , so it's likely that a firefox downloaded from Mozilla's website would work.

I wonder if this has something to do with Ubuntu's default apparmor profile for Firefox. Could you upload your /var/log/kern.log and /var/log/audit/audit.log here?

Yup, that seemed to fix the issue. I think it may have been due to the fact that when I first installed Kubuntu a while back, it automatically had a snap version of firefox installed. I've since deleted that version, but I'm guessing there were some remaining configs leftover that were still being used for some reason...

It does seem like apparmor was denying access to the script:

kern.log
I don't seem to have an audit folder.

In any case, seems like everything works now. Thanks for your assistance 🫡

Great, thanks for providing logs! I've opened #1584 to see if firenvim#install can detect this issue and warn about it :)